cassandra IndexSummaryManagerTest单元测试用例超时错误

cassandra IndexSummaryManagerTest unit test case timeout error

我在编译cassandra 单元测试用例时出错。其中一项测试有时会超时。虽然 https://issues.apache.org/jira/browse/CASSANDRA-8981 声明此问题已在版本 2.1.5 中得到解决,但我仍然遇到此问题。使用 jdk1.8 从源代码构建 cassandra 2.1.5。详情如下:

[junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryManagerTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
[junit] 
[junit] Testcase: org.apache.cassandra.io.sstable.IndexSummaryManagerTest:testCompactionRace:   Caused an ERROR
[junit] Timeout occurred. Please note the time in the report does not reflect the time until the timeout.
[junit] junit.framework.AssertionFailedError: Timeout occurred. Please note the time in the report does not reflect the time until the timeout.
[junit]     at java.lang.Thread.run(Thread.java:745)
[junit] 
[junit] 
[junit] Test org.apache.cassandra.io.sstable.IndexSummaryManagerTest FAILED (timeout)
[junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryTest
[junit] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.193 sec

参与 Cassandra 测试讨论的最佳地点可能是 irc.freenode.net [0] 上的 IRC 频道 #cassandra-dev - Cassandra 开发人员和测试工程师都在那里闲逛并讨论这类事情每天 :) 我只是碰巧偶尔浏览这里的 Cassandra 标签,并抓住了你最近的几道测试题。

关于您的特定测试错误,我快速查看了最近的 CI 历史记录 [1],没有看到任何最近的超时 - 这并不意味着测试无法通过你的帮助,如果你发现了问题。

我不确定您测试的系统类型为何,但也许 I/O 很慢,这可能会使测试花费的时间超过默认的 60 秒测试超时。首先将 build.xml 中的超时设置得更高,看看测试是否至少最终通过了 - 让我们加倍:

(cassandra-2.1 *)mshuler@hana:~/git/cassandra$ git diff
diff --git a/build.xml b/build.xml
index e197696..2d5e20a 100644
--- a/build.xml
+++ b/build.xml
@@ -91,7 +91,7 @@
     <property name="maven-repository-url" value="https://repository.apache.org/content/repositories/snapshots"/>
     <property name="maven-repository-id" value="apache.snapshots.https"/>

-    <property name="test.timeout" value="60000" />
+    <property name="test.timeout" value="120000" />
     <property name="test.long.timeout" value="600000" />

     <!-- default for cql tests. Can be override by -Dcassandra.test.use_prepared=false -->

再次构建并测试(截断输出):

(cassandra-2.1 *)mshuler@hana:~/cassandra$ ant clean jar
<...>
(cassandra-2.1 *)mshuler@hana:~/cassandra$ ant test -Dtest.name=IndexSummaryManagerTest
<...>
testlist:
     [echo] running test bucket 0 tests
    [mkdir] Created dir: /home/mshuler/cassandra/build/test/cassandra
    [mkdir] Created dir: /home/mshuler/cassandra/build/test/output
    [junit] WARNING: multiple versions of ant detected in path for junit 
    [junit]          jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
    [junit]      and jar:file:/home/mshuler/cassandra/build/lib/jars/ant-1.6.5.jar!/org/apache/tools/ant/Project.class
    [junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryManagerTest
    [junit] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.737 sec
    [junit] 

BUILD SUCCESSFUL
Total time: 18 seconds

如果仍有问题,请查看测试 system.log 文件,看看是否可以找出问题所在。您会在 build/test/logs/system.log.

找到该日志文件

如果你能确定问题并能提供重现步骤,请打开 JIRA 票证...事实上,看起来我在 test-all ant 目标期间为此测试超时重新打开了一个不同的 JIRA: https://issues.apache.org/jira/browse/CASSANDRA-9271

我将继续 post 这个答案,因为以上至少是您测试工具箱中应该拥有的几个工具。不过,请随时在 IRC 上聊天!

[0] http://freenode.net/

[1] http://cassci.datastax.com/job/cassandra-2.1_utest/lastCompletedBuild/testReport/org.apache.cassandra.io.sstable/IndexSummaryManagerTest/history/