File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/tgdb/entities/horizon Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,9 @@ def _limit_transaction_age(self) -> None:
215215 if oldest_transaction .age (self ._time ) <= self ._max_transaction_age :
216216 break
217217
218+ if not self ._is_transaction_autorollbackable (oldest_transaction ):
219+ continue
220+
218221 oldest_transaction .rollback ()
219222 del self ._transaction_map (oldest_transaction )[
220223 oldest_transaction .xid ()
@@ -227,11 +230,22 @@ def _limit_len(self) -> None:
227230 if oldest_transaction is None :
228231 return
229232
233+ if not self ._is_transaction_autorollbackable (oldest_transaction ):
234+ continue
235+
230236 oldest_transaction .rollback ()
231237 del self ._transaction_map (oldest_transaction )[
232238 oldest_transaction .xid ()
233239 ]
234240
241+ def _is_transaction_autorollbackable (
242+ self , transaction : Transaction
243+ ) -> bool :
244+ return (
245+ not isinstance (transaction , SerializableTransaction )
246+ or transaction .state is not SerializableTransactionState .prepared
247+ )
248+
235249 def _oldest_transaction (self ) -> Transaction | None :
236250 first_map_tranactions = (
237251 first_map_value (map ) for map in self ._transaction_maps ()
You can’t perform that action at this time.
0 commit comments