mikebridge commented on code in PR #45033:
URL: https://github.com/apache/superset/pull/45033#discussion_r4214935305


##########
superset/versioning/unit_of_work.py:
##########
@@ -41,14 +61,61 @@ def process_before_flush(self, session: Session) -> None:
         """Decide before Continuum creates its transaction or version 
session."""
         if session is self.version_session or not 
self._capture_enabled(session):
             return
+        if self.version_session is None and self.is_modified(session):
+            self._ensure_version_session(session)
         super().process_before_flush(session)
 
+    def _ensure_version_session(self, session: Session) -> None:
+        """Join caller-owned work and reattach surviving cached versions."""
+        if self.version_session is None:
+            # The application session owns savepoints. Continuum's default
+            # conditional_savepoint creates an extra savepoint that outlives
+            # its parent when the application rolls that parent back.
+            # rollback_only prevents auxiliary commit/close from ending caller
+            # work; an auxiliary rollback still rolls back the caller boundary,
+            # consistent with the application flush failing as well.
+            self.version_session = Session(
+                bind=session.connection(), 
join_transaction_mode="rollback_only"

Review Comment:
   Thanks for calling out the rollback boundary. With the auxiliary session 
joined inside the application savepoint, a focused SQLAlchemy probe leaves 
outer work intact at head (`unit_of_work.py:78`); joining it before the 
savepoint can roll back outer work, but that also happens with the merge-base's 
Continuum session (`unit_of_work.py:40-44`). A regression test pinning both 
join timings can follow separately.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to