sundapeng opened a new pull request, #9712:
URL: https://github.com/apache/paimon/pull/9712

   ### Purpose
   
   Two partitions of a catalog-managed Format Table can end up registered at 
custom locations in the same tree, one an ancestor of the other. Reading such a 
table is refused on purpose: a scan cannot tell which partition owns the files. 
Unregistering one of the two is the way out, but `DROP PARTITION` resolves its 
targets from one validated view of the whole registry, so it is refused for the 
same reason and the table stays stuck with no repair that does not go around 
the catalog.
   
   A drop unregisters partitions and deletes default-location directories; a 
custom location is never probed or deleted. What could make it unsafe is a 
location that names a directory the drop deletes, and that is a property of a 
single partition: a custom location inside the table directory is already 
invalid on its own. Two partitions claiming each other's data elsewhere cannot 
change what a drop removes.
   
   So the drop path validates every partition individually - a complete spec, 
and a location that parses and stays out of the table directory - instead of 
also requiring the registry to be internally consistent. 
`FormatTablePartitionRegistryValidator` gains `validateEachPartitionLocation` 
for that; reads, commits and `ANALYZE` keep the strict check.
   
   ### Tests
   
   - `FormatTablePartitionRegistryValidatorTest`: a pair of partitions claiming 
each other's data is rejected when they are compared and accepted when each is 
validated on its own; an invalid location and an incomplete spec are rejected 
either way.
   - `FormatTablePartitionManagementTest`: dropping one of two partitions whose 
custom locations overlap unregisters it and touches neither external directory. 
The existing case where a custom location owns the target's default directory 
still fails, because that location is invalid by itself.
   - `FormatTableCommitTest`, `FormatTableCommitRegistryValidationTest`, 
`CatalogManagedPartitionScanTest`, `FormatTablePartitionPathResolverTest`, 
`FormatTablePartitionDdlPlanningTest`
   


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