|
19 | 19 | import java.util.List; |
20 | 20 | import java.util.Map; |
21 | 21 |
|
| 22 | +import com.stumbleupon.async.DeferredGroupException; |
| 23 | +import net.opentsdb.utils.Exceptions; |
22 | 24 | import org.slf4j.Logger; |
23 | 25 | import org.slf4j.LoggerFactory; |
24 | 26 |
|
@@ -353,7 +355,7 @@ static String getValue(final TSDB tsdb, final byte[] row, |
353 | 355 | * Extracts the value ID of the given tag UD name from the given row key. |
354 | 356 | * @param tsdb The TSDB instance to use for UniqueId lookups. |
355 | 357 | * @param row The row key in which to search the tag name. |
356 | | - * @param name The name of the tag to search in the row key. |
| 358 | + * @param tag_id The name of the tag to search in the row key. |
357 | 359 | * @return The value ID associated with the given tag ID, or null if this |
358 | 360 | * tag ID isn't present in this row key. |
359 | 361 | */ |
@@ -404,7 +406,14 @@ static Map<String, String> getTags(final TSDB tsdb, |
404 | 406 | final byte[] row) throws NoSuchUniqueId { |
405 | 407 | try { |
406 | 408 | return getTagsAsync(tsdb, row).joinUninterruptibly(); |
407 | | - } catch (RuntimeException e) { |
| 409 | + } catch (DeferredGroupException e) { |
| 410 | + final Throwable ex = Exceptions.getCause(e); |
| 411 | + if (ex instanceof NoSuchUniqueId) { |
| 412 | + throw (NoSuchUniqueId)ex; |
| 413 | + } |
| 414 | + |
| 415 | + throw new RuntimeException("Should never be here", e); |
| 416 | + } catch (RuntimeException e) { |
408 | 417 | throw e; |
409 | 418 | } catch (Exception e) { |
410 | 419 | throw new RuntimeException("Should never be here", e); |
@@ -734,6 +743,14 @@ public static HashMap<String, String> resolveIds(final TSDB tsdb, |
734 | 743 | return resolveIdsAsync(tsdb, tags).joinUninterruptibly(); |
735 | 744 | } catch (NoSuchUniqueId e) { |
736 | 745 | throw e; |
| 746 | + } catch (DeferredGroupException e) { |
| 747 | + final Throwable ex = Exceptions.getCause(e); |
| 748 | + if (ex instanceof NoSuchUniqueId) { |
| 749 | + throw (NoSuchUniqueId)ex; |
| 750 | + } |
| 751 | + // TODO process e.results() |
| 752 | + |
| 753 | + throw new RuntimeException("Shouldn't be here", e); |
737 | 754 | } catch (Exception e) { |
738 | 755 | throw new RuntimeException("Shouldn't be here", e); |
739 | 756 | } |
|
0 commit comments