You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/06/20 05:47:37 UTC

[1/2] lucene-solr:branch_6x: SOLR-8995: replace SAM implementations with lambda

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 097cffeba -> d3fcac779


SOLR-8995: replace SAM implementations with lambda


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ab44ac17
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ab44ac17
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ab44ac17

Branch: refs/heads/branch_6x
Commit: ab44ac17ae2eaeb71847d9c066b06acd7afba989
Parents: 62452f0
Author: Noble Paul <no...@apache.org>
Authored: Mon Jun 20 11:11:18 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Mon Jun 20 11:17:12 2016 +0530

----------------------------------------------------------------------
 .../org/apache/solr/cloud/ElectionContext.java  | 50 +++++++++-----------
 .../org/apache/solr/common/util/RetryUtil.java  |  8 ++--
 .../apache/solr/common/util/TestRetryUtil.java  | 36 +++++---------
 3 files changed, 39 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab44ac17/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
index 38f6083..d528947 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
@@ -180,35 +180,31 @@ class ShardLeaderElectionContextBase extends ElectionContext {
     zcmd.ensureExists(parent, zkClient);
 
     try {
-      RetryUtil.retryOnThrowable(NodeExistsException.class, 60000, 5000, new RetryCmd() {
-        
-        @Override
-        public void execute() throws InterruptedException, KeeperException {
-          synchronized (lock) {
-            log.info("Creating leader registration node {} after winning as {}", leaderPath, leaderSeqPath);
-            List<Op> ops = new ArrayList<>(2);
-
-            // We use a multi operation to get the parent nodes version, which will
-            // be used to make sure we only remove our own leader registration node.
-            // The setData call used to get the parent version is also the trigger to
-            // increment the version. We also do a sanity check that our leaderSeqPath exists.
-
-            ops.add(Op.check(leaderSeqPath, -1));
-            ops.add(Op.create(leaderPath, Utils.toJSON(leaderProps), zkClient.getZkACLProvider().getACLsToAdd(leaderPath), CreateMode.EPHEMERAL));
-            ops.add(Op.setData(parent, null, -1));
-            List<OpResult> results;
-
-            results = zkClient.multi(ops, true);
-            for (OpResult result : results) {
-              if (result.getType() == ZooDefs.OpCode.setData) {
-                SetDataResult dresult = (SetDataResult) result;
-                Stat stat = dresult.getStat();
-                leaderZkNodeParentVersion = stat.getVersion();
-                return;
-              }
+      RetryUtil.retryOnThrowable(NodeExistsException.class, 60000, 5000, () -> {
+        synchronized (lock) {
+          log.info("Creating leader registration node {} after winning as {}", leaderPath, leaderSeqPath);
+          List<Op> ops = new ArrayList<>(2);
+
+          // We use a multi operation to get the parent nodes version, which will
+          // be used to make sure we only remove our own leader registration node.
+          // The setData call used to get the parent version is also the trigger to
+          // increment the version. We also do a sanity check that our leaderSeqPath exists.
+
+          ops.add(Op.check(leaderSeqPath, -1));
+          ops.add(Op.create(leaderPath, Utils.toJSON(leaderProps), zkClient.getZkACLProvider().getACLsToAdd(leaderPath), CreateMode.EPHEMERAL));
+          ops.add(Op.setData(parent, null, -1));
+          List<OpResult> results;
+
+          results = zkClient.multi(ops, true);
+          for (OpResult result : results) {
+            if (result.getType() == ZooDefs.OpCode.setData) {
+              SetDataResult dresult = (SetDataResult) result;
+              Stat stat = dresult.getStat();
+              leaderZkNodeParentVersion = stat.getVersion();
+              return;
             }
-            assert leaderZkNodeParentVersion != null;
           }
+          assert leaderZkNodeParentVersion != null;
         }
       });
     } catch (Throwable t) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab44ac17/solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java
index 8745a54..2b9a0fd 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java
@@ -30,12 +30,12 @@ import org.slf4j.LoggerFactory;
 public class RetryUtil {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   
-  public static interface RetryCmd {
-    public void execute() throws Throwable;
+  public interface RetryCmd {
+    void execute() throws Throwable;
   }
   
-  public static interface BooleanRetryCmd {
-    public boolean execute();
+  public interface BooleanRetryCmd {
+    boolean execute();
   }
   
   public static void retryOnThrowable(Class clazz, long timeoutms, long intervalms, RetryCmd cmd) throws Throwable {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab44ac17/solr/solrj/src/test/org/apache/solr/common/util/TestRetryUtil.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestRetryUtil.java b/solr/solrj/src/test/org/apache/solr/common/util/TestRetryUtil.java
index 05bfce1..8e099e5 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestRetryUtil.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestRetryUtil.java
@@ -28,14 +28,10 @@ public class TestRetryUtil extends SolrTestCaseJ4 {
 
   public void testRetryOnThrowable() throws Throwable {
     final AtomicInteger executes = new AtomicInteger();
-    RetryUtil.retryOnThrowable(SolrException.class, 10000, 10, new RetryCmd() {
-      
-      @Override
-      public void execute() throws Throwable {
-        int calls = executes.incrementAndGet();
-        if (calls <= 2) {
-          throw new SolrException(ErrorCode.SERVER_ERROR, "Bad Stuff Happened");
-        }
+    RetryUtil.retryOnThrowable(SolrException.class, 10000, 10, () -> {
+      int calls = executes.incrementAndGet();
+      if (calls <= 2) {
+        throw new SolrException(ErrorCode.SERVER_ERROR, "Bad Stuff Happened");
       }
     });
     
@@ -45,15 +41,11 @@ public class TestRetryUtil extends SolrTestCaseJ4 {
     boolean caughtSolrException = false;
     try {
       RetryUtil.retryOnThrowable(IllegalStateException.class, 10000, 10,
-          new RetryCmd() {
-            
-            @Override
-            public void execute() throws Throwable {
-              int calls = executes2.incrementAndGet();
-              if (calls <= 2) {
-                throw new SolrException(ErrorCode.SERVER_ERROR,
-                    "Bad Stuff Happened");
-              }
+          () -> {
+            int calls = executes2.incrementAndGet();
+            if (calls <= 2) {
+              throw new SolrException(ErrorCode.SERVER_ERROR,
+                  "Bad Stuff Happened");
             }
           });
     } catch (SolrException e) {
@@ -65,13 +57,9 @@ public class TestRetryUtil extends SolrTestCaseJ4 {
     final AtomicInteger executes3 = new AtomicInteger();
     caughtSolrException = false;
     try {
-      RetryUtil.retryOnThrowable(SolrException.class, 1000, 10, new RetryCmd() {
-        
-        @Override
-        public void execute() throws Throwable {
-          executes3.incrementAndGet();
-          throw new SolrException(ErrorCode.SERVER_ERROR, "Bad Stuff Happened");
-        }
+      RetryUtil.retryOnThrowable(SolrException.class, 1000, 10, () -> {
+        executes3.incrementAndGet();
+        throw new SolrException(ErrorCode.SERVER_ERROR, "Bad Stuff Happened");
       });
     } catch (SolrException e) {
       caughtSolrException = true;


[2/2] lucene-solr:branch_6x: Merge remote-tracking branch 'origin/branch_6x' into branch_6x

Posted by no...@apache.org.
Merge remote-tracking branch 'origin/branch_6x' into branch_6x


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d3fcac77
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d3fcac77
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d3fcac77

Branch: refs/heads/branch_6x
Commit: d3fcac779b76325c20806c337f4c211875371625
Parents: ab44ac1 097cffe
Author: Noble Paul <no...@apache.org>
Authored: Mon Jun 20 11:17:30 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Mon Jun 20 11:17:30 2016 +0530

----------------------------------------------------------------------
 .../test-framework/lucene-test-framework.iml    |   1 +
 dev-tools/maven/pom.xml.template                |   4 +-
 dev-tools/maven/solr/pom.xml.template           |   6 +-
 lucene/CHANGES.txt                              |   7 +
 .../index/TestBackwardsCompatibility.java       |   4 +-
 .../org/apache/lucene/index/index.6.1.0-cfs.zip | Bin 0 -> 13769 bytes
 .../apache/lucene/index/index.6.1.0-nocfs.zip   | Bin 0 -> 13763 bytes
 .../benchmark/byTask/tasks/CommitIndexTask.java |   2 +-
 lucene/common-build.xml                         |   2 +-
 .../org/apache/lucene/index/IndexCommit.java    |   2 +-
 .../org/apache/lucene/index/IndexUpgrader.java  |   2 +-
 .../org/apache/lucene/index/IndexWriter.java    |  67 ++-
 .../org/apache/lucene/index/SegmentInfos.java   |  32 +-
 .../apache/lucene/index/TestDeletionPolicy.java |   4 +-
 .../lucene/index/TestDirectoryReaderReopen.java |   4 +-
 .../apache/lucene/index/TestIndexWriter.java    |  39 +-
 .../lucene/index/TestIndexWriterCommit.java     |  37 +-
 .../lucene/index/TestTransactionRollback.java   |   4 +-
 .../org/apache/lucene/search/TestBoolean2.java  |  27 +-
 .../lucene/facet/taxonomy/TaxonomyReader.java   |   2 +-
 .../lucene/facet/taxonomy/TaxonomyWriter.java   |  16 +-
 .../directory/DirectoryTaxonomyWriter.java      |  40 +-
 .../directory/TestDirectoryTaxonomyWriter.java  |  20 +-
 lucene/ivy-versions.properties                  |  18 +-
 lucene/licenses/commons-compress-1.11.jar.sha1  |   1 +
 lucene/licenses/commons-compress-1.8.1.jar.sha1 |   1 -
 .../lucene/replicator/nrt/PrimaryNode.java      |  26 +-
 .../IndexAndTaxonomyReplicationClientTest.java  |   4 +-
 .../replicator/IndexReplicationClientTest.java  |   4 +-
 .../lucene/replicator/LocalReplicatorTest.java  |   4 +-
 .../replicator/http/HttpReplicatorTest.java     |   2 +-
 solr/CHANGES.txt                                |  11 +-
 solr/NOTICE.txt                                 |   3 +
 solr/common-build.xml                           |   3 +-
 .../dataimport/TestTikaEntityProcessor.java     |   2 -
 solr/contrib/extraction/ivy.xml                 |   3 +
 .../extraction/ExtractingDocumentLoader.java    |   4 +-
 .../ExtractingRequestHandlerTest.java           |   2 -
 .../apache/solr/hadoop/MorphlineMapperTest.java |   1 +
 .../morphlines/cell/SolrCellMorphlineTest.java  |   3 +-
 .../solr/update/DirectUpdateHandler2.java       |   2 +-
 .../processor/UpdateRequestProcessorChain.java  |  19 +-
 .../apache/solr/cloud/TestConfigSetsAPI.java    |   4 +-
 .../solr/cloud/TestConfigSetsAPIZkFailure.java  |   2 +-
 .../cloud/TestMiniSolrCloudClusterKerberos.java |   3 +-
 .../cloud/TestSolrCloudWithKerberosAlt.java     |   3 +-
 .../solr/core/TestConfigSetImmutable.java       |   3 +-
 solr/licenses/commons-compress-1.11.jar.sha1    |   1 +
 solr/licenses/commons-compress-1.8.1.jar.sha1   |   1 -
 solr/licenses/fontbox-1.8.8.jar.sha1            |   1 -
 solr/licenses/fontbox-2.0.1.jar.sha1            |   1 +
 solr/licenses/isoparser-1.0.2.jar.sha1          |   1 -
 solr/licenses/isoparser-1.1.18.jar.sha1         |   1 +
 solr/licenses/jackcess-2.1.3.jar.sha1           |   1 +
 solr/licenses/jackcess-LICENSE-ASL.txt          | 507 +++++++++++++++++++
 solr/licenses/jackcess-NOTICE.txt               |   1 +
 solr/licenses/jempbox-1.8.12.jar.sha1           |   1 +
 solr/licenses/jempbox-1.8.8.jar.sha1            |   1 -
 solr/licenses/metadata-extractor-2.6.2.jar.sha1 |   1 -
 solr/licenses/metadata-extractor-2.8.1.jar.sha1 |   1 +
 solr/licenses/pdfbox-1.8.8.jar.sha1             |   1 -
 solr/licenses/pdfbox-2.0.1.jar.sha1             |   1 +
 solr/licenses/pdfbox-tools-2.0.1.jar.sha1       |   1 +
 solr/licenses/pdfbox-tools-LICENSE-ASL.txt      | 314 ++++++++++++
 solr/licenses/pdfbox-tools-NOTICE.txt           |  14 +
 solr/licenses/poi-3.11.jar.sha1                 |   1 -
 solr/licenses/poi-3.15-beta1.jar.sha1           |   1 +
 solr/licenses/poi-ooxml-3.11.jar.sha1           |   1 -
 solr/licenses/poi-ooxml-3.15-beta1.jar.sha1     |   1 +
 solr/licenses/poi-ooxml-schemas-3.11.jar.sha1   |   1 -
 .../poi-ooxml-schemas-3.15-beta1.jar.sha1       |   1 +
 solr/licenses/poi-scratchpad-3.11.jar.sha1      |   1 -
 .../licenses/poi-scratchpad-3.15-beta1.jar.sha1 |   1 +
 solr/licenses/tika-core-1.13.jar.sha1           |   1 +
 solr/licenses/tika-core-1.7.jar.sha1            |   1 -
 solr/licenses/tika-java7-1.13.jar.sha1          |   1 +
 solr/licenses/tika-java7-1.7.jar.sha1           |   1 -
 solr/licenses/tika-parsers-1.13.jar.sha1        |   1 +
 solr/licenses/tika-parsers-1.7.jar.sha1         |   1 -
 solr/licenses/tika-xmp-1.13.jar.sha1            |   1 +
 solr/licenses/tika-xmp-1.7.jar.sha1             |   1 -
 solr/licenses/vorbis-java-core-0.6.jar.sha1     |   1 -
 solr/licenses/vorbis-java-core-0.8.jar.sha1     |   1 +
 solr/licenses/vorbis-java-tika-0.6.jar.sha1     |   1 -
 solr/licenses/vorbis-java-tika-0.8.jar.sha1     |   1 +
 85 files changed, 1158 insertions(+), 162 deletions(-)
----------------------------------------------------------------------