Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.regionserver;

import java.io.IOException;
import org.apache.hadoop.hbase.KeepDeletedCells;
import org.apache.hadoop.hbase.client.ImmutableScan;
import org.apache.hadoop.hbase.client.Scan;
Expand All @@ -39,6 +38,8 @@ public class CustomizedScanInfoBuilder implements ScanOptions {

private Integer minVersions;

private long timeToPurgeDeletes;

private final Scan scan;

public CustomizedScanInfoBuilder(ScanInfo scanInfo) {
Expand Down Expand Up @@ -76,7 +77,8 @@ public ScanInfo build() {
if (maxVersions == null && ttl == null && keepDeletedCells == null) {
return scanInfo;
}
return scanInfo.customize(getMaxVersions(), getTTL(), getKeepDeletedCells(), getMinVersions());
return scanInfo.customize(getMaxVersions(), getTTL(), getKeepDeletedCells(), getMinVersions(),
getTimeToPurgeDeletes());
}

@Override
Expand Down Expand Up @@ -105,6 +107,16 @@ public void setMinVersions(int minVersions) {
this.minVersions = minVersions;
}

@Override
public long getTimeToPurgeDeletes() {
return timeToPurgeDeletes;
}

@Override
public void setTimeToPurgeDeletes(long ttl) {
this.timeToPurgeDeletes = ttl;
}

@Override
public Scan getScan() {
return scan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ public boolean isNewVersionBehavior() {
}

/**
* Used for CP users for customizing max versions, ttl and keepDeletedCells.
* Used by CP users for customizing max versions, ttl and keepDeletedCells.
*/
ScanInfo customize(int maxVersions, long ttl, KeepDeletedCells keepDeletedCells) {
return customize(maxVersions, ttl, keepDeletedCells, minVersions);
return customize(maxVersions, ttl, keepDeletedCells, minVersions, timeToPurgeDeletes);
}

/**
* Used by CP users for customizing max versions, ttl, keepDeletedCells, min versions,
* and time to purge deletes.
*/
ScanInfo customize(int maxVersions, long ttl, KeepDeletedCells keepDeletedCells,
int minVersions) {
int minVersions, long timeToPurgeDeletes) {
return new ScanInfo(family, minVersions, maxVersions, ttl, keepDeletedCells, timeToPurgeDeletes,
comparator, tableMaxRowSize, usePread, cellsPerTimeoutCheck, parallelSeekEnabled,
preadMaxBytes, newVersionBehavior);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ default void readAllVersions() {

void setMinVersions(int minVersions);

long getTimeToPurgeDeletes();

void setTimeToPurgeDeletes(long ttl);

/**
* Returns a copy of the Scan object. Modifying it will have no effect.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ private void setScanOptions(ScanOptions options) {
options.setMinVersions(TestRegionCoprocessorHost.MIN_VERSIONS);
options.setKeepDeletedCells(KeepDeletedCells.TRUE);
options.setTTL(TestRegionCoprocessorHost.TTL);
options.setTimeToPurgeDeletes(TestRegionCoprocessorHost.TIME_TO_PURGE_DELETES);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class TestRegionCoprocessorHost {
public static final int MAX_VERSIONS = 3;
public static final int MIN_VERSIONS = 2;
public static final int TTL = 1000;
public static final int TIME_TO_PURGE_DELETES = 2000;

@Before
public void setup() throws IOException {
Expand Down Expand Up @@ -203,6 +204,7 @@ private void verifyScanInfo(ScanInfo newScanInfo) {
assertEquals(MAX_VERSIONS, newScanInfo.getMaxVersions());
assertEquals(MIN_VERSIONS, newScanInfo.getMinVersions());
assertEquals(TTL, newScanInfo.getTtl());
assertEquals(TIME_TO_PURGE_DELETES, newScanInfo.getTimeToPurgeDeletes());
}

private ScanInfo getScanInfo() {
Expand Down