Optimizes a database after updates. @param data data @throws IOException I/O Exception
(final Data data)
| 71 | * @throws IOException I/O Exception |
| 72 | */ |
| 73 | public static void finish(final Data data) throws IOException { |
| 74 | // do nothing if database has been closed |
| 75 | if(data.closed()) return; |
| 76 | // GH-676: optimize database and rebuild index structures if ID has turned negative |
| 77 | if(data.meta.lastid < data.meta.size - 1) optimizeIds(data); |
| 78 | // GH-1035: auto-optimize database |
| 79 | if(data.meta.autooptimize) optimize(data, null); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Optimizes the structures of a database. |