[ https://issues.apache.org/jira/browse/CASSANDRA-20074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17898208#comment-17898208 ]
Stefan Miklosovic commented on CASSANDRA-20074: ----------------------------------------------- [CASSANDRA-20074-5.0|https://github.com/instaclustr/cassandra/tree/CASSANDRA-20074-5.0] {noformat} java17_pre-commit_tests ✓ j17_build 4m 23s ✓ j17_cqlsh_dtests_py311 6m 0s ✓ j17_cqlsh_dtests_py311_vnode 6m 33s ✓ j17_cqlsh_dtests_py38 5m 58s ✓ j17_cqlsh_dtests_py38_vnode 6m 42s ✓ j17_cqlshlib_cython_tests 7m 45s ✓ j17_cqlshlib_tests 7m 0s ✓ j17_dtests 31m 30s ✓ j17_dtests_vnode 34m 43s ✓ j17_jvm_dtests 23m 5s ✓ j17_jvm_dtests_latest_vnode 17m 54s ✓ j17_unit_tests 16m 43s ✓ j17_utests_latest 22m 41s ✓ j17_utests_oa 15m 38s ✕ j17_dtests_latest 32m 9s bootstrap_test.TestBootstrap test_killed_wiped_node_cannot_join {noformat} [java17_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4997/workflows/dd937a8d-e813-49c4-84bc-3a12ff18f8df] > AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() > but later compared and updated with System.nanoTime() > --------------------------------------------------------------------------------------------------------------------------------- > > Key: CASSANDRA-20074 > URL: https://issues.apache.org/jira/browse/CASSANDRA-20074 > Project: Cassandra > Issue Type: Bug > Components: Local/Commit Log > Reporter: Dmitry Konstantinov > Assignee: Dmitry Konstantinov > Priority: Low > Fix For: 4.0.x, 4.1.x, 5.0.x, 5.x > > Time Spent: 0.5h > Remaining Estimate: 0h > > Within org.apache.cassandra.db.commitlog.AbstractCommitLogService > we use System.currentMillis()-based time to initialize lastSyncedAt field: > {code:java} > protected volatile long lastSyncedAt = currentTimeMillis();{code} > but later we use clock.now() = System.nanoTime() to compare and update the > field value: > {code:java} > long pollStarted = clock.now(); > boolean flushToDisk = lastSyncedAt + syncIntervalNanos <= pollStarted || > state != NORMAL || syncRequested; {code} > As of now we are lucky that in the current JDK implementations > System.nanoTime() is much bigger than currentTimeMillis() but it is not > guaranteed by a specification of the API. If nanoTime() < > currentTimeMillis() then we can stuck without sync of commit log to disk. > So, we need to align the time sources and change the init logic to: > {code:java} > protected volatile long lastSyncedAt = preciseTime.now();{code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org