dsmiley commented on code in PR #1739:
URL: https://github.com/apache/solr/pull/1739#discussion_r1341874503


##########
solr/core/src/java/org/apache/solr/core/backup/BackupProperties.java:
##########
@@ -93,10 +108,25 @@ public static BackupProperties readFrom(
                 repository.openInput(backupPath, fileName, IOContext.DEFAULT)),
             StandardCharsets.UTF_8)) {
       props.load(is);
-      return new BackupProperties(props);
+      Map<String, String> extraProperties = extractExtraProperties(props);
+      return new BackupProperties(props, extraProperties);
     }
   }
 
+  private static Map<String, String> extractExtraProperties(Properties props) {
+    Map<String, String> extraProperties = new HashMap<>();
+    props.forEach(
+        (key, value) -> {
+          String entryKey = key.toString();
+          if (entryKey.startsWith(EXTRA_PROPERTY_PREFIX)) {
+            extraProperties.put(
+                entryKey.substring(EXTRA_PROPERTY_PREFIX.length()), 
String.valueOf(value));
+            props.remove(key);

Review Comment:
   I don't think you can iterate & remove in the same loop -- 
ConcurrentModificationException ?



##########
solr/core/src/java/org/apache/solr/core/backup/BackupProperties.java:
##########
@@ -128,10 +158,14 @@ private String getKeyForShardBackupId(String shardName) {
   }
 
   public void store(Writer propsWriter) throws IOException {
-    properties.put("indexSizeMB", String.valueOf(indexSizeMB));
-    properties.put("indexFileCount", String.valueOf(indexFileCount));
-    properties.put(BackupManager.END_TIME_PROP, Instant.now().toString());
-    properties.store(propsWriter, "Backup properties file");
+    Properties propertiesCopy = (Properties) properties.clone();

Review Comment:
   nice; it was sketchy previously, modifying the field properties here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to