Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,12 @@ export class MongoStalePrimaryError extends MongoRuntimeError {
serverDescription: ServerDescription,
maxSetVersion: number | null,
maxElectionId: ObjectId | null,
message?: string,
options?: { cause?: Error }
) {
super(
`primary marked stale due to electionId/setVersion mismatch: server setVersion: ${serverDescription.setVersion}, server electionId: ${serverDescription.electionId}, topology setVersion: ${maxSetVersion}, topology electionId: ${maxElectionId}`,
message ??
`primary marked stale due to electionId/setVersion mismatch: server setVersion: ${serverDescription.setVersion}, server electionId: ${serverDescription.electionId}, topology setVersion: ${maxSetVersion}, topology electionId: ${maxElectionId}`,
options
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/sdam/topology_description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,12 @@ function updateRsFromPrimary(
serverDescriptions.set(
address,
new ServerDescription(server.address, undefined, {
error: new MongoStalePrimaryError(serverDescription, maxSetVersion, maxElectionId)
error: new MongoStalePrimaryError(
serverDescription,
maxSetVersion,
maxElectionId,
'primary marked stale due to discovery of newer primary'
)
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"servers": {
"a:27017": {
"type": "Unknown",
"setName": null
"setName": null,
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ phases: [
"a:27017": {

type: "Unknown",
setName:
setName:,
error: "primary marked stale due to discovery of newer primary"
},

"b:27017": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ phases: [
type: "Unknown",
setName: ,
electionId: ,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down Expand Up @@ -125,6 +125,7 @@
"a:27017": {
"type": "Unknown",
"setName": null,
"error": "primary marked stale due to electionId/setVersion mismatch",
"electionId": null
},
"b:27017": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down Expand Up @@ -100,6 +100,7 @@ phases: [
"a:27017": {
type: "Unknown",
setName: ,
error: "primary marked stale due to electionId/setVersion mismatch",
electionId:
},
"b:27017": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down Expand Up @@ -125,6 +125,7 @@
"a:27017": {
"type": "Unknown",
"setName": null,
"error": "primary marked stale due to electionId/setVersion mismatch",
"electionId": null
},
"b:27017": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down Expand Up @@ -100,6 +100,7 @@ phases: [
"a:27017": {
type: "Unknown",
setName: ,
error: "primary marked stale due to electionId/setVersion mismatch",
electionId:
},
"b:27017": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"type": "Unknown",
"setName": null,
"electionId": null,
"error": "primary marked stale due to electionId/setVersion mismatch"
"error": "primary marked stale due to discovery of newer primary"
},
"b:27017": {
"type": "RSPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ phases: [
type: "Unknown",
setName: ,
electionId:,
error: "primary marked stale due to electionId/setVersion mismatch"
error: "primary marked stale due to discovery of newer primary"
},
"b:27017": {
type: "RSPrimary",
Expand Down