Project

General

Profile

« Previous | Next » 

Revision 55334

Make a copy of the object

View differences:

MDStoreTransactionManagerImpl.java
663 663
		final FindIterable<DBObject> it = transaction.find().noCursorTimeout(true);
664 664
		for (DBObject currentObj : it) {
665 665
			final String id = (String) currentObj.get("id");
666
			DBObject newObj = new BasicDBObject(currentObj.toMap());
666 667
			//setting to journaled write concern to be sure that when the write returns everything has been flushed to disk (https://docs.mongodb.org/manual/faq/developers/#when-does-mongodb-write-updates-to-disk)
667 668
			//the explicit fsync command can't be run anymore: 'Command failed with error 13: 'fsync may only be run against the admin database.'
668 669
			final MongoCollection<DBObject> mdstoreWrite = mdstore.withWriteConcern(WriteConcern.JOURNALED);
669
			mdstoreWrite.replaceOne(new BasicDBObject("id", id), currentObj, new UpdateOptions().upsert(true));
670
			mdstoreWrite.replaceOne(new BasicDBObject("id", id), newObj, new UpdateOptions().upsert(true));
670 671
		}
671 672
	}
672 673

  

Also available in: Unified diff