pudidic commented on code in PR #3444:
URL: https://github.com/apache/hive/pull/3444#discussion_r935269108


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/DumpExporter.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.hadoop.hive.ql.parse.repl.dump;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.ThreadPool;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.*;
+
+public class DumpExporter {

Review Comment:
   The role of DumpExporter isn't to export, which its name implies. It's a 
wrapper of an ExecutorService, which accepts general Runnable objects with the 
configured number of threads with a logger. Exposing 
DumpExporter.submit(Runnable) can lead to unexpected results, especially eating 
up the thread pool with unexpected tasks and delaying the expected ones.
   
   I suggest two design change options;
   1. Call private ExecutorService.submit() in a service only. See 
ScheduledQueryExecutionService and ScheduledQueryExecutor for its pattern. 
Rename DumpExporter as ExportService and move TableExport and PartitionExport 
inside ExportService. Hide the object creation from outside and make method 
call instead.
   2. Publish submit(T) and expose interface T for future extension. See 
JobRequestExecutor and EventualCleanupService for its pattern. Rename 
DumpExporter as ExportExecutor. Introduce a new interface Export and limit 
submit(Export) method parameter type. Let TableExport and PartitionExport to 
implement Export interface. If you can find common methods, you can put them in 
the Export interface.
   
   I prefer the first design as I see there's a small room for future 
extension. Also please add class description.



-- 
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