[ 
https://issues.apache.org/jira/browse/CASSANDRA-20074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17897842#comment-17897842
 ] 

Stefan Miklosovic commented on CASSANDRA-20074:
-----------------------------------------------

[CASSANDRA-20074-4.0|https://github.com/instaclustr/cassandra/tree/CASSANDRA-20074-4.0]
{noformat}
java11_pre-commit_tests                         
  ✓ j11_build                                        1m 57s
  ✓ j11_cqlsh-dtests-py2-no-vnodes                   5m 59s
  ✓ j11_cqlsh-dtests-py2-with-vnodes                 5m 53s
  ✓ j11_cqlsh_dtests_py3                             5m 44s
  ✓ j11_cqlsh_dtests_py311                           5m 41s
  ✓ j11_cqlsh_dtests_py311_vnode                     5m 37s
  ✓ j11_cqlsh_dtests_py38                            5m 52s
  ✓ j11_cqlsh_dtests_py38_vnode                      5m 55s
  ✓ j11_cqlsh_dtests_py3_vnode                       5m 25s
  ✓ j11_cqlshlib_tests                               8m 32s
  ✓ j11_dtests                                      32m 10s
  ✓ j11_dtests_vnode                                36m 13s
  ✓ j11_jvm_dtests                                  13m 45s
  ✓ j11_unit_tests                                   8m 30s
java11_separate_tests                            
java8_pre-commit_tests                          
java8_separate_tests                             
{noformat}

[java11_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4987/workflows/f172e3a2-5f67-4104-8887-6ed5f5006381]
[java11_separate_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4987/workflows/104ff2b7-c7f1-4a22-af6a-1e8c55c10dba]
[java8_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4987/workflows/2ea311cc-69eb-4bbf-bddf-ae1f619a9284]
[java8_separate_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4987/workflows/f15e5a08-79a8-446f-986c-1c4612f80a35]


> 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
>            Priority: Low
>             Fix For: 4.0.x, 4.1.x, 5.0.x, 5.x
>
>          Time Spent: 10m
>  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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to