提交 d7d8a62b authored 作者: Noel Grandin's avatar Noel Grandin

vmlens: fix race conditions on nextAnalyze and changesSinceAnalyze

上级 d9ffc0b2
...@@ -727,13 +727,15 @@ public class MVTable extends TableBase { ...@@ -727,13 +727,15 @@ public class MVTable extends TableBase {
} }
private void analyzeIfRequired(Session session) { private void analyzeIfRequired(Session session) {
if (nextAnalyze == 0 || nextAnalyze > changesSinceAnalyze++) { synchronized (this) {
return; if (nextAnalyze == 0 || nextAnalyze > changesSinceAnalyze++) {
} return;
changesSinceAnalyze = 0; }
int n = 2 * nextAnalyze; changesSinceAnalyze = 0;
if (n > 0) { int n = 2 * nextAnalyze;
nextAnalyze = n; if (n > 0) {
nextAnalyze = n;
}
} }
session.markTableForAnalyze(this); session.markTableForAnalyze(this);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论