Davis-Zhang-Onehouse opened a new pull request, #19717:
URL: https://github.com/apache/hudi/pull/19717

   ### Describe the issue this Pull Request addresses
   
   closes #19716
   
   An indexing action for one of several uninitialized secondary (or 
expression) indexes built nothing, yet completed and marked the requested 
partition complete in `hoodie.table.metadata.partitions`: 
`buildMetadataPartitions` reduced the plan's partition path to a type, and the 
indexer inferred which partition to build from every uninitialized definition 
of that type, skipping the type when that was not exactly one.
   
   ### Summary and Changelog
   
   - `IndexInitializationContext` carries the partition an indexing action 
asked for (empty for a regular write; the five-argument `of` is kept).
   - `BaseIndexer.resolvePartitionsToInit` resolves it once for both 
`SecondaryIndexer` and `ExpressionIndexer`: the requested partition when its 
definition exists; otherwise the single uninitialized definition, which is also 
where a first-time index mints its definition from the write config; and when a 
requested partition cannot be resolved that way the action fails instead of 
completing with nothing built.
   - `buildMetadataPartitions` records one requested path per type (all a plan 
can carry, since each initialization needs its own instant) and threads it 
through `initializeFromFilesystem` and `initializeMetadataPartition`.
   - 
`TestHoodieIndexer.testIndexerBuildsTheRequestedSecondaryIndexWhenSeveralAreUninitialized`
 registers two definitions and indexes one. Without the fix it fails on 
`metadataPartitionExists` (the table config lists the index, storage has no 
partition); with it the partition has file slices and the other index is 
untouched.
   
   ### Impact
   
   No public API change. Indexing actions on tables with several uninitialized 
definition-driven indexes now build the requested index. Regular writes, 
`HoodieIndexer` and `CREATE INDEX` for a first-time index behave as before.
   
   ### Risk Level
   
   low. The regular-write path passes an empty request and is unchanged; 
`TestHoodieIndexer` passes in full locally.
   
   ### Documentation Update
   
   None.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


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

Reply via email to