@@ -1560,39 +1560,42 @@ func (p *compactionPickerByScore) addScoresToPickedCompactionMetrics(
1560
1560
// the criteria, it chooses whichever file has the lowest LargestSeqNum. The
1561
1561
// lowest LargestSeqNum file will be the first eligible for an elision-only
1562
1562
// compaction once snapshots less than or equal to its LargestSeqNum are closed.
1563
- var elisionOnlyAnnotator = manifest.NewTableAnnotator [manifest.TableMetadata ](manifest.PickFileAggregator {
1564
- Filter : func (f * manifest.TableMetadata ) (eligible bool , cacheOK bool ) {
1565
- if f .IsCompacting () {
1566
- return false , true
1567
- }
1563
+ var elisionOnlyAnnotator = manifest .MakePickFileAnnotator (
1564
+ manifest .NewTableAnnotationIdx (),
1565
+ manifest.PickFileAnnotatorFuncs {
1566
+ Filter : func (f * manifest.TableMetadata ) (eligible bool , cacheOK bool ) {
1567
+ if f .IsCompacting () {
1568
+ return false , true
1569
+ }
1568
1570
1569
- backingProps , backingPropsValid := f .TableBacking .Properties ()
1570
- stats , statsValid := f .Stats ()
1571
- if ! backingPropsValid || ! statsValid {
1572
- return false , false
1573
- }
1571
+ backingProps , backingPropsValid := f .TableBacking .Properties ()
1572
+ stats , statsValid := f .Stats ()
1573
+ if ! backingPropsValid || ! statsValid {
1574
+ return false , false
1575
+ }
1574
1576
1575
- // Bottommost files are large and not worthwhile to compact just
1576
- // to remove a few tombstones. Consider a file eligible only if
1577
- // either its own range deletions delete at least 10% of its data or
1578
- // its deletion tombstones make at least 10% of its entries.
1579
- //
1580
- // TODO(jackson): This does not account for duplicate user keys
1581
- // which may be collapsed. Ideally, we would have 'obsolete keys'
1582
- // statistics that would include tombstones, the keys that are
1583
- // dropped by tombstones and duplicated user keys. See #847.
1584
- //
1585
- // Note that tables that contain exclusively range keys (i.e. no point keys,
1586
- // `NumEntries` and `RangeDeletionsBytesEstimate` are both zero) are excluded
1587
- // from elision-only compactions.
1588
- // TODO(travers): Consider an alternative heuristic for elision of range-keys.
1589
- eligible = stats .RangeDeletionsBytesEstimate * 10 >= f .Size || backingProps .NumDeletions * 10 > backingProps .NumEntries
1590
- return eligible , true
1591
- },
1592
- Compare : func (f1 * manifest.TableMetadata , f2 * manifest.TableMetadata ) bool {
1593
- return f1 .LargestSeqNum < f2 .LargestSeqNum
1577
+ // Bottommost files are large and not worthwhile to compact just
1578
+ // to remove a few tombstones. Consider a file eligible only if
1579
+ // either its own range deletions delete at least 10% of its data or
1580
+ // its deletion tombstones make at least 10% of its entries.
1581
+ //
1582
+ // TODO(jackson): This does not account for duplicate user keys
1583
+ // which may be collapsed. Ideally, we would have 'obsolete keys'
1584
+ // statistics that would include tombstones, the keys that are
1585
+ // dropped by tombstones and duplicated user keys. See #847.
1586
+ //
1587
+ // Note that tables that contain exclusively range keys (i.e. no point keys,
1588
+ // `NumEntries` and `RangeDeletionsBytesEstimate` are both zero) are excluded
1589
+ // from elision-only compactions.
1590
+ // TODO(travers): Consider an alternative heuristic for elision of range-keys.
1591
+ eligible = stats .RangeDeletionsBytesEstimate * 10 >= f .Size || backingProps .NumDeletions * 10 > backingProps .NumEntries
1592
+ return eligible , true
1593
+ },
1594
+ Compare : func (f1 * manifest.TableMetadata , f2 * manifest.TableMetadata ) bool {
1595
+ return f1 .LargestSeqNum < f2 .LargestSeqNum
1596
+ },
1594
1597
},
1595
- } )
1598
+ )
1596
1599
1597
1600
// pickedCompactionFromCandidateFile creates a pickedCompaction from a *fileMetadata
1598
1601
// with various checks to ensure that the file still exists in the expected level
0 commit comments