wg1026688210 opened a new issue, #1245:
URL: https://github.com/apache/incubator-paimon/issues/1245

   ### Search before asking
   
   - [X] I searched in the 
[issues](https://github.com/apache/incubator-paimon/issues) and found nothing 
similar.
   
   
   ### Motivation
   
   Due to the current limitation of manifest supporting partial merging, Some 
Delete type  ManifestEntrys cannot be applied to the ADD type  ManifestEntrys, 
resulting in the problem of data inflation in the ManifestEntry of the Paimon 
table. 
   
   This issue will  discuss the introduction of fullCompaction mechanism for  
manifest to solve this problem.
   
   ### Solution
   
   We divide the Manifest File into two layers: Base and Delta .
   ### The logic of Dividing layers
   
![image](https://github.com/apache/incubator-paimon/assets/14267759/d15c8f7c-c99e-4a35-b41d-ad21f75af897)
   
   Assuming the target size for merging is 8MB.Firstly, we sequentially 
traverse the Manifest file List. When we find the first Manifest that contains 
a Delete Entry or has a file size smaller than the target size, this Manifest 
and all the following Manifests belong to the Delta layer, while the Manifests 
before this one belong to the Base layer.
   
   
![image](https://github.com/apache/incubator-paimon/assets/14267759/2dc67c2f-3d4e-437b-9abf-bc7df96d436e)
   
   In this picture, we will see that :
   
   - Base  (indicated by the orange box in the figure):  Include the Manifest 
file (hereinafter  `target ADD` ) only contains ADD type ManifestEntry, and the 
size of file is larger than the target size  , which don't need to be merged if 
there is no DELETE Entry to apply .
   
   - Delta (indicated by the red box in the figure):  Include the Manifest file 
only contains ADD type ManifestEntry which file size is smaller than the target 
size or the file container DELETE  type  ManifestEntry ,also possibly include 
the the `target ADD`.
   
   ### Apply  DELETE  To The Base Lay
   
   
![image](https://github.com/apache/incubator-paimon/assets/14267759/8b1ff349-6ac1-4eb9-b1be-c94de49b62cf)
   
   
   Firstly, we merge the Delta layer to reduce the file size of the Base layer. 
The remaining DELETE Entries after merging are the effective DELETE. Then, we 
calculate which partitions are affected by the DELETE. Next, we traverse the 
Base layer and find the first Manifest file that contains the affected 
partition. All the following Manifest files are split into a new layer called 
Base', which needs to be merged with the Delta layer to eliminate all DELETE 
files. The Base files other than the file of Base' will not participate in this 
FullCompaction process.
   
   
![image](https://github.com/apache/incubator-paimon/assets/14267759/9b5a8291-4ff1-4e84-8803-f47f3843b891)
   
   
   
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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