You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2016/03/17 21:21:43 UTC
svn commit: r1735494 - in /jackrabbit/oak/branches/1.0/oak-core/src:
main/java/org/apache/jackrabbit/oak/plugins/document/
main/java/org/apache/jackrabbit/oak/plugins/document/mongo/
test/java/org/apache/jackrabbit/oak/plugins/document/mongo/
Author: mreutegg
Date: Thu Mar 17 20:21:42 2016
New Revision: 1735494
URL: http://svn.apache.org/viewvc?rev=1735494&view=rev
Log:
OAK-4131: LastRevisionRecoveryAgent may throw ClassCastException
Implement fix and enable test
Modified:
jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/AcquireRecoveryLockTest.java
Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java?rev=1735494&r1=1735493&r2=1735494&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java Thu Mar 17 20:21:42 2016
@@ -359,7 +359,7 @@ public class LastRevRecoveryAgent {
for (ClusterNodeInfoDocument nodeInfo : clusters) {
String id = nodeInfo.getId();
if (nodeInfo.isBeingRecovered()) {
- Long recoveredBy = (Long) nodeInfo.get(ClusterNodeInfo.REV_RECOVERY_BY);
+ Long recoveredBy = Utils.asLong((Number) nodeInfo.get(ClusterNodeInfo.REV_RECOVERY_BY));
beingRecoveredRightNow.add(nodeInfo == null ? id : String.format("%s (by %d)", id, recoveredBy));
} else if (isRecoveryNeeded(nodeInfo)) {
candidateClusterNodes.add(Integer.valueOf(id));
Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java?rev=1735494&r1=1735493&r2=1735494&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java Thu Mar 17 20:21:42 2016
@@ -86,7 +86,7 @@ public class MongoMissingLastRevSeeker e
BasicDBObject setUpdates = new BasicDBObject();
setUpdates.append(ClusterNodeInfo.REV_RECOVERY_LOCK, RecoverLockState.ACQUIRED.name());
if (recoveredBy != 0) {
- setUpdates.append(ClusterNodeInfo.REV_RECOVERY_BY, recoveredBy);
+ setUpdates.append(ClusterNodeInfo.REV_RECOVERY_BY, (long) recoveredBy);
}
BasicDBObject update = new BasicDBObject();
Modified: jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/AcquireRecoveryLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/AcquireRecoveryLockTest.java?rev=1735494&r1=1735493&r2=1735494&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/AcquireRecoveryLockTest.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/AcquireRecoveryLockTest.java Thu Mar 17 20:21:42 2016
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.document.ClusterNodeInfo;
import org.apache.jackrabbit.oak.plugins.document.ClusterNodeInfoDocument;
import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
-import org.junit.Ignore;
import org.junit.Test;
import static com.google.common.collect.Lists.newArrayList;
@@ -32,7 +31,6 @@ import static org.junit.Assert.assertNot
public class AcquireRecoveryLockTest extends AbstractMongoConnectionTest {
// OAK-4131
- @Ignore
@Test
public void recoveryBy() throws Exception {
MongoDocumentStore store = new MongoDocumentStore(