private IOException logAndCreateIOException(String type, byte[] row, Throwable t) { LOG.error("Encountered exception when executing " + type + ".", t); return new DoNotRetryIOException( makeGenericExceptionMessage( type, options.getProjectId(), tableName.getQualifierAsString(), row), t); }
private IOException logAndCreateIOException(String type, byte[] row, Throwable t) { LOG.error("Encountered exception when executing " + type + ".", t); return new DoNotRetryIOException( makeGenericExceptionMessage( type, options.getProjectId(), tableName.getQualifierAsString(), row), t); }
/** {@inheritDoc} */ @Override public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, long amount) throws IOException { LOG.trace("incrementColumnValue(byte[], byte[], byte[], long)"); try ( Scope scope = TRACER.spanBuilder("BigtableTable.incrementColumnValue").startScopedSpan()) { Increment incr = new Increment(row); incr.addColumn(family, qualifier, amount); Result result = increment(incr); Cell cell = result.getColumnLatestCell(family, qualifier); if (cell == null) { LOG.error("Failed to find a incremented value in result of increment"); throw new IOException( makeGenericExceptionMessage( "increment", options.getProjectId(), tableName.getQualifierAsString(), row)); } return Bytes.toLong(CellUtil.cloneValue(cell)); } }
/** {@inheritDoc} */ @Override public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, long amount) throws IOException { LOG.trace("incrementColumnValue(byte[], byte[], byte[], long)"); try ( Scope scope = TRACER.spanBuilder("BigtableTable.incrementColumnValue").startScopedSpan()) { Increment incr = new Increment(row); incr.addColumn(family, qualifier, amount); Result result = increment(incr); Cell cell = result.getColumnLatestCell(family, qualifier); if (cell == null) { LOG.error("Failed to find a incremented value in result of increment"); throw new IOException( makeGenericExceptionMessage( "increment", options.getProjectId(), tableName.getQualifierAsString(), row)); } return Bytes.toLong(CellUtil.cloneValue(cell)); } }
/** {@inheritDoc} */ @Override public ResultScanner getScanner(Scan scan) throws IOException { LOG.trace("getScanner(Scan)"); Span span = TRACER.spanBuilder("BigtableTable.scan").startSpan(); try (Scope scope = TRACER.withSpan(span)) { com.google.cloud.bigtable.grpc.scanner.ResultScanner<FlatRow> scanner = client.readFlatRows(hbaseAdapter.adapt(scan)); if (hasWhileMatchFilter(scan.getFilter())) { return Adapters.BIGTABLE_WHILE_MATCH_RESULT_RESULT_SCAN_ADAPTER.adapt(scanner, span); } return Adapters.BIGTABLE_RESULT_SCAN_ADAPTER.adapt(scanner, span); } catch (Throwable throwable) { LOG.error("Encountered exception when executing getScanner.", throwable); span.setStatus(Status.UNKNOWN); // Close the span only when throw an exception and not on finally because if no exception // the span will be ended by the adapter. span.end(); throw new IOException( makeGenericExceptionMessage( "getScanner", options.getProjectId(), tableName.getQualifierAsString()), throwable); } }
/** {@inheritDoc} */ @Override public ResultScanner getScanner(Scan scan) throws IOException { LOG.trace("getScanner(Scan)"); Span span = TRACER.spanBuilder("BigtableTable.scan").startSpan(); try (Scope scope = TRACER.withSpan(span)) { com.google.cloud.bigtable.grpc.scanner.ResultScanner<FlatRow> scanner = client.readFlatRows(hbaseAdapter.adapt(scan)); if (hasWhileMatchFilter(scan.getFilter())) { return Adapters.BIGTABLE_WHILE_MATCH_RESULT_RESULT_SCAN_ADAPTER.adapt(scanner, span); } return Adapters.BIGTABLE_RESULT_SCAN_ADAPTER.adapt(scanner, span); } catch (Throwable throwable) { LOG.error("Encountered exception when executing getScanner.", throwable); span.setStatus(Status.UNKNOWN); // Close the span only when throw an exception and not on finally because if no exception // the span will be ended by the adapter. span.end(); throw new IOException( makeGenericExceptionMessage( "getScanner", options.getProjectId(), tableName.getQualifierAsString()), throwable); } }