rahil-c opened a new pull request, #20205:
URL: https://github.com/apache/hudi/pull/20205

   ### Describe the issue this Pull Request addresses
   
   closes #20204
   
   When the only completed commit of a table is an empty commit written with a 
null writer schema (for example a Hudi Streamer sync with no input), 
`HoodieTableMetadataUtil#tryResolveSchemaForTable` throws 
`HoodieSchemaNotFoundException`, so every later record index update fails with 
`Failed to generate RLI records for metadata table` and the table can no longer 
be written.
   
   ### Summary and Changelog
   
   `tryResolveSchemaForTable` now returns `Option.empty()` when the table has 
completed commits but no schema can be resolved, the same result it already 
gives for a table with no completed commit. Its callers already handle the 
empty case, and other failures to read the schema are still rethrown. Record 
index generation now fails fast if it has to read log files without a schema, 
so deletes in log files can never be dropped from the index silently.
   
   - `HoodieTableMetadataUtil#tryResolveSchemaForTable`: return empty on 
`HoodieSchemaNotFoundException`.
   - `BaseRecordIndexer#convertMetadataToRecordIndexRecords`: throw when no 
schema is resolved and the commit wrote log files.
   - `TestMetadataUtilRLIandSIRecordGeneration`: on a MOR table with the record 
index, commits an empty upsert with the null schema, then an insert, an update 
and a delete, and checks the record index per key. It runs with streaming 
metadata writes on and off; with them off it fails without the fix on the 
`HoodieSchemaNotFoundException` above.
   - `TestRecordIndexer`: covers the log file check.
   
   ### Impact
   
   A table whose first commit is empty and schemaless can be written again. No 
API or config change.
   
   ### Risk Level
   
   low. Only the schema-not-found case changes, and it now behaves like the 
existing no-commit case.
   
   ### 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