[JAVA-2964] Logging retried operations Created: 07/Sep/18  Updated: 28/Oct/23  Resolved: 28/Jan/19

Status: Closed
Project: Java Driver
Component/s: Monitoring
Affects Version/s: None
Fix Version/s: 3.10.0

Type: New Feature Priority: Minor - P4
Reporter: James Phelan (Inactive) Assignee: John Stewart (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Case:

 Description   

In some situations it users may need to know what write operations were submitted again as part of retryable writes.

This feature request is to enable logging at the INFO level to show what operations have been retried. This would mean displaying the write operation and indicating that it is being retried. for example.

Sep 05, 2018 4:31:09 PM retrying the following op ["ns": "test.tes" , command:{insert{a:1}}]

The exact format is not important the request is to log what write operations were retried.



 Comments   
Comment by Githook User [ 02/Feb/19 ]

Author:

{'name': 'John Stewart', 'email': 'john.stewart@mongodb.com', 'username': 'jstewart-mongo'}

Message: Log retryable writes at DEBUG level

JAVA-2964
Branch: 3.10.x
https://github.com/mongodb/mongo-java-driver/commit/b10f9f5bf6f8c31db410521b43f1ec31c5d3987d

Comment by Githook User [ 28/Jan/19 ]

Author:

{'username': 'jstewart-mongo', 'email': 'john.stewart@mongodb.com', 'name': 'John Stewart'}

Message: Log retryable writes at DEBUG level

JAVA-2964
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2667027b197654bf7e955811a910fd9cf86106e2

Comment by John Stewart (Inactive) [ 25/Jan/19 ]

An example of a retry log entry:
20:35:54.544 [Thread-6] DEBUG org.mongodb.driver.operation - Retrying command INSERT due to an error "com.mongodb.MongoNotPrimaryException: Command failed with error 10107 (NotMaster): 'Failing command due to 'failCommand' failpoint' on server localhost:27017. The full response is {"operationTime": {"$timestamp": {"t": 1548380154, "i": 3, "ok": 0.0, "errmsg": "Failing command due to 'failCommand' failpoint", "code": 10107, "codeName": "NotMaster", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1548380154, "i": 3}}, "signature": {"hash":

{"$binary": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type": "00"}

, "keyId": {"$numberLong": "0"}}}}"}}

Comment by John Stewart (Inactive) [ 24/Jan/19 ]

We will be able to log the retry operation at the DEBUG level with the following format:

Retrying command <command> due to error <error message>

Generated at Thu Feb 08 08:58:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.