Skip to content

Commit

Permalink
Issue #164 AsyncHBase compatibility with HBase 1.3.1
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Larsen <[email protected]>
  • Loading branch information
karanmehta93 authored and manolama committed Jun 8, 2017
1 parent ff58e68 commit 80c6b86
Show file tree
Hide file tree
Showing 14 changed files with 588 additions and 45 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ asynchbase_PROTOS := \
protobuf/Tracing.proto \
protobuf/ZooKeeper.proto \
protobuf/HBase.proto \

protobuf/ClusterId.proto \
protobuf/ClusterStatus.proto \
protobuf/FS.proto \
protobuf/MapReduce.proto \

PROTOBUF_GEN_DIR = $(top_builddir)/src/org/hbase/async/generated

BUILT_SOURCES := $(asynchbase_PROTOS:protobuf/%.proto=$(PROTOBUF_GEN_DIR)/%PB.java)
Expand Down
91 changes: 85 additions & 6 deletions protobuf/Client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import "HBase.proto";
import "Filter.proto";
import "Cell.proto";
import "Comparator.proto";
import "MapReduce.proto";

/**
* The protocol buffer version of Authorizations.
Expand All @@ -51,6 +52,14 @@ message Column {
repeated bytes qualifier = 2;
}

/**
* Consistency defines the expected consistency level for an operation.
*/
enum Consistency {
STRONG = 0;
TIMELINE = 1;
}

/**
* The protocol buffer version of Get.
* Unless existence_only is specified, return all the requested data
Expand All @@ -75,6 +84,9 @@ message Get {
// If the row to get doesn't exist, return the
// closest row before.
optional bool closest_row_before = 11 [default = false];

optional Consistency consistency = 12 [default = STRONG];
repeated ColumnFamilyTimeRange cf_time_range = 13;
}

message Result {
Expand All @@ -92,6 +104,15 @@ message Result {
// used for Get to check existence only. Not set if existence_only was not set to true
// in the query.
optional bool exists = 3;

// Whether or not the results are coming from possibly stale data
optional bool stale = 4 [default = false];

// Whether or not the entire result could be returned. Results will be split when
// the RPC chunk size limit is reached. Partial results contain only a subset of the
// cells for a row and must be combined with a result containing the remaining cells
// to form a complete result
optional bool partial = 5 [default = false];
}

/**
Expand Down Expand Up @@ -233,7 +254,10 @@ message Scan {
optional bool load_column_families_on_demand = 13; /* DO NOT add defaults to load_column_families_on_demand. */
optional bool small = 14;
optional bool reversed = 15 [default = false];
optional Consistency consistency = 16 [default = STRONG];
optional uint32 caching = 17;
optional bool allow_partial_results = 18;
repeated ColumnFamilyTimeRange cf_time_range = 19;
}

/**
Expand All @@ -254,6 +278,10 @@ message ScanRequest {
optional uint32 number_of_rows = 4;
optional bool close_scanner = 5;
optional uint64 next_call_seq = 6;
optional bool client_handles_partials = 7;
optional bool client_handles_heartbeats = 8;
optional bool track_scan_metrics = 9;
optional bool renew = 10 [default = false];
}

/**
Expand All @@ -269,13 +297,40 @@ message ScanResponse {
// has 3, 3, 3 in it, then we know that on the client, we are to make
// three Results each of three Cells each.
repeated uint32 cells_per_result = 1;

optional uint64 scanner_id = 2;
optional bool more_results = 3;
optional uint32 ttl = 4;
// If cells are not carried in an accompanying cellblock, then they are pb'd here.
// This field is mutually exclusive with cells_per_result (since the Cells will
// be inside the pb'd Result)
repeated Result results = 5;
optional bool stale = 6;

// This field is filled in if we are doing cellblocks. In the event that a row
// could not fit all of its cells into a single RPC chunk, the results will be
// returned as partials, and reconstructed into a complete result on the client
// side. This field is a list of flags indicating whether or not the result
// that the cells belong to is a partial result. For example, if this field
// has false, false, true in it, then we know that on the client side, we need to
// make another RPC request since the last result was only a partial.
repeated bool partial_flag_per_result = 7;

// A server may choose to limit the number of results returned to the client for
// reasons such as the size in bytes or quantity of results accumulated. This field
// will true when more results exist in the current region.
optional bool more_results_in_region = 8;

// This field is filled in if the server is sending back a heartbeat message.
// Heartbeat messages are sent back to the client to prevent the scanner from
// timing out. Seeing a heartbeat message communicates to the Client that the
// server would have continued to scan had the time limit not been reached.
optional bool heartbeat_message = 9;

// This field is filled in if the client has requested that scan metrics be tracked.
// The metrics tracked here are sent back to the client to be tracked together with
// the existing client side metrics.
optional ScanMetrics scan_metrics = 10;
}

/**
Expand Down Expand Up @@ -338,6 +393,24 @@ message RegionAction {
repeated Action action = 3;
}

/*
* Statistics about the current load on the region
*/
message RegionLoadStats {
// Percent load on the memstore. Guaranteed to be positive, between 0 and 100.
optional int32 memstoreLoad = 1 [default = 0];
// Percent JVM heap occupancy. Guaranteed to be positive, between 0 and 100.
// We can move this to "ServerLoadStats" should we develop them.
optional int32 heapOccupancy = 2 [default = 0];
// Compaction pressure. Guaranteed to be positive, between 0 and 100.
optional int32 compactionPressure = 3 [default = 0];
}

message MultiRegionLoadStats{
repeated RegionSpecifier region = 1;
repeated RegionLoadStats stat = 2;
}

/**
* Either a Result or an Exception NameBytesPair (keyed by
* exception name whose value is the exception stringified)
Expand All @@ -351,6 +424,8 @@ message ResultOrException {
optional NameBytesPair exception = 3;
// result if this was a coprocessor service call
optional CoprocessorServiceResult service_result = 4;
// current load on the region
optional RegionLoadStats loadStats = 5 [deprecated=true];
}

/**
Expand Down Expand Up @@ -379,25 +454,29 @@ message MultiResponse {
repeated RegionActionResult regionActionResult = 1;
// used for mutate to indicate processed only
optional bool processed = 2;
optional MultiRegionLoadStats regionStatistics = 3;
}


service ClientService {
rpc Get(GetRequest)
returns(GetResponse);
returns(GetResponse);

rpc Mutate(MutateRequest)
returns(MutateResponse);
returns(MutateResponse);

rpc Scan(ScanRequest)
returns(ScanResponse);
returns(ScanResponse);

rpc BulkLoadHFile(BulkLoadHFileRequest)
returns(BulkLoadHFileResponse);
returns(BulkLoadHFileResponse);

rpc ExecService(CoprocessorServiceRequest)
returns(CoprocessorServiceResponse);
returns(CoprocessorServiceResponse);

rpc ExecRegionServerService(CoprocessorServiceRequest)
returns(CoprocessorServiceResponse);

rpc Multi(MultiRequest)
returns(MultiResponse);
returns(MultiResponse);
}
33 changes: 33 additions & 0 deletions protobuf/ClusterId.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// This file contains protocol buffers that are shared throughout HBase

option java_package = "org.hbase.async.generated";
option java_outer_classname = "ClusterIdPB";
option java_generate_equals_and_hash = false;
option optimize_for = LITE_RUNTIME;

/**
* Content of the '/hbase/hbaseid', cluster id, znode.
* Also cluster of the ${HBASE_ROOTDIR}/hbase.id file.
*/
message ClusterId {
// This is the cluster id, a uuid as a String
required string cluster_id = 1;
}
Loading

0 comments on commit 80c6b86

Please sign in to comment.