@VisibleForTesting void initiateCompactionStrategy(MemoryCompactionPolicy compType, Configuration configuration, String cfName) throws IllegalArgumentIOException { assert (compType !=MemoryCompactionPolicy.NONE); switch (compType){ case BASIC: strategy = new BasicMemStoreCompactionStrategy(configuration, cfName); break; case EAGER: strategy = new EagerMemStoreCompactionStrategy(configuration, cfName); break; case ADAPTIVE: strategy = new AdaptiveMemStoreCompactionStrategy(configuration, cfName); break; default: // sanity check throw new IllegalArgumentIOException("Unknown memory compaction type " + compType); } }
public static void assertIsIllegalArgumentException(final ProcedureInfo result) { assertEquals(true, result.isFailed()); LOG.info(result.getExceptionFullMessage()); Throwable cause = ProcedureTestingUtility.getExceptionCause(result); assertTrue("expected IllegalArgumentIOException, got " + cause, cause instanceof IllegalArgumentIOException); }
protected void updateMetaState(TableName tableName, TableState.State newState) throws IOException { if (tableName.equals(TableName.META_TABLE_NAME)) { if (TableState.State.DISABLING.equals(newState) || TableState.State.DISABLED.equals(newState)) { throw new IllegalArgumentIOException("Cannot disable the meta table; " + newState); } // Otherwise, just return; no need to set ENABLED on meta -- it is always ENABLED. return; } MetaTableAccessor.updateTableState(master.getConnection(), tableName, newState); }
public MemStoreCompactor(CompactingMemStore compactingMemStore, MemoryCompactionPolicy compactionPolicy) throws IllegalArgumentIOException { this.compactingMemStore = compactingMemStore; this.compactionKVMax = compactingMemStore.getConfiguration() .getInt(HConstants.COMPACTION_KV_MAX, HConstants.COMPACTION_KV_MAX_DEFAULT); initiateCompactionStrategy(compactionPolicy, compactingMemStore.getConfiguration(), compactingMemStore.getFamilyName()); }
@VisibleForTesting protected MemStoreCompactor createMemStoreCompactor(MemoryCompactionPolicy compactionPolicy) throws IllegalArgumentIOException { return new MemStoreCompactor(this, compactionPolicy); }
public MyMemStoreCompactor(CompactingMemStore compactingMemStore, MemoryCompactionPolicy compactionPolicy) throws IllegalArgumentIOException { super(compactingMemStore, compactionPolicy); }
@Override protected MemStoreCompactor createMemStoreCompactor(MemoryCompactionPolicy compactionPolicy) throws IllegalArgumentIOException { return new MyMemStoreCompactor(this, compactionPolicy); }
void initiateType(MemoryCompactionPolicy compactionType, Configuration conf) throws IllegalArgumentIOException { compactor.initiateCompactionStrategy(compactionType, conf, "CF_TEST"); }
public static void assertIsIllegalArgumentException(final Procedure<?> result) { Throwable cause = assertProcFailed(result); assertTrue("expected IllegalArgumentIOException, got " + cause, cause instanceof IllegalArgumentIOException); }
/** * Create n splits for one InputSplit, For now only support uniform distribution * @param split A TableSplit corresponding to a range of rowkeys * @param n Number of ranges after splitting. Pass 1 means no split for the range * Pass 2 if you want to split the range in two; * @return A list of TableSplit, the size of the list is n * @throws IllegalArgumentIOException */ protected List<InputSplit> createNInputSplitsUniform(InputSplit split, int n) throws IllegalArgumentIOException { if (split == null || !(split instanceof TableSplit)) { throw new IllegalArgumentIOException( "InputSplit for CreateNSplitsPerRegion can not be null + " + "and should be instance of TableSplit"); } //if n < 1, then still continue using n = 1 n = n < 1 ? 1 : n; List<InputSplit> res = new ArrayList<>(n); if (n == 1) { res.add(split); return res; } // Collect Region related information TableSplit ts = (TableSplit) split; TableName tableName = ts.getTable(); String regionLocation = ts.getRegionLocation(); String encodedRegionName = ts.getEncodedRegionName(); long regionSize = ts.getLength(); byte[] startRow = ts.getStartRow(); byte[] endRow = ts.getEndRow(); // For special case: startRow or endRow is empty if (startRow.length == 0 && endRow.length == 0){ startRow = new byte[1]; endRow = new byte[1]; startRow[0] = 0; endRow[0] = -1; } if (startRow.length == 0 && endRow.length != 0){ startRow = new byte[1]; startRow[0] = 0; } if (startRow.length != 0 && endRow.length == 0){ endRow =new byte[startRow.length]; for (int k = 0; k < startRow.length; k++){ endRow[k] = -1; } } // Split Region into n chunks evenly byte[][] splitKeys = Bytes.split(startRow, endRow, true, n-1); for (int i = 0; i < splitKeys.length - 1; i++) { //notice that the regionSize parameter may be not very accurate TableSplit tsplit = new TableSplit(tableName, scan, splitKeys[i], splitKeys[i + 1], regionLocation, encodedRegionName, regionSize / n); res.add(tsplit); } return res; }