Fix a problem with static segments being opened with an empty offset after switch unless active segments offset file was closed

Patch by Alex Petrov; reviewed by Aleksey Yeschenko for CASSANDRA-19867
This commit is contained in:
Alex Petrov 2024-08-26 20:24:41 +02:00 committed by David Capwell
parent f1db115e73
commit 00ebcdc9f2
2 changed files with 2 additions and 0 deletions

View File

@ -183,6 +183,7 @@ final class ActiveSegment<K, V> extends Segment<K, V>
{
index.persist(descriptor);
metadata.persist(descriptor);
syncedOffsets.fsync();
SyncUtil.trySyncDir(descriptor.directory);
}

View File

@ -135,6 +135,7 @@ interface SyncedOffsets extends Closeable
{
output.writeInt(offset);
output.writeInt((int) crc.getValue());
output.flush();
}
catch (IOException e)
{