提交 2525ce0b authored 作者: Andrei Tokar's avatar Andrei Tokar

MVTableEngine.close() - adjust parameter type to it's usage to avoid confusion

上级 ea8fd10f
......@@ -1519,16 +1519,18 @@ public class Database implements DataHandler {
}
}
reconnectModified(false);
if (store != null && store.getMvStore() != null && !store.getMvStore().isClosed()) {
long maxCompactTime = dbSettings.maxCompactTime;
if (compactMode == CommandInterface.SHUTDOWN_COMPACT ||
if (store != null) {
MVStore mvStore = store.getMvStore();
if (mvStore != null && !mvStore.isClosed()) {
boolean compactFully =
compactMode == CommandInterface.SHUTDOWN_COMPACT ||
compactMode == CommandInterface.SHUTDOWN_DEFRAG ||
getSettings().defragAlways) {
maxCompactTime = Long.MAX_VALUE;
} else {
getSettings().defragAlways;
if (!compactFully && !mvStore.isReadOnly()) {
store.compactFile(dbSettings.maxCompactTime);
}
store.close(maxCompactTime);
store.close(compactFully);
}
}
if (systemSession != null) {
systemSession.close();
......
......@@ -360,19 +360,18 @@ public class MVTableEngine implements TableEngine {
* fill rate are compacted, but old chunks are kept for some time, so
* most likely the database file will not shrink.
*
* @param maxCompactTime the maximum time in milliseconds to compact
* @param compactFully true if storage need to be compacted after closer
*/
public void close(long maxCompactTime) {
public void close(boolean compactFully) {
try {
if (!mvStore.isClosed() && mvStore.getFileStore() != null) {
boolean compactFully = false;
if (!mvStore.getFileStore().isReadOnly()) {
FileStore fileStore = mvStore.getFileStore();
if (!mvStore.isClosed() && fileStore != null) {
if (fileStore.isReadOnly()) {
compactFully = false;
} else {
transactionStore.close();
if (maxCompactTime == Long.MAX_VALUE) {
compactFully = true;
}
}
String fileName = mvStore.getFileStore().getFileName();
String fileName = fileStore.getFileName();
mvStore.close();
if (compactFully && FileUtils.exists(fileName)) {
// the file could have been deleted concurrently,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论