|
I wrote a concurrency test where multiple clients try to build the same unique index, all of which should fail due to documents with a duplicate key.
Occasionally (once every 5 minutes), the test will return OK:
Foreground jstests/concurrency/fsm_workloads/unique_index_duplicate_key.js
|
Error: command worked when it should have failed: {
|
"numIndexesBefore" : 2,
|
"numIndexesAfter" : 2,
|
"createdCollectionAutomatically" : false,
|
"commitQuorum" : "votingMembers",
|
"note" : "all indexes already exist",
|
"ok" : 1,
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1670274510, 21),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
},
|
"operationTime" : Timestamp(1670274510, 21)
|
}
|
We should only have one index (_id) in this workload, but it's reporting numIndexesBefore/numIndexesAfter as 2, which results in this returning OK. The index was not actually built as seen by validate:
[j0:prim] {"t":{"$date":"2022-12-05T21:47:05.459+00:00"},"s":"I", "c":"COMMAND", "id":20514, "ctx":"conn194","msg":"CMD: validate","attr":{"namespace":"test0_fsmdb0.fsmcoll0","background":false,"full":true,"enforceFastCount":true,"checkBSONConformance":false,"repair":false}}
|
[j0:prim] {"t":{"$date":"2022-12-05T21:47:05.460+00:00"},"s":"I", "c":"INDEX", "id":20295, "ctx":"conn194","msg":"Validating internal structure","attr":{"index":"_id_","namespace":"test0_fsmdb0.fsmcoll0"}}
|
[j0:prim] {"t":{"$date":"2022-12-05T21:47:05.465+00:00"},"s":"I", "c":"INDEX", "id":20303, "ctx":"conn194","msg":"validating collection","attr":{"namespace":"test0_fsmdb0.fsmcoll0","uuid":{"uuid":{"$uuid":"b868fd78-5ddb-4db2-aaf2-511b3325e25e"}}}}
|
[j0:prim] {"t":{"$date":"2022-12-05T21:47:05.468+00:00"},"s":"I", "c":"INDEX", "id":20296, "ctx":"conn194","msg":"Validating index consistency","attr":{"index":"_id_","namespace":"test0_fsmdb0.fsmcoll0"}}
|
[j0:prim] {"t":{"$date":"2022-12-05T21:47:05.469+00:00"},"s":"I", "c":"INDEX", "id":20306, "ctx":"conn194","msg":"Validation complete for collection. No corruption found","attr":{"namespace":"test0_fsmdb0.fsmcoll0","uuid":{"uuid":{"$uuid":"b868fd78-5ddb-4db2-aaf2-511b3325e25e"}}}}
|
|