Determines if an entry exists in storage or not. 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 use for
(final TSDB tsdb,
final String tsuid)
| 434 | * @throws HBaseException if there was an issue fetching |
| 435 | */ |
| 436 | public static Deferred<Boolean> metaExistsInStorage(final TSDB tsdb, |
| 437 | final String tsuid) { |
| 438 | final GetRequest get = new GetRequest(tsdb.metaTable(), |
| 439 | UniqueId.stringToUid(tsuid)); |
| 440 | get.family(FAMILY); |
| 441 | get.qualifier(META_QUALIFIER); |
| 442 | |
| 443 | /** |
| 444 | * Callback from the GetRequest that simply determines if the row is empty |
| 445 | * or not |
| 446 | */ |
| 447 | final class ExistsCB implements Callback<Boolean, ArrayList<KeyValue>> { |
| 448 | |
| 449 | @Override |
| 450 | public Boolean call(ArrayList<KeyValue> row) throws Exception { |
| 451 | if (row == null || row.isEmpty() || row.get(0).value() == null) { |
| 452 | return false; |
| 453 | } |
| 454 | return true; |
| 455 | } |
| 456 | |
| 457 | } |
| 458 | |
| 459 | return tsdb.getClient().get(get).addCallback(new ExistsCB()); |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * Determines if the counter column exists for the TSUID. |