提交 264fd2f7 authored 作者: Andrei Tokar's avatar Andrei Tokar

Issue_1619: postpone table analysis until after transaction commit

上级 c3befc2c
......@@ -670,16 +670,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
public void commit(boolean ddl) {
checkCommitRollback();
int rowCount = getDatabase().getSettings().analyzeSample / 10;
if (tablesToAnalyze != null) {
for (Table table : tablesToAnalyze) {
Analyze.analyzeTable(this, table, rowCount, false);
}
// analyze can lock the meta
database.unlockMeta(this);
}
tablesToAnalyze = null;
currentTransactionName = null;
transactionStart = null;
if (transaction != null) {
......@@ -703,6 +693,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
// (create/drop table and so on)
database.commit(this);
}
analyzeTables();
removeTemporaryLobs(true);
if (undoLog != null && undoLog.size() > 0) {
undoLog.clear();
......@@ -720,6 +711,18 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
endTransaction();
}
private void analyzeTables() {
int rowCount = getDatabase().getSettings().analyzeSample / 10;
if (tablesToAnalyze != null) {
for (Table table : tablesToAnalyze) {
Analyze.analyzeTable(this, table, rowCount, false);
}
// analyze can lock the meta
database.unlockMeta(this);
}
tablesToAnalyze = null;
}
private void removeTemporaryLobs(boolean onTimeout) {
assert this != getDatabase().getLobSession() || Thread.holdsLock(this) || Thread.holdsLock(getDatabase());
if (temporaryLobs != null) {
......
......@@ -456,7 +456,7 @@ public class Transaction {
if (status != STATUS_OPEN) {
throw DataUtils.newIllegalStateException(
DataUtils.ERROR_TRANSACTION_ILLEGAL_STATE,
"Transaction {0} has status {1}, not open", transactionId, status);
"Transaction {0} has status {1}, not OPEN", transactionId, STATUS_NAMES[status]);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论