@Override public List<HBaseData> LoadData(HTableInterface hTable, Object rowKey, Filter filter, String... columns) throws IOException { return LoadData(hTable, Bytes.toString(hTable.getTableName()), rowKey, filter, columns); }
@Override protected boolean removeLRU(LinkEntry entry) { HTableInterface table = (HTableInterface) entry.getValue(); if (LOG.isDebugEnabled()) { LOG.debug("Closing connection to table: " + Bytes.toString(table.getTableName()) + " because it was evicted from the cache."); } try { table.close(); } catch (IOException e) { LOG.info("Failed to correctly close HTable: " + Bytes.toString(table.getTableName()) + " ignoring since being removed from queue."); } return true; } }
private static void logMutationSize(HTableInterface htable, List<Mutation> mutations) { long byteSize = 0; int keyValueCount = 0; for (Mutation mutation : mutations) { if (mutation.getFamilyMap() != null) { // Not a Delete of the row for (Entry<byte[], List<KeyValue>> entry : mutation.getFamilyMap().entrySet()) { if (entry.getValue() != null) { for (KeyValue kv : entry.getValue()) { byteSize += kv.getBuffer().length; keyValueCount++; } } } } } logger.debug("Sending " + mutations.size() + " mutations for " + Bytes.toString(htable.getTableName()) + " with " + keyValueCount + " key values of total size " + byteSize + " bytes"); }
/** * Delegates to {@link HTable#getTableName()} */ public byte[] getTableName() { return table.getTableName(); }
@Override public byte[] run(HTableInterface table) throws IOException, InterruptedException { return table.getTableName(); } });
@Override public byte[] getTableName() { return hTable.getTableName(); }
@Override public byte[] getTableName() { return hTable.getTableName(); }
Mockito.when(table.getTableName()).thenReturn(test.getTableName());
Mockito.when(table.getTableName()).thenReturn(test.getTableName());
Mockito.when(table.getTableName()).thenReturn(tableName); final CountDownLatch writeStartedLatch = new CountDownLatch(1);
Mockito.when(table.getTableName()).thenReturn(testName.getTableName());
Mockito.when(table.batch(Mockito.anyList())).thenThrow( new IOException("Intentional IOException for failed first write.")); Mockito.when(table.getTableName()).thenReturn(tableName); final boolean[] failed = new boolean[] { false }; HTableInterface table2 = Mockito.mock(HTableInterface.class); Mockito.when(table2.getTableName()).thenReturn(tableName2); Mockito.when(table2.batch(Mockito.anyList())).thenAnswer(new Answer<Void>() { @Override
public String toString() { return new String(table.getTableName(), UTF_8) + ":" + new String(row, UTF_8) + ":" + new String(family, UTF_8) + ":" + new String(qualifier, UTF_8) + ":" + timestamp; }
@Override public List<HBaseData> LoadData(HTableInterface hTable, Object rowKey, Filter filter, String... columns) throws IOException { return LoadData(hTable, Bytes.toString(hTable.getTableName()), rowKey, filter, columns); }
@Override public List<HBaseData> LoadData(HTableInterface hTable, Object rowKey, Filter filter, String... columns) throws IOException { return LoadData(hTable, Bytes.toString(hTable.getTableName()), rowKey, filter, columns); }
@Override public byte[] getTableName() { checkState(); return table.getTableName(); }
private void addCommit(byte[] row, boolean isDelete, HTableInterface table) throws IOException { Commit commit = commits.get(table.getTableName()); if (commit == null) { commit = new Commit(getTable(table.getTableName())); commits.put(table.getTableName(), commit); } commit.add(row, isDelete); }
private void checkState() { if (!isOpen()) { throw new IllegalStateException("Table=" + new String(table.getTableName()) + " already closed"); } }
private static RuntimeException createException(String errorMessage, IOException e, HTableInterface hTable) { Configuration configuration = hTable.getConfiguration(); String configSettings = Objects.toStringHelper(configuration) .add(HConstants.ZOOKEEPER_QUORUM, configuration.get(HConstants.ZOOKEEPER_QUORUM)) .toString(); final String hTableName = new String(hTable.getTableName()); String format = String.format("%s %s (HTable name %s)", errorMessage, configSettings, hTableName); logger.error(format, e); return new RuntimeIOException(format, e); } }
@Override public long getCellId() { return Hashing.murmur3_128().newHasher() .putBytes(table.getTableName()) .putBytes(row) .putBytes(family) .putBytes(qualifier) .hash().asLong(); }