Skip to content
Snippets Groups Projects
Commit 261103ad authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Comment-out seconds attempt to ingest dataset in the first attempt failed...

Comment-out seconds attempt to ingest dataset in the first attempt failed because if the duplicate error.
parent ca6b785f
No related branches found
No related tags found
1 merge request!240Move DB requests to broker
Pipeline #120032 failed
......@@ -136,11 +136,12 @@ func (db *Mongodb) writeAsDataset(request Request, colName string, message Messa
c := db.client.Database(request.DbName()).Collection(colName)
_, err := c.UpdateOne(context.TODO(), filter, update, options)
// ToDo Commented code was used in receiver to ingest dataset. Check, that it works without it.
// first update may fail due to multiple threads try to create document at once, the second one should succeed
// https://jira.mongodb.org/browse/SERVER-14322
if duplicateError(err) {
_, err = c.UpdateOne(context.TODO(), filter, update, options)
}
//if duplicateError(err) {
// _, err = c.UpdateOne(context.TODO(), filter, update, options)
//}
if err != nil {
request.Logger().WithFields(map[string]interface{}{"id": message.Id,
"substream": message.DatasetSubstream, "cause": err.Error()}).Error("failed to insert dataset")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment