Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java (revision 1710683) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java (working copy) @@ -32,7 +32,7 @@ import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; -import com.mongodb.MongoException; +import com.mongodb.DuplicateKeyException; import com.mongodb.QueryBuilder; import com.mongodb.ReadPreference; import com.mongodb.WriteResult; @@ -87,7 +87,7 @@ // TODO verify insert is fast if the entry already exists try { getBlobCollection().insert(mongoBlob); - } catch (MongoException.DuplicateKey e) { + } catch (DuplicateKeyException e) { // the same block was already stored before: ignore } } @@ -138,10 +138,7 @@ DBObject query = getBlobQuery(id, minLastModified); DBObject update = new BasicDBObject("$set", new BasicDBObject(MongoBlob.KEY_LAST_MOD, System.currentTimeMillis())); - WriteResult writeResult = getBlobCollection().update(query, update); - if (writeResult.getError() != null) { - LOG.error("Mark failed for blob {}: {}", id, writeResult.getError()); - } + getBlobCollection().update(query, update); } @Override @@ -148,10 +145,7 @@ public int sweep() throws IOException { DBObject query = getBlobQuery(null, minLastModified); long countBefore = getBlobCollection().count(query); - WriteResult writeResult = getBlobCollection().remove(query); - if (writeResult.getError() != null) { - LOG.error("Sweep failed: {}", writeResult.getError()); - } + getBlobCollection().remove(query); long countAfter = getBlobCollection().count(query); minLastModified = 0; @@ -173,7 +167,7 @@ index.put(MongoBlob.KEY_ID, 1L); DBObject options = new BasicDBObject(); options.put("unique", Boolean.TRUE); - collection.ensureIndex(index, options); + collection.createIndex(index, options); } private MongoBlob getBlob(String id, long lastMod) { Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java (revision 1710683) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java (working copy) @@ -77,8 +77,6 @@ import com.google.common.base.Objects; import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.common.util.concurrent.Striped; import com.mongodb.BasicDBObject; @@ -215,7 +213,7 @@ index.put(NodeDocument.MODIFIED_IN_SECS, -1L); DBObject options = new BasicDBObject(); options.put("unique", Boolean.FALSE); - nodes.ensureIndex(index, options); + nodes.createIndex(index, options); // index on the _bin flag to faster access nodes with binaries for GC index = new BasicDBObject(); @@ -223,7 +221,7 @@ options = new BasicDBObject(); options.put("unique", Boolean.FALSE); options.put("sparse", Boolean.TRUE); - this.nodes.ensureIndex(index, options); + this.nodes.createIndex(index, options); index = new BasicDBObject(); index.put(NodeDocument.DELETED_ONCE, 1); @@ -230,7 +228,7 @@ options = new BasicDBObject(); options.put("unique", Boolean.FALSE); options.put("sparse", Boolean.TRUE); - this.nodes.ensureIndex(index, options); + this.nodes.createIndex(index, options); index = new BasicDBObject(); index.put(NodeDocument.SD_TYPE, 1); @@ -237,13 +235,13 @@ options = new BasicDBObject(); options.put("unique", Boolean.FALSE); options.put("sparse", Boolean.TRUE); - this.nodes.ensureIndex(index, options); + this.nodes.createIndex(index, options); index = new BasicDBObject(); index.put(JournalEntry.MODIFIED, 1); options = new BasicDBObject(); options.put("unique", Boolean.FALSE); - this.journal.ensureIndex(index, options); + this.journal.createIndex(index, options); nodesCache = builder.buildDocumentCache(this); @@ -892,10 +890,7 @@ final long start = PERFLOG.start(); try { try { - WriteResult writeResult = dbCollection.insert(inserts); - if (writeResult.getError() != null) { - return false; - } + dbCollection.insert(inserts); if (collection == Collection.NODES) { for (T doc : docs) { TreeLock lock = acquire(doc.getId(), collection); @@ -935,10 +930,7 @@ } } try { - WriteResult writeResult = dbCollection.update(query.get(), update, false, true); - if (writeResult.getError() != null) { - throw new DocumentStoreException("Update failed: " + writeResult.getError()); - } + dbCollection.update(query.get(), update, false, true); if (collection == Collection.NODES) { // update cache for (Entry entry : cachedDocs.entrySet()) { Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java (revision 1710683) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java (working copy) @@ -33,7 +33,6 @@ import com.mongodb.DBObject; import com.mongodb.QueryBuilder; import com.mongodb.ReadPreference; -import com.mongodb.WriteResult; import org.apache.jackrabbit.oak.plugins.document.Document; import org.apache.jackrabbit.oak.plugins.document.NodeDocument; import org.apache.jackrabbit.oak.plugins.document.SplitDocumentCleanUp; @@ -174,12 +173,7 @@ logSplitDocIdsTobeDeleted(query); } - WriteResult writeResult = getNodeCollection().remove(query); - if (writeResult.getError() != null) { - //TODO This might be temporary error or we fail fast and let next cycle try again - LOG.warn("Error occurred while deleting old split documents from Mongo {}", writeResult.getError()); - } - return writeResult.getN(); + return getNodeCollection().remove(query).getN(); } } } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MongoConnection.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MongoConnection.java (revision 1710683) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MongoConnection.java (working copy) @@ -93,8 +93,6 @@ .add("connectTimeout", opts.getConnectTimeout()) .add("socketTimeout", opts.getSocketTimeout()) .add("socketKeepAlive", opts.isSocketKeepAlive()) - .add("autoConnectRetry", opts.isAutoConnectRetry()) - .add("maxAutoConnectRetryTime", opts.getMaxAutoConnectRetryTime()) .add("maxWaitTime", opts.getMaxWaitTime()) .add("threadsAllowedToBlockForConnectionMultiplier", opts.getThreadsAllowedToBlockForConnectionMultiplier()) Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java (revision 1710683) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java (working copy) @@ -48,7 +48,6 @@ import org.apache.jackrabbit.oak.plugins.document.Revision; import org.apache.jackrabbit.oak.plugins.document.RevisionContext; import org.apache.jackrabbit.oak.plugins.document.StableRevisionComparator; -import org.bson.types.ObjectId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -172,16 +171,6 @@ return size; } - /** - * Generate a unique cluster id, similar to the machine id field in MongoDB ObjectId objects. - * - * @return the unique machine id - */ - public static int getUniqueClusterId() { - ObjectId objId = new ObjectId(); - return objId._machine(); - } - public static String escapePropertyName(String propertyName) { int len = propertyName.length(); if (len == 0) { Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobThroughPutTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobThroughPutTest.java (revision 1710683) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobThroughPutTest.java (working copy) @@ -36,6 +36,7 @@ import com.mongodb.DBCollection; import com.mongodb.DBObject; import com.mongodb.Mongo; +import com.mongodb.MongoClient; import com.mongodb.QueryBuilder; import com.mongodb.WriteConcern; import org.junit.Ignore; @@ -65,7 +66,7 @@ bimap.put(WriteConcern.FSYNC_SAFE,"FSYNC_SAFE"); bimap.put(WriteConcern.JOURNAL_SAFE,"JOURNAL_SAFE"); // bimap.put(WriteConcern.MAJORITY,"MAJORITY"); - bimap.put(WriteConcern.NONE,"NONE"); + bimap.put(WriteConcern.UNACKNOWLEDGED,"UNACKNOWLEDGED"); bimap.put(WriteConcern.NORMAL,"NORMAL"); // bimap.put(WriteConcern.REPLICAS_SAFE,"REPLICAS_SAFE"); bimap.put(WriteConcern.SAFE,"SAFE"); @@ -78,8 +79,8 @@ @Ignore @Test public void performBenchMark() throws UnknownHostException, InterruptedException { - Mongo local = new Mongo(new DBAddress(localServer)); - Mongo remote = new Mongo(new DBAddress(remoteServer)); + MongoClient local = new MongoClient(new DBAddress(localServer)); + MongoClient remote = new MongoClient(new DBAddress(remoteServer)); run(local, false, false); run(local, true, false); Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDbTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDbTest.java (revision 1710683) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDbTest.java (working copy) @@ -45,7 +45,7 @@ index.put("_id", 1L); DBObject options = new BasicDBObject(); // options.put("unique", Boolean.TRUE); - nodes.ensureIndex(index, options); + nodes.createIndex(index, options); // index on (_id, _mod): // Query plan: { "cursor" : "BtreeCursor _id_1__mod_-1" , @@ -120,7 +120,7 @@ index.put("_id", 1L); DBObject options = new BasicDBObject(); // options.put("unique", Boolean.TRUE); - nodes.ensureIndex(index, options); + nodes.createIndex(index, options); long time; time = System.currentTimeMillis(); Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java (revision 1710683) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java (working copy) @@ -42,7 +42,6 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; import com.mongodb.DBObject; -import com.mongodb.WriteResult; /** * Tests the document store. @@ -251,7 +250,7 @@ index.put("_path", 1L); DBObject options = new BasicDBObject(); options.put("unique", Boolean.TRUE); - collection.ensureIndex(index, options); + collection.createIndex(index, options); log("Inserting " + n + " batch? " + batch); long start = System.currentTimeMillis(); @@ -261,16 +260,10 @@ for (int i = 0; i < n; i++) { arr[i] = new BasicDBObject("_path", "/a" + i); } - WriteResult result = collection.insert(arr); - if (result.getError() != null) { - log("Error: " + result.getError()); - } + collection.insert(arr); } else { for (int i = 0; i < n; i++) { - WriteResult result = collection.insert(new BasicDBObject("_path", "/a" + i)); - if (result.getError() != null) { - log("Error: " + result.getError()); - } + collection.insert(new BasicDBObject("_path", "/a" + i)); } }