Skip to content

Commit

Permalink
Filter columns in CompactionReservationCheck
Browse files Browse the repository at this point in the history
Only load required columns for check to avoid reading unnecessary data
into memory

Closes apache#5254
  • Loading branch information
cshannon committed Feb 8, 2025
1 parent bf0d160 commit b51d81e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean i

if (source.hasTop()) {
var tabletMetadata = TabletMetadata.convertRow(new IteratorAdapter(source),
EnumSet.allOf(TabletMetadata.ColumnType.class), false, false);
EnumSet.copyOf(colsToRead), false, false);

// TODO checking the prev end row here is redundant w/ other checks that ample currently
// does.. however we could try to make all checks eventually use this class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
*/
package org.apache.accumulo.manager.compaction.coordinator;

import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.ECOMP;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.OPID;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.SELECTED;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.USER_COMPACTION_REQUESTED;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
Expand All @@ -28,6 +35,7 @@
import org.apache.accumulo.core.fate.FateId;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.schema.TabletMetadata;
import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType;
import org.apache.accumulo.core.metadata.schema.TabletMetadataCheck;
import org.apache.accumulo.core.spi.compaction.CompactionKind;
import org.apache.accumulo.core.util.time.SteadyTime;
Expand Down Expand Up @@ -153,4 +161,9 @@ public boolean canUpdate(TabletMetadata tablet) {

return true;
}

@Override
public Set<ColumnType> columnsToRead() {
return Set.of(PREV_ROW, OPID, SELECTED, FILES, ECOMP, USER_COMPACTION_REQUESTED);
}
}

0 comments on commit b51d81e

Please sign in to comment.