-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
ClientBulkWriteException.has_error_label should behave correctly. Currently our code which checks for error labels has to handle ClientBulkWriteException specially and inspect the "error" property.
if isinstance(exc, ClientBulkWriteException) and exc.error:
retryable_write_error_exc = isinstance(
exc.error, PyMongoError
) and exc.error.has_error_label("RetryableWriteError")
else:
retryable_write_error_exc = exc.has_error_label("RetryableWriteError")
This is a problem because ClientBulkWriteException violates the Liskov substitution principle. I suspect the NoWritesPerformed check doesn't work as intended because of this issue:
if not retryable_write_error_exc or self._is_not_eligible_for_retry():
if exc.has_error_label("NoWritesPerformed") and self._last_error:
raise self._last_error from exc
else:
raise
Noticed while working on PYTHON-5505.
- related to
-
PYTHON-5505 Prototype system overload retry loop for all operations
-
- Closed
-