@Test public void testUncompressedWal() throws Exception { Configuration conf = new Configuration(false); conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); conf = new Configuration(false); conf.set(IndexManagementUtil.HLOG_READER_IMPL_KEY, IndexedHLogReader.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); }
public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } }
IndexManagementUtil { public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } } }
IndexManagementUtil { public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } } private  IndexManagementUtil(); }
IndexManagementUtil { public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } } private  IndexManagementUtil(); static boolean isWALEditCodecSet(Configuration conf); static void ensureMutableIndexingCorrectlyConfigured(Configuration conf); static ValueGetter createGetterFromKeyValues(Collection<KeyValue> pendingUpdates); static ValueGetter createGetterFromScanner(Scanner scanner, byte[] currentRow); static boolean updateMatchesColumns(Collection<KeyValue> update, List<ColumnReference> columns); static boolean columnMatchesUpdate(List<ColumnReference> columns, Collection<KeyValue> update); static Scan newLocalStateScan(List<? extends Iterable<? extends ColumnReference>> refsArray); static void rethrowIndexingException(Throwable e); static void setIfNotSet(Configuration conf, String key, int value); }
IndexManagementUtil { public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } } private  IndexManagementUtil(); static boolean isWALEditCodecSet(Configuration conf); static void ensureMutableIndexingCorrectlyConfigured(Configuration conf); static ValueGetter createGetterFromKeyValues(Collection<KeyValue> pendingUpdates); static ValueGetter createGetterFromScanner(Scanner scanner, byte[] currentRow); static boolean updateMatchesColumns(Collection<KeyValue> update, List<ColumnReference> columns); static boolean columnMatchesUpdate(List<ColumnReference> columns, Collection<KeyValue> update); static Scan newLocalStateScan(List<? extends Iterable<? extends ColumnReference>> refsArray); static void rethrowIndexingException(Throwable e); static void setIfNotSet(Configuration conf, String key, int value); static final String INDEX_WAL_EDIT_CODEC_CLASS_NAME; static final String HLOG_READER_IMPL_KEY; static final String WAL_EDIT_CODEC_CLASS_KEY; }