If i understand correctly the sequencing needs to be: TransactionStart -> RepackStart -> RepackEnd (-> TransactionRead) -> TransactionEnd
Sounds like it only becomes an issue when the transaction runs longer than the repack in which case either the transaction takes too long or your REPACK is very fast (which i assume implies small tables or little need for work to be done).
From the top of my head the only scenario where this becomes a concern is if you have something long running like a nightly report and someone decides to schedule a REPACK during the night.
Otherwise i'd say optimize your transactions and make sure you only run REPACK when necessary.
That's my reading too - it's up to you to make sure no long-running transactions might use a stale snapshot. Most transactions are probably both short, and use the default read committed isolation level which takes a fresh snapshot for each statement, so the set of scenarios where it's likely to be a problem seems fairly limited.
If you want to be completely certain, enforce a bit of downtime prior to running the REPACK - once the server is quiesced, you can kick it off, and then allow traffic again. Still a win over needing downtime for the entire duration of the operation.
View all comments
Show parent comment
48
u/IamPic 10d ago
Does it even make sense to use it then? It's hard to imagine what sort of weird bugs you can run into with such behavior.