mirror of https://github.com/apache/lucene.git
SOLR-9522: Improve error handling in ZKPropertiesWriter
This commit is contained in:
parent
8352ff21cd
commit
f728a646f3
|
@ -102,6 +102,8 @@ Bug Fixes
|
||||||
* SOLR-9507: CoreContainer threads now correctly set their MDC logging values
|
* SOLR-9507: CoreContainer threads now correctly set their MDC logging values
|
||||||
(Alan Woodward)
|
(Alan Woodward)
|
||||||
|
|
||||||
|
* SOLR-9522: Improve error handling in ZKPropertiesWriter (Varun Thacker)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -44,14 +44,12 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
|
||||||
@Override
|
@Override
|
||||||
public void init(DataImporter dataImporter, Map<String, String> params) {
|
public void init(DataImporter dataImporter, Map<String, String> params) {
|
||||||
super.init(dataImporter, params);
|
super.init(dataImporter, params);
|
||||||
zkClient = dataImporter.getCore().getCoreDescriptor().getCoreContainer()
|
zkClient = dataImporter.getCore().getCoreDescriptor().getCoreContainer().getZkController().getZkClient();
|
||||||
.getZkController().getZkClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void findDirectory(DataImporter dataImporter, Map<String, String> params) {
|
protected void findDirectory(DataImporter dataImporter, Map<String, String> params) {
|
||||||
String collection = dataImporter.getCore().getCoreDescriptor()
|
String collection = dataImporter.getCore().getCoreDescriptor().getCloudDescriptor().getCollectionName();
|
||||||
.getCloudDescriptor().getCollectionName();
|
|
||||||
path = "/configs/" + collection + "/" + filename;
|
path = "/configs/" + collection + "/" + filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +72,9 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
|
||||||
} catch (NodeExistsException e) {}
|
} catch (NodeExistsException e) {}
|
||||||
}
|
}
|
||||||
zkClient.setData(path, bytes, false);
|
zkClient.setData(path, bytes, false);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
log.warn(
|
|
||||||
"Could not persist properties to " + path + " :" + e.getClass(), e);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn(
|
SolrZkClient.checkInterrupted(e);
|
||||||
"Could not persist properties to " + path + " :" + e.getClass(), e);
|
log.warn("Could not persist properties to " + path + " :" + e.getClass(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,13 +82,13 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
|
||||||
public Map<String, Object> readIndexerProperties() {
|
public Map<String, Object> readIndexerProperties() {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
try {
|
try {
|
||||||
byte[] data = zkClient.getData(path, null, null, false);
|
byte[] data = zkClient.getData(path, null, null, true);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
props.load(new StringReader(new String(data, StandardCharsets.UTF_8)));
|
props.load(new StringReader(new String(data, StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn(
|
SolrZkClient.checkInterrupted(e);
|
||||||
"Could not read DIH properties from " + path + " :" + e.getClass(), e);
|
log.warn("Could not read DIH properties from " + path + " :" + e.getClass(), e);
|
||||||
}
|
}
|
||||||
return propertiesToMap(props);
|
return propertiesToMap(props);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue