safaehar commented on code in PR #74113:
URL: https://github.com/apache/airflow/pull/74113#discussion_r4401033909


##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -507,6 +507,21 @@ def _do_delete(
         else:
             print("Performing Delete...")
 
+        if skip_archive:
+            try:
+                _delete_directly(
+                    limited_query=limited_query,
+                    source_table_name=source_table_name,
+                    session=session,
+                    dialect_name=dialect_name,
+                )
+                session.commit()
+            except BaseException:
+                with suppress(Exception):
+                    session.rollback()
+                raise
+            continue

Review Comment:
   the continue is intentional here. The direct DELETE embeds limited_query, 
including its skip_if_referenced guard, so the condition is reevaluated within 
the DELETE itself. Unlike the archive path, there is no separately copied row 
that can remain both archived and live. Adding a count would introduce another 
query per batch and a new count/delete race. The regression test covers both 
whole and partial direct skips. I’ll add a comment to make this distinction 
clearer.



-- 
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]

Reply via email to