提交 0b78ad21 authored 作者: Sergi Vladykin's avatar Sergi Vladykin

TestQueryCache

上级 5b81d2b9
...@@ -50,6 +50,8 @@ public class TestQueryCache extends TestBase { ...@@ -50,6 +50,8 @@ public class TestQueryCache extends TestBase {
} }
String query = queryBuilder.toString(); String query = queryBuilder.toString();
conn.prepareStatement(query); conn.prepareStatement(query);
int firstGreater = 0;
int firstSmaller = 0;
long time; long time;
ResultSet rs; ResultSet rs;
long first = 0; long first = 0;
...@@ -77,9 +79,17 @@ public class TestQueryCache extends TestBase { ...@@ -77,9 +79,17 @@ public class TestQueryCache extends TestBase {
// try to avoid pauses in subsequent iterations // try to avoid pauses in subsequent iterations
System.gc(); System.gc();
} else if (i > 1001) { } else if (i > 1001) {
assertSmaller(time, first); if (first > time) {
firstGreater++;
} else {
firstSmaller++;
} }
} }
}
// first prepare time must be always greater because of query cache,
// but JVM is too unpredictable to assert that, so just check that
// usually this is true
assertSmaller(firstSmaller, firstGreater);
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论