adiranjan25 commented on issue #19194:
URL: https://github.com/apache/iceberg/issues/19194#issuecomment-7269374421

   Further update: I have traced the main snapshot reset to the interaction 
between the replacement transaction and WAP-specific snapshot handling.
   
   The relevant execution path is:
   
   1. `SparkCatalog.stageReplace()` creates a replacement transaction.
   2. `TableMetadata.buildReplacement()` explicitly calls 
`.removeRef(SnapshotRef.MAIN_BRANCH)`.
   3. `TableMetadata.Builder.removeRef()` resets `currentSnapshotId` to `-1` 
when removing the main reference.
   4. `SparkWrite.commitOperation()` subsequently either stages the snapshot 
using `stageOnly()` for WAP ID or routes the write using `toBranch()` for WAP 
branch.
   5. `StagedSparkTable.commitStagedChanges()` commits the replacement 
transaction without restoring the main snapshot.
   
   This explains the consistent regression failures across Hive, Hadoop and 
SparkSessionCatalog.
   
   I would avoid changing the core replacement metadata behavior because 
removing the main reference is part of normal table replacement semantics.
   
   My proposed initial approach is to explicitly reject RTAS and replacement 
operations when WAP is active, before committing replacement metadata.
   
   Supporting fully isolated RTAS under WAP appears to require broader design 
considerations because replacement operations can also modify table-wide 
schema, partition specifications, sort order, location and properties.
   
   Would maintainers prefer explicit validation for this unsupported 
combination, or should we pursue fully isolated replacement semantics?
   
   I am happy to implement the agreed approach and extend regression coverage 
across the supported Spark versions.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to