HBASE-15104 Occasional failures due to NotServingRegionException in IT tests (Huaxiang Sun)

This commit is contained in:
Jonathan M Hsieh 2016-01-14 07:59:33 -08:00
parent 53fa76bc01
commit b3c5f09ee0
1 changed files with 20 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
import org.apache.hadoop.io.compress.Compressor;
/**
* Action that changes the compression algorithm on a column family from a list of tables.
@ -62,7 +63,25 @@ public class ChangeCompressionAction extends Action {
// Since not every compression algorithm is supported,
// let's use the same algorithm for all column families.
Algorithm algo = possibleAlgos[random.nextInt(possibleAlgos.length)];
// If an unsupported compression algorithm is chosen, pick a different one.
// This is to work around the issue that modifyTable() does not throw remote
// exception.
Algorithm algo;
do {
algo = possibleAlgos[random.nextInt(possibleAlgos.length)];
try {
Compressor c = algo.getCompressor();
// call returnCompressor() to release the Compressor
algo.returnCompressor(c);
break;
} catch (Throwable t) {
LOG.info("Performing action: Changing compression algorithms to " + algo +
" is not supported, pick another one");
}
} while (true);
LOG.debug("Performing action: Changing compression algorithms on "
+ tableName.getNameAsString() + " to " + algo);