[GODRIVER-2941] Should we account for driver.WriteCommandError in mongo.replaceErrors ? Created: 10/Aug/23  Updated: 05/Dec/23

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Unknown
Reporter: Preston Vasquez Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to GODRIVER-2775 Remove the "replaceErrors" function Backlog
is related to GODRIVER-2929 Improve error messaging by wrapping e... Backlog

 Description   

It is possible to have a driver.WriteCommandError returned when running Database.CreateCollection , and perhaps other operations. For many write operations, we rely on the mongo package function "processWriteError" to convert the driver.WriteCommandError into a mongo.WriteException. Should we make this logic more general by integrating "processWriteError" into "replaceErrors"?



 Comments   
Comment by Felipe Gasper [ 05/Dec/23 ]

matt.dale@mongodb.com Is there a ticket to address this that we can watch?

Comment by Matt Dale [ 08/Sep/23 ]

craven.huynh@mongodb.com thank you for the example! Yes, it does seem like the error handling in processWriteError and replaceErrors should be merged.

Comment by Craven Huynh [ 07/Sep/23 ]

An instance of this error can be found in: https://parsley.mongodb.com/resmoke/be6936e5113117eb2d14d7baec5ad560/all?bookmarks=114483

The specific line is as follow:

[ReplicatorFixture:j2:replicator] 16:45:02.271Z 
{
    level: "fatal",
    serverID: "5fe999ad",
    mongosyncID: "coordinator",
    stack: [
        {
            func: "CreatePartitionColl",
            line: "223",
            source: "/data/mci/95c07554366f49fd4c3785dbbd0f9f36/src/github.com/10gen/mongosync/internal/mongosync/partitions/partitions.go"
        },
        {
            func: "(*Mongosync).CreatePartitionColl",
            line: "299",
            source: "/data/mci/95c07554366f49fd4c3785dbbd0f9f36/src/github.com/10gen/mongosync/internal/mongosync/mongosync.go"
        },
        {
            func: "(*Mongosync).Replicate",
            line: "76",
            source: "/data/mci/95c07554366f49fd4c3785dbbd0f9f36/src/github.com/10gen/mongosync/internal/mongosync/mongosync_replicate.go"
        },
        {
            func: "(*Mongosync).launchReplicationThread.func1",
            line: "877",
            source: "/data/mci/95c07554366f49fd4c3785dbbd0f9f36/src/github.com/10gen/mongosync/internal/mongosync/mongosync.go"
        },
        {
            func: "goexit",
            line: "1594",
            source: "/opt/golang/go1.19/src/runtime/asm_amd64.s"
        }
    ],
    error: "error creating partitions collection: write command error: [{write errors: []}, {(InterruptedDueToReplStateChange) operation was interrupted}]",
    time: "2023-08-09T16:45:02.269357928Z",
    message: "Error during replication"
} 

Mongosync was attempting to create a collection in MongoDB v7.0.

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