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

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

[CASSANDRA-20074-4.1|https://github.com/instaclustr/cassandra/tree/CASSANDRA-20074-4.1]
{noformat}
java11_pre-commit_tests                         
  ✓ j11_build                                        1m 39s
  ✓ j11_cqlsh_dtests_py3                             5m 37s
  ✓ j11_cqlsh_dtests_py311                           5m 47s
  ✓ j11_cqlsh_dtests_py311_vnode                     5m 56s
  ✓ j11_cqlsh_dtests_py38                            5m 25s
  ✓ j11_cqlsh_dtests_py38_vnode                      7m 19s
  ✓ j11_cqlsh_dtests_py3_vnode                       5m 55s
  ✓ j11_cqlshlib_cython_tests                        7m 10s
  ✓ j11_cqlshlib_tests                               6m 23s
  ✓ j11_dtests                                      33m 49s
  ✓ j11_dtests_vnode                                36m 20s
  ✓ j11_jvm_dtests                                  16m 23s
  ✓ j11_jvm_dtests_vnode                            16m 17s
  ✓ j11_unit_tests                                   10m 4s                     
      
{noformat}

[java11_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/4990/workflows/969b704f-daad-4e93-8a0c-88f8a2d6c27d]



> 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: 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