예제 #1
0
  /**
   * Locate the right sibling for this index partition.
   *
   * <p>Note: default key/val serializers are used.
   *
   * @return The locator for the right sibling -or- <code>null</code> if no right sibling could be
   *     found (which is an error).
   * @todo This does not have to be a batch lookup any more. It could use the {@link
   *     ClientIndexView} class.
   */
  private PartitionLocator getRightSiblingLocator(
      final String scaleOutIndexName, final long lastCommitTime) {

    final BatchLookup op =
        BatchLookupConstructor.INSTANCE.newInstance(
            0 /* fromIndex */,
            1 /* toIndex */,
            new byte[][] {vmd.pmd.getRightSeparatorKey()},
            null /* vals */);

    final ResultBuffer resultBuffer;
    try {

      resultBuffer =
          (ResultBuffer)
              resourceManager
                  .getFederation()
                  .getMetadataService()
                  .submit(
                      TimestampUtility.asHistoricalRead(lastCommitTime),
                      MetadataService.getMetadataIndexName(scaleOutIndexName),
                      op)
                  .get();

    } catch (Exception e) {

      log.error("Could not locate rightSiblings: index=" + scaleOutIndexName, e);

      return null;
    }

    // the locator for the rightSibling.
    return (PartitionLocator) SerializerUtil.deserialize(resultBuffer.getValues().get(0));
  }
예제 #2
0
  /** @param vmd The {@link ViewMetadata} for the index partition. */
  public CompactingMergeTask(final ViewMetadata vmd) {

    super(vmd.resourceManager, TimestampUtility.asHistoricalRead(vmd.commitTime), vmd.name);

    this.vmd = vmd;
  }