You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Caleb Rackliffe (Jira)" <ji...@apache.org> on 2026/08/06 19:16:00 UTC

[jira] [Commented] (CASSANDRA-21290) Implement atomic heartbeat file write

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

Caleb Rackliffe commented on CASSANDRA-21290:
---------------------------------------------

[~snowsheepboard] In {{JsonUtils#serializeToJsonFileAtomic()}}, it looks like we're using a {{FileOutputStreamPlus}} which is a {{BufferedDataOutputStreamPlus}}. When we call {{out.sync();}}, that just calls {{force()}} on the channel, but that doesn't guarantee that we've flushed the buffer right? Should we just throw an {{out.flush();}} before the sync call? It looks like there are other places where we follow this pattern, like {{TOCComponent}} and {{AutoSavingCache}}.

> Implement atomic heartbeat file write
> -------------------------------------
>
>                 Key: CASSANDRA-21290
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21290
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Legacy/Core
>            Reporter: John Lu
>            Assignee: John Lu
>            Priority: Normal
>             Fix For: 4.1.12, 5.0.8, 6.0, 6.0-alpha2
>
>
> It is possible for an empty heartbeat file to be written, potentially due to crash between file creation and the actual write. We can instead write to a temporary heartbeat file and then do an atomic move to rename it to the actual heartbeat file.
>  
> Also fall back to the last modified time of the heartbeat file in case the file is not able to be parsed (it wont be able to be parsed if its empty)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org