HBASE-10818. Addendum to reduce the number of times sleep happens in the coprocessor. Also, puts back code to set consistency that got deleted by accident in the last commit.

This commit is contained in:
Devaraj Das 2014-05-24 09:18:31 -07:00 committed by Enis Soztutar
parent e5ec49b123
commit 8e40fa0c41

View File

@ -156,7 +156,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
@Override @Override
public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e, public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
final Scan scan, final RegionScanner s) throws IOException { final Scan scan, final RegionScanner s) throws IOException {
if (countOfOpen.incrementAndGet() % 4 == 0) { //slowdown openScanner randomly if (countOfOpen.incrementAndGet() == 2) { //slowdown openScanner randomly
slowdownCode(e); slowdownCode(e);
} }
return s; return s;
@ -168,7 +168,8 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
final int limit, final boolean hasMore) throws IOException { final int limit, final boolean hasMore) throws IOException {
//this will slow down a certain next operation if the conditions are met. The slowness //this will slow down a certain next operation if the conditions are met. The slowness
//will allow the call to go to a replica //will allow the call to go to a replica
if (countOfNext.incrementAndGet() % 4 == 0) { countOfNext.incrementAndGet();
if (countOfNext.get() == 0 || countOfNext.get() == 4) {
slowdownCode(e); slowdownCode(e);
} }
return true; return true;
@ -655,6 +656,11 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
scan.setCacheBlocks(false); scan.setCacheBlocks(false);
scan.setBatch(1000); scan.setBatch(1000);
int replicaCount = conf.getInt(NUM_REPLICA_COUNT_KEY, NUM_REPLICA_COUNT_DEFAULT);
if (replicaCount != NUM_REPLICA_COUNT_DEFAULT) {
scan.setConsistency(Consistency.TIMELINE);
}
TableMapReduceUtil.initTableMapperJob( TableMapReduceUtil.initTableMapperJob(
Bytes.toBytes(getTablename()), Bytes.toBytes(getTablename()),
scan, scan,