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

vmlens: fix race condition on Database.modificationMetaId

上级 93b907e8
......@@ -138,7 +138,7 @@ public class Database implements DataHandler {
private final int fileLockMethod;
private Role publicRole;
private final AtomicLong modificationDataId = new AtomicLong();
private long modificationMetaId;
private final AtomicLong modificationMetaId = new AtomicLong();
private CompareMode compareMode;
private String cluster = Constants.CLUSTERING_DISABLED;
private boolean readOnly;
......@@ -472,14 +472,14 @@ public class Database implements DataHandler {
}
public long getModificationMetaId() {
return modificationMetaId;
return modificationMetaId.get();
}
public long getNextModificationMetaId() {
// if the meta data has been modified, the data is modified as well
// (because MetaTable returns modificationDataId)
modificationDataId.incrementAndGet();
return modificationMetaId++;
return modificationMetaId.incrementAndGet() - 1;
}
public int getPowerOffCount() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论