Beispiel #1
0
 /**
  * Checks if the row is valid according to the query. If a query is done on a specific column and
  * the row does not contain this column the row is considered invalid.
  *
  * @param row The row to check.
  * @return True if the query doesn't have a specific column or a row contains the column used with
  *     the query or False otherwise.
  */
 @Override
 protected boolean isValidRow(Result row) {
   Query localQuery = this.query;
   if (localQuery != null && localQuery.getWord() != null) {
     return row.containsColumn(
         Bytes.toBytesBinary(localQuery.getFamily()), Bytes.toBytesBinary(localQuery.getColumn()));
   }
   return true;
 }
 @Override
 public long getLogPosition(String queueId, String filename) throws ReplicationException {
   try {
     byte[] rowKey = queueIdToRowKey(queueId);
     Get getOffset = new Get(rowKey);
     getOffset.addColumn(CF_QUEUE, Bytes.toBytes(filename));
     Result result = getResultIfOwner(getOffset);
     if (result == null || !result.containsColumn(CF_QUEUE, Bytes.toBytes(filename))) {
       throw new ReplicationException(
           "Could not read empty result while getting log position "
               + "queueId="
               + queueId
               + ", filename="
               + filename);
     }
     return Bytes.toLong(result.getValue(CF_QUEUE, Bytes.toBytes(filename)));
   } catch (IOException e) {
     throw new ReplicationException(
         "Could not get position in log for queueId=" + queueId + ", filename=" + filename);
   }
 }