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 2020/09/17 15:22:51 UTC

[lucene-solr] 17/18: @852 ManagedSchema tweaks for opti locking.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 531bc7680a9b51c41b340888fe2d92ea6d7378e3
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Sep 17 06:20:50 2020 -0500

    @852 ManagedSchema tweaks for opti locking.
---
 .../org/apache/solr/schema/ManagedIndexSchema.java     |  2 +-
 .../AddSchemaFieldsUpdateProcessorFactory.java         | 18 +++---------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
index f0b8541..8188a10 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
@@ -204,7 +204,7 @@ public final class ManagedIndexSchema extends IndexSchema {
           log.info("Persisted managed schema version {}  at {}", schemaZkVersion, managedSchemaPath);
         } catch (KeeperException.BadVersionException e) {
 
-          log.error("Bad version when trying to persist schema using {} due to: ", schemaZkVersion, e);
+          log.info("Bad version when trying to persist schema using {}", schemaZkVersion);
 
           success = false;
           schemaChangedInZk = true;
diff --git a/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java
index c4f850e..24e5dc1 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java
@@ -418,7 +418,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
           throw new SolrException(BAD_REQUEST, message);
         }
         if (log.isDebugEnabled()) {
-          StringBuilder builder = new StringBuilder(512);
+          StringBuilder builder = new StringBuilder(1024);
           builder.append("\nFields to be added to the schema: [");
           boolean isFirst = true;
           for (SchemaField field : newFields) {
@@ -470,28 +470,16 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
               ((ManagedIndexSchema)newSchema).persistManagedSchema(false);
               core.setLatestSchema(newSchema);
               cmd.getReq().updateSchemaToLatest();
-              log.debug("Successfully added field(s) and copyField(s) to the schema.");
+              if (log.isDebugEnabled()) log.debug("Successfully added field(s) and copyField(s) to the schema.");
               break; // success - exit from the retry loop
             } else {
               throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Failed to add fields and/or copyFields.");
             }
           } catch (ManagedIndexSchema.FieldExistsException e) {
             log.error("At least one field to be added already exists in the schema - retrying.");
-            try {
-              Thread.sleep(200);
-            } catch (InterruptedException interruptedException) {
-              ParWork.propagateInterrupt(interruptedException);
-              throw new AlreadyClosedException();
-            }
             cmd.getReq().updateSchemaToLatest();
           } catch (ManagedIndexSchema.SchemaChangedInZkException e) {
-            if (log.isDebugEnabled()) log.debug("Schema changed while processing request - retrying.");
-            try {
-              Thread.sleep(200);
-            } catch (InterruptedException interruptedException) {
-              ParWork.propagateInterrupt(interruptedException);
-              throw new AlreadyClosedException();
-            }
+            log.info("Schema changed while processing request - retrying.");
             oldSchema = core.getLatestSchema();
             cmd.getReq().updateSchemaToLatest();
           }