Ariel Weisberg created CASSANDRA-20692:
------------------------------------------

             Summary: Direct IO commit log does not flush data safely
                 Key: CASSANDRA-20692
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20692
             Project: Apache Cassandra
          Issue Type: Bug
          Components: Local/Commit Log
            Reporter: Ariel Weisberg


[~maxwellguo] spotted this a few days ago.

The commit log is not safe as currently written with Direct IO. It writes to 
the file, but doesn't sync the metadata on flush. That means the commit log may 
claim it has flushed (and made durable) the data, but the filesystem journal 
has not been flushed so the file length could be wrong and could truncate the 
file on restart.

Additionally Direct IO doesn't actually make data durable on disk (emit write 
barriers) it just flushes it to the cache of the disk. If the disk cache is 
volatile then it can lose metadata and data.

It can probably be fixed pretty trivially by opening the file with {{D_SYNC}} 
because the commit log writes up to the entire segment when it flushes so there 
is no issue with needing to add buffering to avoid too many small writes.

[~amit_pawar] [~jlewandowski] [~blambov] 



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

Reply via email to