提交 3b946e53 authored 作者: Andrei Tokar's avatar Andrei Tokar

move table analysis to its original place and commit separate analisys Tx

上级 264fd2f7
...@@ -693,7 +693,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -693,7 +693,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
// (create/drop table and so on) // (create/drop table and so on)
database.commit(this); database.commit(this);
} }
analyzeTables();
removeTemporaryLobs(true); removeTemporaryLobs(true);
if (undoLog != null && undoLog.size() > 0) { if (undoLog != null && undoLog.size() > 0) {
undoLog.clear(); undoLog.clear();
...@@ -708,18 +707,26 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -708,18 +707,26 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
} }
} }
if (tablesToAnalyze != null) {
if (database.isMVStore()) {
// table analysis will cause a new transaction(s) to be opened,
// so we need to commit afterwards whatever leftovers might be
analyzeTables();
commit(true);
} else {
analyzeTables();
}
}
endTransaction(); endTransaction();
} }
private void analyzeTables() { private void analyzeTables() {
int rowCount = getDatabase().getSettings().analyzeSample / 10; int rowCount = getDatabase().getSettings().analyzeSample / 10;
if (tablesToAnalyze != null) {
for (Table table : tablesToAnalyze) { for (Table table : tablesToAnalyze) {
Analyze.analyzeTable(this, table, rowCount, false); Analyze.analyzeTable(this, table, rowCount, false);
} }
// analyze can lock the meta // analyze can lock the meta
database.unlockMeta(this); database.unlockMeta(this);
}
tablesToAnalyze = null; tablesToAnalyze = null;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论