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/08/27 18:56:46 UTC

[lucene-solr] branch reference_impl_dev updated: @602 Attempt to harden races around core reload and writing/reading core.properties file.

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 66c6270  @602 Attempt to harden races around core reload and writing/reading core.properties file.
66c6270 is described below

commit 66c6270da2778ea2e6a0477ab1033abc78b97a2b
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Aug 27 13:56:27 2020 -0500

    @602 Attempt to harden races around core reload and writing/reading core.properties file.
---
 solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java b/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
index 2d2712f..1c5ce26 100644
--- a/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
+++ b/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
@@ -83,7 +83,9 @@ public class CorePropertiesLocator implements CoresLocator {
     }
   }
 
-  private void writePropertiesFile(CoreDescriptor cd, Path propfile)  {
+  // we have to be careful about writing and reading the same file without a lock
+  // this sync is a little heavy, but given it's a tiny file we are writing, should do for now
+  private synchronized void writePropertiesFile(CoreDescriptor cd, Path propfile)  {
     Properties p = buildCoreProperties(cd);
     try {
       FileUtils.createDirectories(propfile.getParent()); // Handling for symlinks.