Skip to content
Open
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 @@ -174,6 +174,10 @@ public class LoadTestTool extends AbstractHBaseTool {
protected static final String OPT_REGION_REPLICA_ID_USAGE =
"Region replica id to do the reads from";

public static final String OPT_TIMELINE_CONSISTENCY = "timeline";
protected static final String OPT_TIMELINE_CONSISTENCY_USAGE =
"Use TIMELINE consistency in read operations. Leave region_replica_id unset, otherwise it will override this setting.";

public static final String OPT_MOB_THRESHOLD = "mob_threshold";
protected static final String OPT_MOB_THRESHOLD_USAGE =
"Desired cell size to exceed in bytes that will use the MOB write path";
Expand Down Expand Up @@ -229,6 +233,7 @@ public class LoadTestTool extends AbstractHBaseTool {
private int numRegionsPerServer = DEFAULT_NUM_REGIONS_PER_SERVER;
private int regionReplication = -1; // not set
private int regionReplicaId = -1; // not set
private boolean timelineConsistency = false;

private int mobThreshold = -1; // not set

Expand Down Expand Up @@ -361,6 +366,7 @@ protected void addOptions() {
addOptWithArg(OPT_NUM_REGIONS_PER_SERVER, OPT_NUM_REGIONS_PER_SERVER_USAGE);
addOptWithArg(OPT_REGION_REPLICATION, OPT_REGION_REPLICATION_USAGE);
addOptWithArg(OPT_REGION_REPLICA_ID, OPT_REGION_REPLICA_ID_USAGE);
addOptNoArg(OPT_TIMELINE_CONSISTENCY, OPT_TIMELINE_CONSISTENCY_USAGE);
addOptWithArg(OPT_MOB_THRESHOLD, OPT_MOB_THRESHOLD_USAGE);
}

Expand Down Expand Up @@ -520,6 +526,11 @@ protected void processOptions(CommandLine cmd) {
if (cmd.hasOption(OPT_REGION_REPLICA_ID)) {
regionReplicaId = Integer.parseInt(cmd.getOptionValue(OPT_REGION_REPLICA_ID));
}

timelineConsistency = false;
if (cmd.hasOption(OPT_TIMELINE_CONSISTENCY)) {
timelineConsistency = true;
}
}

private void parseColumnFamilyOptions(CommandLine cmd) {
Expand Down Expand Up @@ -706,6 +717,7 @@ protected int loadTable() throws IOException {
readerThreads.setKeyWindow(keyWindow);
readerThreads.setMultiGetBatchSize(multiGetBatchSize);
readerThreads.setRegionReplicaId(regionReplicaId);
readerThreads.setTimelineConsistency(timelineConsistency);
}

if (isUpdate && isWrite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class MultiThreadedReader extends MultiThreadedAction {
private int keyWindow = DEFAULT_KEY_WINDOW;
private int batchSize = DEFAULT_BATCH_SIZE;
private int regionReplicaId = -1; // particular region replica id to do reads against if set
private boolean timelineConsistency = false;

public MultiThreadedReader(LoadTestDataGenerator dataGen, Configuration conf, TableName tableName,
double verifyPercent) throws IOException {
Expand Down Expand Up @@ -107,6 +108,10 @@ public void setRegionReplicaId(int regionReplicaId) {
this.regionReplicaId = regionReplicaId;
}

public void setTimelineConsistency(boolean timelineConsistency) {
this.timelineConsistency = timelineConsistency;
}

@Override
public void start(long startKey, long endKey, int numThreads) throws IOException {
super.start(startKey, endKey, numThreads);
Expand Down Expand Up @@ -321,6 +326,8 @@ protected Get createGet(long keyToRead) throws IOException {
get = dataGenerator.beforeGet(keyToRead, get);
if (regionReplicaId > 0) {
get.setReplicaId(regionReplicaId);
}
if (timelineConsistency) {
get.setConsistency(Consistency.TIMELINE);
}
if (verbose) {
Expand Down