Skip to content

Enhance /tableConfigs/validate endpoint with cluster-aware validations#16675

Open
rseetham wants to merge 1 commit intoapache:masterfrom
rseetham:cluster-aware-validation
Open

Enhance /tableConfigs/validate endpoint with cluster-aware validations#16675
rseetham wants to merge 1 commit intoapache:masterfrom
rseetham:cluster-aware-validation

Conversation

@rseetham
Copy link
Contributor

@rseetham rseetham commented Aug 23, 2025

Description

This enhances the /tableConfigs/validate endpoint to include cluster-aware validations that were previously only performed during table creation.

Currently, some validation errors (like "Failed to find instances with tag: X") only show up in logs during table creation, which makes debugging harder. This change moves those validations to the validation endpoint so you get immediate feedback.

Changes

  • Added new validation types: TENANT, MINION_INSTANCES, ACTIVE_TASKS
  • Enhanced /tableConfigs/validate to check cluster state by default
  • Added tenant/minion instance validation
  • Support skipping validations via validationTypesToSkip parameter
  • Added unit tests for the new functionality

This enables fail-fast validation and better error visibility during development.

Deployed locally and tested

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.20%. Comparing base (c52aa38) to head (201ef9a).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #16675      +/-   ##
============================================
- Coverage     63.21%   63.20%   -0.01%     
  Complexity     1454     1454              
============================================
  Files          3179     3179              
  Lines        191069   191322     +253     
  Branches      29220    29269      +49     
============================================
+ Hits         120786   120934     +148     
- Misses        60860    60942      +82     
- Partials       9423     9446      +23     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.18% <100.00%> (+0.01%) ⬆️
java-21 63.17% <100.00%> (+<0.01%) ⬆️
temurin 63.20% <100.00%> (-0.01%) ⬇️
unittests 63.20% <100.00%> (-0.01%) ⬇️
unittests1 55.58% <100.00%> (-0.03%) ⬇️
unittests2 34.12% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

TableConfigs tableConfigs = tableConfigsAndUnrecognizedProps.getLeft();
String databaseName = DatabaseUtils.extractDatabaseFromHttpHeaders(httpHeaders);
validateConfig(tableConfigs, databaseName, typesToSkip);
validateConfig(tableConfigs, databaseName, SKIP_CLUSTER_VALIDATIONS);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we hardcode this, users will not be able to pass typesToSkip. We should avoid this change or have a logic to add SKIP_CLUSTER_VALIDATIONS into typesToSkip before making the call.
IMO we should keep it as is and let it do validation twice.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Comment on lines 537 to 539
Set<TableConfigUtils.ValidationType> skipTypes = typesToSkip == null ? Collections.emptySet()
: Arrays.stream(typesToSkip.split(",")).map(s -> TableConfigUtils.ValidationType.valueOf(s.toUpperCase()))
.collect(Collectors.toSet());
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls use the TableConfigsUtil method for this, we can make that public.

.collect(Collectors.toSet());

// Cluster-aware validations
if (!skipTypes.contains(TableConfigUtils.ValidationType.ALL)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not add these new validations in TableConfigUtils.validate method itself?

TableConfigs tableConfigs = tableConfigsAndUnrecognizedProps.getLeft();
String databaseName = DatabaseUtils.extractDatabaseFromHttpHeaders(httpHeaders);
validateConfig(tableConfigs, databaseName, typesToSkip);
validateConfig(tableConfigs, databaseName, SKIP_CLUSTER_VALIDATIONS);
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

public static final Logger LOGGER = LoggerFactory.getLogger(TableConfigsRestletResource.class);

// Skip cluster validations during table creation/update since they're performed in the actual table operations
private static final String SKIP_CLUSTER_VALIDATIONS = "TENANT,MINION_INSTANCES,ACTIVE_TASKS";
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls update API param swagger documentation if including above more types.

@rseetham rseetham force-pushed the cluster-aware-validation branch from 6752e37 to 5c7df7b Compare February 25, 2026 06:08
@rseetham rseetham requested a review from noob-se7en February 25, 2026 06:11
@rseetham rseetham force-pushed the cluster-aware-validation branch 2 times, most recently from c3006a4 to 0d96668 Compare February 26, 2026 01:20
@rseetham rseetham force-pushed the cluster-aware-validation branch from 0d96668 to 201ef9a Compare February 26, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants