Siyao Meng created HDDS-17934:
---------------------------------

             Summary: Snapshot local data YAML size grows quadratically with 
the snapshot chain after incremental defrag
                 Key: HDDS-17934
                 URL: https://issues.apache.org/jira/browse/HDDS-17934
             Project: Apache Ozone
          Issue Type: Bug
          Components: Ozone Manager, Snapshot
            Reporter: Siyao Meng


With snapshot defrag enabled, a test that created about 41.6K snapshots in one 
bucket ran out of OM metadata disk. Most of the space went to the snapshot 
local data YAMLs under {{db.snapshots/checkpointState}}, not to snapshot SST 
data.

||OM||Snapshots defragged||Disk used||YAML||Everything else||
|OM 1|all|1,755 GB|945 GB|810 GB|
|OM 2|all|1,703 GB|852 GB|851 GB|
|OM 3 (leader)|about 65%|1,141 GB|288 GB|853 GB|

On the fully defragged OMs, a YAML averages 20 to 23 MB, and the largest is 44 
MB. Unique snapshot SST data is 743 GB on OM 1, so the YAMLs take more space 
than the data they describe. Usage outside the YAMLs is about the same on all 
three OMs, so defrag accounts for the whole difference.

h3. Cause

# Incremental defrag builds a snapshot's new version from a checkpoint of the 
previous snapshot's defragged DB, then ingests the delta and non-incremental 
table SSTs. Nothing compacts that DB afterwards, so its SST count carries 
forward and grows along the chain. In a sample of snapshots, the count of the 
current version went from about 6.6K near the start of the chain to about 79K 
near the end, roughly 2 more per snapshot. The original checkpoint (version 0) 
had about 16K.
# Each entry in {{versionSstFileInfos}} lists every SST with {{fileName}}, 
{{startKey}}, {{endKey}} and {{columnFamily}}, about 0.5 KB per file. A YAML 
keeps version 0, the current version, and any version the next snapshot still 
references. The largest YAML holds 15.9K + 81K + 79K entries.

Because each YAML grows with its position in the chain, total YAML size is 
quadratic in the snapshot count. At 65,500 snapshots, the YAMLs alone would be 
about 2.3 TB. Each defragged snapshot directory also holds up to about 79K 
hardlinks.

HDDS-17078, HDDS-17079 and HDDS-17098 made reading large YAMLs cheaper at OM 
startup, but they don't reduce their size on disk.

h3. Possible directions

* Bound the SST count of a defragged snapshot, for example by compacting the 
defrag checkpoint once it passes a threshold, or by running a full defrag 
periodically along the chain.
* Make the YAML compact, for example by storing each version's SST list as a 
delta against {{previousSnapshotVersion}}, or by leaving out key ranges that 
aren't needed.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to