Operational Defect Database

BugZero found this defect 286 days ago.

MongoDB | 2410674

Ordered timeseries inserts may return wrong 'n' value when a statement fails

Last update date:

3/12/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

8.0.0-rc0

Description:

Info

I think this is because performOrderedTimeseriesWrites always returns the document size even when errors may present.

Top User Comments

xgen-internal-githook commented on Tue, 30 Jan 2024 22:17:33 +0000: Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'} Message: SERVER-79787 Set the number of inserted documents correctly when write errors occur during time-series ordered inserts (#18506) GitOrigin-RevId: 78f569b565d59144da819937a2fc7a53dffdf69a Branch: master https://github.com/mongodb/mongo/commit/a40bb6d649cca4b43f25ab13887658e3484ef733

Steps to Reproduce

foo:PRIMARY> db.createCollection("coll", {timeseries: {timeField: 'time'}}) { "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1691419064, 2), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1691419064, 2) } foo:PRIMARY> db.runCommand({insert: "coll", documents: [{x: 0, time: ISODate()}, {x: 1}], ordered: true}) { "n" : 2, "electionId" : ObjectId("7fffffff0000000000000004"), "opTime" : { "ts" : Timestamp(1691419106, 1), "t" : NumberLong(4) }, "writeErrors" : [ { "index" : 1, "code" : 2, "errmsg" : "'time' must be present and contain a valid BSON UTC datetime value" } ], "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1691419106, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1691419106, 1) } foo:PRIMARY> db.runCommand({insert: "coll", documents: [{x: 0, time: ISODate()}, {x: 1}], ordered: false}) { "n" : 1, "electionId" : ObjectId("7fffffff0000000000000004"), "opTime" : { "ts" : Timestamp(1691419125, 1), "t" : NumberLong(4) }, "writeErrors" : [ { "index" : 1, "code" : 2, "errmsg" : "'time' must be present and contain a valid BSON UTC datetime value" } ], "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1691419125, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1691419125, 1) }

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Closed

Learn More

Search:

...