waterWang opened a new pull request, #42920:
URL: https://github.com/apache/superset/pull/42920
## Description
Closes #42912.
`import_tag` catches `SQLAlchemyError` after a query-triggered autoflush
failure (e.g. a concurrent unique-constraint violation) and continues
using the same SQLAlchemy Session without rolling back or isolating the
failed operation. The Session enters a pending-rollback state, and the
next operation raises `PendingRollbackError`.
### Fix
Wrap each per-tag operation in a `db_session.begin_nested()` SAVEPOINT.
When a conflict occurs:
- The SAVEPOINT is rolled back — only the failed tag's partial work is
discarded
- The outer session remains usable for subsequent tags
- Other tags in the same import continue to succeed
### Test
Added `test_import_tag_savepoint_keeps_session_usable` which simulates a
unique-constraint violation on the first tag and verifies that:
- The second tag is still imported successfully
- The session is not left in a pending-rollback state
--
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]