提交 b6d1ab13 authored 作者: andrei's avatar andrei

fix endless loop. Map's version now is the version at which map was last…

fix endless loop. Map's version now is the version at which map was last modified. Previously it just followed stroe's version, which is kind of useless.
上级 ea710513
......@@ -1054,6 +1054,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
return m;
}
/**
* Get version of the map, which is the version of the store,
* at which map was modified last time.
*
* @return version
*/
public final long getVersion() {
RootReference rootReference = getRoot();
RootReference previous = rootReference.previous;
......
......@@ -672,7 +672,7 @@ public class TestConcurrent extends TestMVStore {
try {
for (int k = 0; k < 10000; k++) {
Iterator<Integer> it = map.keyIterator(r.nextInt(len));
long old = s.getCurrentVersion();
long old = map.getVersion();
s.commit();
while (map.getVersion() == old) {
Thread.yield();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论