Skip to content

Metadata sync unified view - #14260

Draft
vamsikarnika wants to merge 27 commits into
apache:release-0.14.0from
vamsikarnika:metadata-sync-unified-view
Draft

vamsikarnika wants to merge 27 commits into
apache:release-0.14.0from
vamsikarnika:metadata-sync-unified-view

Conversation

@vamsikarnika

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Summary and Changelog

Impact

Risk Level

Documentation Update

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@vamsikarnika
vamsikarnika marked this pull request as draft November 13, 2025 15:33
@github-actions github-actions Bot added the size:XL PR with lines of changes > 1000 label Nov 13, 2025
@apache apache deleted a comment from hudi-bot Nov 17, 2025

@nsivabalan nsivabalan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will review the rest once you push all your latest changes


// Records which save the file listing of each partition
engineContext.setJobStatus(this.getClass().getSimpleName(), "Creating records for metadata FILES partition");
boolean enableBasePathForPartitions = dataWriteConfig.shouldEnableBasePathForPartitions();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we have the new sub class, we should try and avoid making any changes to this class.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is still used in the incremental flow.

]
},
{
"name": "basePathForPartition",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets fix this one as well. "basePathOverride"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address them in the next commits

.withPopulateMetaFields(metaClient.getTableConfig().populateMetaFields())
.withEmbeddedTimelineServerEnabled(false)
.withSchema(schema == null ? "" : schema.toString())
.withArchivalConfig(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh for target table, cleaner is a no op right.
So, only archival matters.
lets ensure we take inputs from spark submit command use it.
may be by default, having 120 commits in activetimeline is fine.

@nsivabalan nsivabalan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sharing reviews in 2 latest commits.
yet to review tests.

}

// initialize metadata writer
List<DirectoryInfo> partitionInfoList = listAllPartitionsFromFilesystem(lastInstantTimestamp, sourceBasePath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if metadata table is enabled in the source table, shouldn't we be calling listAllPartitionsFromMDT(...)

@vamsikarnika vamsikarnika Nov 21, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm yet to add this functionality. Couldn't get to this yet.

Option<String> inflightInstantTimestamp) throws IOException {
// Do not initialize the metadata table during metadata sync
metadataMetaClient = initializeMetaClient();
this.metadata = new HoodieBackedTableMetadata(engineContext, dataWriteConfig.getMetadataConfig(), dataWriteConfig.getBasePath(), true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to initialize initMetadataReader() if FILES partition is already bootstrapped?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will get back on this

.reloadActiveTimeline()
.saveAsComplete(new HoodieInstant(true, instant.getAction(), commitTime), commitMetadataInBytes);
}
private void runArchiver(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java docs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need a lock here?
what if two concurrent writer tries to archive the target table concurrently

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Archival Job handles locks internally? Do we need explicitly set the lock? Need to check code. For now. I'll move this code into the synchronized block

@nsivabalan nsivabalan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed most of source code.
will review rest tomorrow.

import java.util.stream.Collectors;
import java.util.stream.Stream;

public class SparkHoodieBackedMetadataSyncMetadataWriter extends SparkHoodieBackedTableMetadataWriter {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java docs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have tests for this class directly?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently. This is covered through FTs though for bootstrap sync

Option.of(triggeringInstantTimestamp));
HoodieTableMetadataWriter metadataWriter;
if (config.shouldEnableBootstrapMetadataSync()) {
metadataWriter = SparkHoodieBackedMetadataSyncMetadataWriter.create(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this change?
we are directly instantiating SparkHoodieBackedMetadataSyncMetadataWriter within HoodieMetadataSync right.
So, why we need these changes.

@vamsikarnika vamsikarnika Nov 25, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we're relying on sparkTable to provide this metadata new writer..

: fullPartitionPathStr.substring(partitionStartIndex + basePath.getName().length() + 1);
}

public static String getRelativePartitionPath(Path fullPartitionPath, int numPartitionPathLevels) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have UTs for this

Option<String> tableSyncMetadataJson = Option.ofNullable(commitMetadata.getMetadata(SyncMetadata.TABLE_SYNC_METADATA));
if (!tableSyncMetadataJson.isPresent()) {
// if table sync metadata is not present, sync all commits from source table
throw new HoodieException("Table sync metadata is missing in the target table commit metadata");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@nsivabalan

Copy link
Copy Markdown
Contributor

@vamsikarnika : have you chased all test failures? how far are we before we can get CI green

@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@voonhous

voonhous commented Nov 7, 2026

Copy link
Copy Markdown
Member

Temporarily closing this PR while we debug a GitHub settings error on master (#20471); it will be reopened shortly, no action needed.

@voonhous voonhous closed this Nov 7, 2026
@voonhous voonhous reopened this Nov 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL PR with lines of changes > 1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants