codope commented on code in PR #12098:
URL: https://github.com/apache/hudi/pull/12098#discussion_r1800457330
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/BaseActionExecutor.java:
##########
@@ -132,4 +145,22 @@ protected final void
writeTableMetadata(HoodieRestoreMetadata metadata) {
}
}
}
+
+ /**
+ * Drop indexes information, for e.g., restore operation.
+ */
+ protected final void dropIndexInfo() {
+ StoragePath metadataTableBasePath =
+
HoodieTableMetadata.getMetadataTableBasePath(table.getMetaClient().getBasePath());
+ List<String> partitionPaths = FSUtils.getAllPartitionPaths(context,
table.getStorage(), metadataTableBasePath, false);
+ for (String partitionPath : partitionPaths) {
+ if (FUNCTIONAL_INDEX !=
MetadataPartitionType.fromPartitionPath(partitionPath)
+ && SECONDARY_INDEX !=
MetadataPartitionType.fromPartitionPath(partitionPath)) {
+ HoodieTableMetadataUtil.deleteMetadataTablePartition(
+ table.getMetaClient(), context, partitionPath, true);
+ } else {
+ // Delete records in functional and secondary indexes, but keep the
definitions.
Review Comment:
we can get the index definition from metaClient.getIndexMetadata()
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/BaseActionExecutor.java:
##########
@@ -61,11 +70,15 @@ public BaseActionExecutor(HoodieEngineContext context,
HoodieWriteConfig config,
*
* @param metadata commit metadata of interest.
*/
- protected final void writeTableMetadata(HoodieCommitMetadata metadata,
HoodieData<WriteStatus> writeStatus, String actionType) {
+ protected final void writeTableMetadata(HoodieCommitMetadata metadata,
HoodieData<WriteStatus> writeStatus, String operationType) {
Option<HoodieTableMetadataWriter> metadataWriterOpt =
table.getMetadataWriter(instantTime);
if (metadataWriterOpt.isPresent()) {
try (HoodieTableMetadataWriter metadataWriter = metadataWriterOpt.get())
{
- metadataWriter.updateFromWriteStatuses(metadata, writeStatus,
instantTime);
+ if (operationType.equals("restore")) {
Review Comment:
i believe there is an enum for this action.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/BaseActionExecutor.java:
##########
@@ -132,4 +145,22 @@ protected final void
writeTableMetadata(HoodieRestoreMetadata metadata) {
}
}
}
+
+ /**
+ * Drop indexes information, for e.g., restore operation.
+ */
+ protected final void dropIndexInfo() {
+ StoragePath metadataTableBasePath =
+
HoodieTableMetadata.getMetadataTableBasePath(table.getMetaClient().getBasePath());
+ List<String> partitionPaths = FSUtils.getAllPartitionPaths(context,
table.getStorage(), metadataTableBasePath, false);
+ for (String partitionPath : partitionPaths) {
+ if (FUNCTIONAL_INDEX !=
MetadataPartitionType.fromPartitionPath(partitionPath)
+ && SECONDARY_INDEX !=
MetadataPartitionType.fromPartitionPath(partitionPath)) {
+ HoodieTableMetadataUtil.deleteMetadataTablePartition(
Review Comment:
Does this also clear the configs?
--
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]