gerlowskija commented on code in PR #2239:
URL: https://github.com/apache/solr/pull/2239#discussion_r1478767259


##########
solr/core/src/java/org/apache/solr/core/backup/repository/FilterBackupRepository.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.core.backup.repository;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Collection;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexInput;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.backup.Checksum;
+
+/** Delegates to another {@link BackupRepository}. */
+public class FilterBackupRepository implements BackupRepository {

Review Comment:
   [+1] I really like these "delegating" classes and often wish Solr had them 
for most of its popular extension points.
   
   [-0] Solr and Lucene tend to use "DelegatingFoo" as the naming convention in 
these type of classes. e.g. DelegatingComparator, DelegatingCollector, 
DelegatingClusterStateProvider, etc.  Unless "Filter" in the name here is 
signifying something that I've totally missed (very possible!), perhaps 
consider renaming.



##########
solr/core/src/java/org/apache/solr/core/backup/repository/BackupRepositoryUtil.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.core.backup.repository;
+
+import java.io.IOException;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.util.IOUtils;
+import org.apache.solr.core.DirectoryFactory;
+
+/** Utility methods for {@link BackupRepository}. */
+public class BackupRepositoryUtil {
+
+  /**
+   * Copy a file from a source {@link Directory} to a destination {@link 
Directory} without
+   * verifying the checksum.
+   *
+   * @param sourceDir The source directory hosting the file to be copied.
+   * @param sourceFileName The name of the file to be copied.
+   * @param destDir The destination directory to copy the file to.
+   * @param destFileName The name of the copied file at destination.
+   */
+  public static void copyFileNoChecksum(

Review Comment:
   [0] This doesn't seem too radically different from other methods that live 
on `BackupRepository` itself as "default" interface implementations or static 
methods...is there a particular reason you have this live in a separate 'util' 
class? (Maybe it's easier to test this way?)
   
   I don't have an opinion on where this lives one way or another; I just want 
to make sure I understand how you've got things laid out...



##########
solr/modules/hdfs/src/java/org/apache/solr/hdfs/backup/repository/HdfsBackupRepository.java:
##########
@@ -204,6 +213,17 @@ public void copyIndexFileFrom(
     }
   }
 
+  @Override

Review Comment:
   [-1] It's a downer that this implementation has to live in pretty much every 
BackupRepository implementation.  (Currently I think this is forced by the 
visibility of `shouldVerifyChecksum`, which is read by each individual BR 
implementation)
   
   The BR interface has an `init(NamedList)` method - maybe we could read 
`verifyChecksums` in that base method, and avoid duplicating a bunch of this 
stuff on each implementation?
   
   If it's not possible, fair enough, but it's worth trying before we commit 
this IMO



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to