prashantwason commented on a change in pull request #2266:
URL: https://github.com/apache/hudi/pull/2266#discussion_r532815405
##########
File path:
hudi-client/src/main/java/org/apache/hudi/metadata/FSBackedTableMetadataWriter.java
##########
@@ -74,84 +60,109 @@
import org.apache.hudi.exception.HoodieMetadataException;
import org.apache.hudi.metrics.DistributedRegistry;
import org.apache.hudi.table.HoodieTable;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import scala.Tuple2;
+import static
org.apache.hudi.metadata.HoodieTableMetadata.METADATA_TABLE_NAME_SUFFIX;
+import static
org.apache.hudi.metadata.HoodieTableMetadata.NON_PARTITIONED_NAME;
+import static
org.apache.hudi.metadata.HoodieTableMetadata.SOLO_COMMIT_TIMESTAMP;
+
/**
* Writer for Metadata Table.
*
* Partition and file listing are saved within an internal MOR table called
Metadata Table. This table is created
* by listing files and partitions (first time) and kept in sync using the
instants on the main dataset.
*/
-public class HoodieMetadataWriter extends HoodieMetadataReader implements
Serializable {
- private static final Logger LOG =
LogManager.getLogger(HoodieMetadataWriter.class);
+public class FSBackedTableMetadataWriter implements HoodieTableMetadataWriter {
Review comment:
Is FSBased the appropriate name here? FSBased seems to imply that the
metadata is being saved directly on filesystem. But technically we are saving
the metadata in a hoodie table.
##########
File path:
hudi-client/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataWriter.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.hudi.metadata;
+
+import org.apache.hudi.avro.model.HoodieCleanMetadata;
+import org.apache.hudi.avro.model.HoodieCleanerPlan;
+import org.apache.hudi.avro.model.HoodieRestoreMetadata;
+import org.apache.hudi.avro.model.HoodieRollbackMetadata;
+import org.apache.hudi.common.model.HoodieCommitMetadata;
+import org.apache.hudi.config.HoodieWriteConfig;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.spark.api.java.JavaSparkContext;
+
+import java.io.Serializable;
+
+/**
+ * Interface that supports updating metadata for a given table, as actions
complete.
+ */
+public interface HoodieTableMetadataWriter extends Serializable {
+
+ static HoodieTableMetadataWriter create(Configuration conf,
HoodieWriteConfig writeConfig, JavaSparkContext jsc) {
+ return new FSBackedTableMetadataWriter(conf, writeConfig, jsc);
+ }
+
+ void update(JavaSparkContext jsc, HoodieCommitMetadata commitMetadata,
String instantTime);
Review comment:
nit: The jsc parameter here seems unnecessary since the constructor
already takes it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]