/** @return The count of operations throwing exceptions. */ public long errors() { return errors_ctr.get(); }
/** * Deletes data from HBase. * @param request The {@code delete} request. * @return A deferred object that indicates the completion of the request. * The {@link Object} has not special meaning and can be {@code null} * (think of it as {@code Deferred<Void>}). But you probably want to attach * at least an errback to this {@code Deferred} to handle failures. */ public Deferred<Object> delete(final DeleteRequest request) { num_deletes.increment(); return sendRpcToRegion(request); }
/** * Stores data in HBase. * <p> * Note that this provides no guarantee as to the order in which subsequent * {@code put} requests are going to be applied to the backend. If you need * ordering, you must enforce it manually yourself by starting the next * {@code put} once the {@link Deferred} of this one completes successfully. * @param request The {@code put} request. * @return A deferred object that indicates the completion of the request. * The {@link Object} has no special meaning and can be {@code null} * (think of it as {@code Deferred<Void>}). But you probably want to attach * at least an errback to this {@code Deferred} to handle failures. * TODO(tsuna): Document failures clients are expected to handle themselves. */ public Deferred<Object> put(final PutRequest request) { num_puts.increment(); return sendRpcToRegion(request); }
/** @return The successfully deleted doc counter value. */ public long deleted() { return deleted_ctr.get(); }
/** * Retrieves data from HBase. * @param request The {@code get} request. * @return A deferred list of key-values that matched the get request. */ public Deferred<ArrayList<KeyValue>> get(final GetRequest request) { num_gets.increment(); return sendRpcToRegion(request).addCallbacks(got, Callback.PASSTHROUGH); }
/** @return The successfully indexed doc counter value. */ public long added() { return added_ctr.get(); }
/** * Atomically and durably increments a few values in HBase. * <p> * This is equivalent to * {@link #atomicIncrement(AtomicIncrementRequest, boolean) atomicIncrement} * {@code (request, true)} * @param request The increment request. * @return The deferred {@code long} value that results from the increment. */ public Deferred<Map<byte[], Long>> atomicIncrement(final MultiColumnAtomicIncrementRequest request) { num_atomic_increments.increment(); return sendRpcToRegion(request).addCallbacks(micv_done, Callback.PASSTHROUGH); }
/** @return The successfully deleted doc counter value. */ public long deleted() { return deleted_ctr.get(); }
/** * Atomically and durably increments a value in HBase. * <p> * This is equivalent to * {@link #atomicIncrement(AtomicIncrementRequest, boolean) atomicIncrement} * {@code (request, true)} * @param request The increment request. * @return The deferred {@code long} value that results from the increment. */ public Deferred<Long> atomicIncrement(final AtomicIncrementRequest request) { num_atomic_increments.increment(); return sendRpcToRegion(request).addCallbacks(icv_done, Callback.PASSTHROUGH); }
/** @return The successfully indexed doc counter value. */ public long added() { return added_ctr.get(); }
/** * Appends data to (or creates) one or more columns in HBase. * <p> * Note that this provides no guarantee as to the order in which subsequent * {@code append} requests are going to be applied to the column(s). If you * need ordering, you must enforce it manually yourself by starting the next * {@code append} once the {@link Deferred} of this one completes successfully. * @param request The {@code append} request. * @return A deferred object that indicates the completion of the request and * may contain data from the column(s). * The {@link Object} has not special meaning and can be {@code null} * (think of it as {@code Deferred<Void>}). But you probably want to attach * at least an errback to this {@code Deferred} to handle failures. */ public Deferred<Object> append(final AppendRequest request) { num_appends.increment(); return sendRpcToRegion(request).addCallback(APPEND_CB); }
/** @return The successfully indexed doc counter value. */ public long added() { return added_ctr.get(); }
/** * Overloaded openScanner to enable direct passing in of the HBaseRpc * @param scanner The scanner to open. * @param open_req The OpenScannerRequest that will be sent by the scanner. * @return A deferred scanner ID (long) if HBase 0.94 and before, or a * deferred {@link Scanner.Response} if HBase 0.95 and up. */ Deferred<Object> openScanner(final Scanner scanner, final HBaseRpc open_req){ num_scanners_opened.increment(); HBaseRpc req = open_req; return sendRpcToRegion(req).addCallbacks( scanner_opened, new Callback<Object, Object>() { public Object call(final Object error) { // Don't let the scanner think it's opened on this region. scanner.invalidate(); return error; // Let the error propagate. } public String toString() { return "openScanner errback"; } }); }
/** @return The successfully deleted doc counter value. */ public long deleted() { return deleted_ctr.get(); }
/** * Acquires an explicit row lock. * <p> * For a description of what row locks are, see {@link RowLock}. * @param request The request specify which row to lock. * @return a deferred {@link RowLock}. * @see #unlockRow */ public Deferred<RowLock> lockRow(final RowLockRequest request) { num_row_locks.increment(); return sendRpcToRegion(request).addCallbacks( new Callback<RowLock, Object>() { public RowLock call(final Object response) { if (response instanceof Long) { return new RowLock(request.getRegion().name(), (Long) response); } else { throw new InvalidResponseException(Long.class, response); } } public String toString() { return "type lockRow response"; } }, Callback.PASSTHROUGH); }
/** @return The count of operations throwing exceptions. */ public long errors() { return errors_ctr.get(); }
queries_executed.increment(); return result;
/** @return The count of operations throwing exceptions. */ public long errors() { return errors_ctr.get(); }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { idle_connections_closed.increment(); LOG.info("Closing idle connection to HBase region server: " + e.getChannel()); // RegionClientPipeline's disconnect method will handle cleaning up // any outstanding RPCs and removing the client from caches try { e.getChannel().close(); } catch (Exception ex) { // This handler may be called after a channel has entered an odd state // or already been closed. If it has been closed properly, then ignore // the exception, otherwise throw it. if (!(ex instanceof ClosedChannelException)) { throw ex; } } } } }
/** * Returns how many lookups in {@code .META.} were performed (uncontended). * <p> * This number indicates how many times we had to lookup in {@code .META.} * where a key was located. This only counts "uncontended" lookups, where * the thread was able to acquire a "permit" to do a {@code .META.} lookup. * The majority of the {@code .META.} lookups should fall in this category. * @since 1.1 * @deprecated This method will be removed in release 2.0. Use * {@link #stats}{@code * .}{@link ClientStats#uncontendedMetaLookups uncontendedMetaLookups()} * instead. */ @Deprecated public long uncontendedMetaLookupCount() { return meta_lookups_with_permit.get(); }