You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileStore with segment_count 1 loses every record written after its first compaction #17
Version: master at d5282e6; also 0.1.7, and master before #6. Platform: all (host reproduction, RAM filesystem from test_file_store).
What happens. Compaction writes the live records into seg0, and both rotate_segment_if_needed() and compact_if_threshold() then set current_segment = 1 for new writes. With segment_count == 1, seg1 is outside the configured range. Every later write goes there, and the file grows without bound, because rotation now compacts only seg0, which is empty. rebuild_index_from_segments() and compaction scan only [0, segment_count), so after a reload those records are gone.
How to reproduce:init(fs, "/p", false, 256, 1), then overwrite ten keys six times (60 puts of ~20 bytes), then reopen. Expected: 10 records with their last values. Actual: 1 record; seg0 is 0 bytes and seg1 is 2420 bytes. The same workload with segment_count == 2 is correct.
Impact: low. The default is 8 segments and microReticulum's documented minimum is 3, but nothing rejects 1, and the failure is silent data loss.
Activity