I have a counter to update every add and remove . This counter is in memory for evoiding overhead in writes . A periodic thread save the values in db . The problem is if there is crash before last update is done . For solving it i might set the limit for compactation .
Pseudo code
Update counter and snapshot sequence values in a kv cell.
Update the tail limit for compactation(go forward )
If there is a crash the last part of log file is not re compacted . On bots trap It is possible to scan db from last sequence assoacied to counter(surely there are few rows )i can reads add and remove commands and I can restore very Fastly the correct status of counter without scanning entire db
I think I understand. You want to be able to replay changes made in last N versions.
It is already possible to keep last N versions in journal (keepVersions parameter).
I have a counter to update every add and remove . This counter is in memory for evoiding overhead in writes . A periodic thread save the values in db . The problem is if there is crash before last update is done . For solving it i might set the limit for compactation . Pseudo code Update counter and snapshot sequence values in a kv cell. Update the tail limit for compactation(go forward )
If there is a crash the last part of log file is not re compacted . On bots trap It is possible to scan db from last sequence assoacied to counter(surely there are few rows )i can reads add and remove commands and I can restore very Fastly the correct status of counter without scanning entire db