bito-code-review[bot] commented on PR #44686:
URL: https://github.com/apache/superset/pull/44686#issuecomment-5843940758

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation in 
`superset/db_engine_specs/__init__.py` performs cleanup *after* the loop 
finishes, which leaves a window where concurrent threads could observe the 
mutated global `IdentifierPreparer.reserved_words` set.
   
   To resolve this, you should move the cleanup logic inside the 
`try...finally` block or ensure the state is restored immediately after each 
iteration. However, the current PR already implements a snapshot/restore 
mechanism. To address the race condition specifically, you should ensure the 
restoration happens within the same iteration scope, or use a thread-safe 
approach if concurrency is a concern.
   
   Would you like me to fetch all other comments on this PR to validate them 
and implement a minimal fix for the rest?
   
   **superset/db_engine_specs/__init__.py**
   ```
   if preparer_cls.reserved_words is not reserved_words:
                   preparer_cls.reserved_words = reserved_words
               if reserved_words != reserved_words_snapshot:
                   reserved_words.clear()
                   reserved_words.update(reserved_words_snapshot)
   ```


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