jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meteata...@apache.org
Subject svn commit: r1436894 - in /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl: action/SaveCommitAction.java command/CommitCommand.java command/CommitCommandNew.java
Date Tue, 22 Jan 2013 13:10:28 GMT
Author: meteatamel
Date: Tue Jan 22 13:10:27 2013
New Revision: 1436894

URL: http://svn.apache.org/viewvc?rev=1436894&view=rev
Log:
OAK-577 - Incorrect usage of WriteResult#getError/getLastError

Made sure updates to commit collection are done in safe mode.

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/SaveCommitAction.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandNew.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/SaveCommitAction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/SaveCommitAction.java?rev=1436894&r1=1436893&r2=1436894&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/SaveCommitAction.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/SaveCommitAction.java
Tue Jan 22 13:10:27 2013
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.mongomk.imp
 import org.apache.jackrabbit.mongomk.impl.model.MongoCommit;
 
 import com.mongodb.DBCollection;
+import com.mongodb.WriteConcern;
 import com.mongodb.WriteResult;
 
 /**
@@ -43,7 +44,7 @@ public class SaveCommitAction extends Ba
     @Override
     public Boolean execute() throws Exception {
         DBCollection commitCollection = nodeStore.getCommitCollection();
-        WriteResult writeResult = commitCollection.insert(commitMongo);
+        WriteResult writeResult = commitCollection.insert(commitMongo, WriteConcern.SAFE);
         if (writeResult.getError() != null) {
             throw new Exception(String.format("Insertion wasn't successful: %s", writeResult));
         }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java?rev=1436894&r1=1436893&r2=1436894&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java
Tue Jan 22 13:10:27 2013
@@ -44,6 +44,7 @@ import com.mongodb.BasicDBObject;
 import com.mongodb.DBCollection;
 import com.mongodb.DBObject;
 import com.mongodb.QueryBuilder;
+import com.mongodb.WriteConcern;
 import com.mongodb.WriteResult;
 
 /**
@@ -325,7 +326,8 @@ public class CommitCommand extends BaseC
         DBCollection commitCollection = nodeStore.getCommitCollection();
         DBObject query = QueryBuilder.start("_id").is(commit.getObjectId("_id")).get();
         DBObject update = new BasicDBObject("$set", new BasicDBObject(MongoCommit.KEY_FAILED,
Boolean.TRUE));
-        WriteResult writeResult = commitCollection.update(query, update);
+        WriteResult writeResult = commitCollection.update(query, update,
+                false /*upsert*/, false /*multi*/, WriteConcern.SAFE);
         nodeStore.evict(commit);
         if (writeResult.getError() != null) {
             // FIXME This is potentially a bug that we need to handle.

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandNew.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandNew.java?rev=1436894&r1=1436893&r2=1436894&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandNew.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandNew.java
Tue Jan 22 13:10:27 2013
@@ -46,6 +46,7 @@ import com.mongodb.BasicDBObject;
 import com.mongodb.DBCollection;
 import com.mongodb.DBObject;
 import com.mongodb.QueryBuilder;
+import com.mongodb.WriteConcern;
 import com.mongodb.WriteResult;
 
 /**
@@ -340,7 +341,8 @@ public class CommitCommandNew extends Ba
         DBCollection commitCollection = nodeStore.getCommitCollection();
         DBObject query = QueryBuilder.start("_id").is(commit.getObjectId("_id")).get();
         DBObject update = new BasicDBObject("$set", new BasicDBObject(MongoCommit.KEY_FAILED,
Boolean.TRUE));
-        WriteResult writeResult = commitCollection.update(query, update);
+        WriteResult writeResult = commitCollection.update(query, update,
+                false /*upsert*/, false /*multi*/, WriteConcern.SAFE);
         nodeStore.evict(commit);
         if (writeResult.getError() != null) {
             // FIXME This is potentially a bug that we need to handle.



Mime
View raw message