Exemplo n.º 1
0
 public static boolean matchingValue(final Cell left, final Cell right) {
   return Bytes.equals(
       left.getValueArray(),
       left.getValueOffset(),
       left.getValueLength(),
       right.getValueArray(),
       right.getValueOffset(),
       right.getValueLength());
 }
Exemplo n.º 2
0
 /** @deprecated use MetaTableAccessor methods for interacting with meta layouts */
 @Deprecated
 public static ServerName getServerName(final Result r) {
   Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
   if (cell == null || cell.getValueLength() == 0) return null;
   String hostAndPort =
       Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
   cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER);
   if (cell == null || cell.getValueLength() == 0) return null;
   try {
     return ServerName.valueOf(
         hostAndPort,
         Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
   } catch (IllegalArgumentException e) {
     LOG.error("Ignoring invalid region for server " + hostAndPort + "; cell=" + cell, e);
     return null;
   }
 }
Exemplo n.º 3
0
 public static int copyValueTo(Cell cell, byte[] destination, int destinationOffset) {
   System.arraycopy(
       cell.getValueArray(),
       cell.getValueOffset(),
       destination,
       destinationOffset,
       cell.getValueLength());
   return destinationOffset + cell.getValueLength();
 }
Exemplo n.º 4
0
 /**
  * The latest seqnum that the server writing to meta observed when opening the region. E.g. the
  * seqNum when the result of {@link #getServerName(Result)} was written.
  *
  * @param r Result to pull the seqNum from
  * @return SeqNum, or HConstants.NO_SEQNUM if there's no value written.
  * @deprecated use MetaTableAccessor methods for interacting with meta layouts
  */
 @Deprecated
 public static long getSeqNumDuringOpen(final Result r) {
   Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER);
   if (cell == null || cell.getValueLength() == 0) return HConstants.NO_SEQNUM;
   return Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
 }
Exemplo n.º 5
0
 /**
  * Returns the HRegionInfo object from the column {@link HConstants#CATALOG_FAMILY} and <code>
  * qualifier</code> of the catalog table result.
  *
  * @param r a Result object from the catalog table scan
  * @param qualifier Column family qualifier -- either {@link HConstants#SPLITA_QUALIFIER}, {@link
  *     HConstants#SPLITB_QUALIFIER} or {@link HConstants#REGIONINFO_QUALIFIER}.
  * @return An HRegionInfo instance or null.
  * @deprecated use MetaTableAccessor methods for interacting with meta layouts
  */
 @Deprecated
 public static HRegionInfo getHRegionInfo(final Result r, byte[] qualifier) {
   Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, qualifier);
   if (cell == null) return null;
   return parseFromOrNull(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
 }
Exemplo n.º 6
0
 public static boolean matchingValue(final Cell left, final byte[] buf) {
   return Bytes.equals(
       left.getValueArray(), left.getValueOffset(), left.getValueLength(), buf, 0, buf.length);
 }
Exemplo n.º 7
0
 public static ByteBuffer getValueBufferShallowCopy(Cell cell) {
   ByteBuffer buffer =
       ByteBuffer.wrap(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
   return buffer;
 }