nebari icon indicating copy to clipboard operation
nebari copied to clipboard

Add "Session ID" to transaction log entries

Open ecton opened this issue 2 years ago • 0 comments

While fixing some edge cases in 9e799b9fe3e1b5378c88d73bd51ca80861279454, I thought of another edge case. I believe it's one that we should care about: Imagine if you roll a transaction back, the trees might have some data referencing the rolled back transaction. Next, close the database, and reopen the database. Push a transaction using different trees, and then open the other tree. Because the unused transaction id wasn't persisted to disk, the new transaction is assigned the same id as the abandoned transaction.

One fix would be to write all transactions to the log, but that seems wasteful. Another approach would be to add another piece of data that is incremented once per log-file open which is checked alongside the transaction id to ensure that the transaction ID came from the same session that successfully wrote it.

This would avoid writing data for all dropped transactions, but it might require updating the root headers depending on how its implemented.

ecton avatar Mar 01 '22 16:03 ecton