You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2011/11/22 18:47:01 UTC
svn commit: r1205105 -
/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Author: markrmiller
Date: Tue Nov 22 17:47:00 2011
New Revision: 1205105
URL: http://svn.apache.org/viewvc?rev=1205105&view=rev
Log:
fix nocommits about dropping updates when the version code says to
Modified:
lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1205105&r1=1205104&r2=1205105&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Tue Nov 22 17:47:00 2011
@@ -208,10 +208,15 @@ public class DistributedUpdateProcessor
setupRequest(hash);
+ boolean dropCmd = false;
if (!forwardToLeader) {
- versionAdd(cmd, hash);
+ dropCmd = versionAdd(cmd, hash);
}
+ if (dropCmd) {
+ // TODO: do we need to add anything to the response?
+ return;
+ }
if (shardStr != null) {
cmdDistrib.distribAdd(cmd, shardStr);
@@ -219,6 +224,7 @@ public class DistributedUpdateProcessor
super.processAdd(cmd);
}
+
if (returnVersions && rsp != null) {
if (addsResponse == null) {
addsResponse = new NamedList<String>();
@@ -235,10 +241,16 @@ public class DistributedUpdateProcessor
// processor too.
}
- private void versionAdd(AddUpdateCommand cmd, int hash) throws IOException {
+ /**
+ * @param cmd
+ * @param hash
+ * @return whether or not to drop this cmd
+ * @throws IOException
+ */
+ private boolean versionAdd(AddUpdateCommand cmd, int hash) throws IOException {
if (vinfo == null) {
super.processAdd(cmd);
- return;
+ return false;
}
// at this point, there is an update we need to try and apply.
@@ -287,9 +299,7 @@ public class DistributedUpdateProcessor
Long lastVersion = vinfo.lookupVersion(cmd.getIndexedId());
if (lastVersion != null && Math.abs(lastVersion) >= versionOnUpdate) {
// This update is a repeat, or was reordered. We need to drop this update.
- // TODO: do we need to add anything to the response?
- // nocommit: we should avoid next step in distrib add
- return;
+ return true;
}
}
}
@@ -297,7 +307,7 @@ public class DistributedUpdateProcessor
}
-
+ return false;
}
@Override
@@ -311,8 +321,14 @@ public class DistributedUpdateProcessor
setupRequest(hash);
+ boolean dropCmd = false;
if (!forwardToLeader) {
- versionDelete(cmd, hash);
+ dropCmd = versionDelete(cmd, hash);
+ }
+
+ if (dropCmd) {
+ // TODO: do we need to add anything to the response?
+ return;
}
if (shardStr != null) {
@@ -333,19 +349,19 @@ public class DistributedUpdateProcessor
}
}
- private void versionDelete(DeleteUpdateCommand cmd, int hash) throws IOException {
+ private boolean versionDelete(DeleteUpdateCommand cmd, int hash) throws IOException {
if (cmd == null) {
throw new NullArgumentException("cmd is null");
}
if (vinfo == null) {
- return;
+ return false;
}
if (cmd.id == null) {
// delete-by-query
// TODO: forward to all nodes in distrib mode? or just don't bother to support?
- return;
+ return false;
}
// at this point, there is an update we need to try and apply.
@@ -381,16 +397,14 @@ public class DistributedUpdateProcessor
// the specific version for this id.
Long lastVersion = vinfo.lookupVersion(cmd.getIndexedId());
if (lastVersion != null && Math.abs(lastVersion) >= versionOnUpdate) {
- // This update is a repeat, or was reordered. We need to drop this update.
- // TODO: do we need to add anything to the response?
- // nocommit: we should skip distrib update?
- return;
+ // This update is a repeat, or was reordered. We need to drop this update.
+ return true;
}
}
}
}
- return;
+ return false;
}
}