calebxyz opened a new pull request, #1277:
URL: https://github.com/apache/cassandra-python-driver/pull/1277

   This PR fixes UNPREPARED handling in the Python driver execution path for 
prepared statements.
       
         ### Problem
       
   When the server returned UNPREPARED (PreparedQueryNotFound) during an 
EXECUTE, the driver could fail to recover in some valid cases (cache miss, 
race, coordinator restart, id mismatch edge cases), even when the in-flight 
request still had enough PreparedStatement context to recover.
       
         ### Expected behavior
       
   If the driver still has the original PreparedStatement context, it should:
         1. issue PREPARE,
         2. then retry the original EXECUTE,
            regardless of why the coordinator no longer recognizes the prepared 
id.
       
         ### What this PR changes
       
    In ResponseFuture PreparedQueryNotFound handling:
       
         1. Cache the in-flight self.prepared_statement first (when present).
         2. Attempt lookup by the returned UNPREPARED id from 
cluster._prepared_statements.
         3. Reprepare using the resolved statement.
         4. If returned-id lookup fails:
             - fallback to in-flight context if available,
             - otherwise fail as unknown prepared statement.
       
         This preserves correctness while improving recovery in real-world 
coordinator invalidation/race/restart scenarios.
       
         ### Tests
       
   Added/updated unit coverage in tests/unit/test_response_future.py:
       
         - validates reprepare path for PreparedQueryNotFound,
         - validates fallback to in-flight context,
         - validates preference for statement resolved by returned UNPREPARED 
id when available.
       
   Fixes: https://github.com/scylladb/scylladb/issues/27657
   


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