Search in sources :

Example 6 with RegionSpecifier

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier in project hbase by apache.

the class RequestConverter method buildMutateRequest.

/**
   * Create a protocol buffer MutateRequest for a conditioned delete
   *
   * @param regionName
   * @param row
   * @param family
   * @param qualifier
   * @param comparator
   * @param compareType
   * @param delete
   * @return a mutate request
   * @throws IOException
   */
public static MutateRequest buildMutateRequest(final byte[] regionName, final byte[] row, final byte[] family, final byte[] qualifier, final ByteArrayComparable comparator, final CompareType compareType, final Delete delete) throws IOException {
    MutateRequest.Builder builder = MutateRequest.newBuilder();
    RegionSpecifier region = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    Condition condition = buildCondition(row, family, qualifier, comparator, compareType);
    builder.setMutation(ProtobufUtil.toMutation(MutationType.DELETE, delete, MutationProto.newBuilder()));
    builder.setCondition(condition);
    return builder.build();
}
Also used : Condition(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Condition) MutateRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutateRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 7 with RegionSpecifier

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier in project hbase by apache.

the class ProtobufUtil method buildSplitRegionRequest.

/**
    * Create a SplitRegionRequest for a given region name
    *
    * @param regionName the name of the region to split
    * @param splitPoint the split point
    * @return a SplitRegionRequest
    */
public static SplitRegionRequest buildSplitRegionRequest(final byte[] regionName, final byte[] splitPoint) {
    SplitRegionRequest.Builder builder = SplitRegionRequest.newBuilder();
    RegionSpecifier region = RequestConverter.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    if (splitPoint != null) {
        builder.setSplitPoint(UnsafeByteOperations.unsafeWrap(splitPoint));
    }
    return builder.build();
}
Also used : SplitRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SplitRegionRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 8 with RegionSpecifier

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier in project hbase by apache.

the class ProtobufUtil method buildCloseRegionRequest.

public static CloseRegionRequest buildCloseRegionRequest(ServerName server, final byte[] regionName, ServerName destinationServer) {
    CloseRegionRequest.Builder builder = CloseRegionRequest.newBuilder();
    RegionSpecifier region = RequestConverter.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    if (destinationServer != null) {
        builder.setDestinationServer(toServerName(destinationServer));
    }
    if (server != null) {
        builder.setServerStartCode(server.getStartcode());
    }
    return builder.build();
}
Also used : CloseRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 9 with RegionSpecifier

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier in project hbase by apache.

the class RequestConverter method buildMutateRequest.

/**
   * Create a protocol buffer MutateRequest for a conditioned put
   *
   * @param regionName
   * @param row
   * @param family
   * @param qualifier
   * @param comparator
   * @param compareType
   * @param put
   * @return a mutate request
   * @throws IOException
   */
public static MutateRequest buildMutateRequest(final byte[] regionName, final byte[] row, final byte[] family, final byte[] qualifier, final ByteArrayComparable comparator, final CompareType compareType, final Put put) throws IOException {
    MutateRequest.Builder builder = MutateRequest.newBuilder();
    RegionSpecifier region = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    Condition condition = buildCondition(row, family, qualifier, comparator, compareType);
    builder.setMutation(ProtobufUtil.toMutation(MutationType.PUT, put, MutationProto.newBuilder()));
    builder.setCondition(condition);
    return builder.build();
}
Also used : Condition(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Condition) MutateRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutateRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 10 with RegionSpecifier

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier in project hbase by apache.

the class RequestConverter method buildCompactRegionRequest.

/**
  * Create a  CompactRegionRequest for a given region name
  *
  * @param regionName the name of the region to get info
  * @param major indicator if it is a major compaction
  * @return a CompactRegionRequest
  */
public static CompactRegionRequest buildCompactRegionRequest(final byte[] regionName, final boolean major, final byte[] family) {
    CompactRegionRequest.Builder builder = CompactRegionRequest.newBuilder();
    RegionSpecifier region = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    builder.setMajor(major);
    if (family != null) {
        builder.setFamily(UnsafeByteOperations.unsafeWrap(family));
    }
    return builder.build();
}
Also used : CompactRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CompactRegionRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Aggregations

RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)27 MutateRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutateRequest)7 IOException (java.io.IOException)4 Condition (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Condition)3 InterruptedIOException (java.io.InterruptedIOException)2 ArrayList (java.util.ArrayList)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)2 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)2 CloseRegionRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionRequest)2 ClientProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos)2 GetRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.GetRequest)2 ScanRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest)2 RegionLoad (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad)2 Test (org.junit.Test)2 RatioGauge (com.codahale.metrics.RatioGauge)1 MemoryUsage (java.lang.management.MemoryUsage)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1