Determines if the counter column exists for the TSUID. This is used by the UID Manager tool to determine if we need to write a new TSUID entry or not. It will not attempt to verify if the stored data is valid, just checks to see if something is stored in the proper column. @param tsdb The TSDB to us
(final TSDB tsdb,
final byte[] tsuid)
| 470 | * @throws HBaseException if there was an issue fetching |
| 471 | */ |
| 472 | public static Deferred<Boolean> counterExistsInStorage(final TSDB tsdb, |
| 473 | final byte[] tsuid) { |
| 474 | final GetRequest get = new GetRequest(tsdb.metaTable(), tsuid); |
| 475 | get.family(FAMILY); |
| 476 | get.qualifier(COUNTER_QUALIFIER); |
| 477 | |
| 478 | /** |
| 479 | * Callback from the GetRequest that simply determines if the row is empty |
| 480 | * or not |
| 481 | */ |
| 482 | final class ExistsCB implements Callback<Boolean, ArrayList<KeyValue>> { |
| 483 | |
| 484 | @Override |
| 485 | public Boolean call(ArrayList<KeyValue> row) throws Exception { |
| 486 | if (row == null || row.isEmpty() || row.get(0).value() == null) { |
| 487 | return false; |
| 488 | } |
| 489 | return true; |
| 490 | } |
| 491 | |
| 492 | } |
| 493 | |
| 494 | return tsdb.getClient().get(get).addCallback(new ExistsCB()); |
| 495 | } |
| 496 | |
| 497 | /** |
| 498 | * Increments the tsuid datapoint counter or creates a new counter. Also |