diff --git hbase-common/pom.xml hbase-common/pom.xml
index 5b43553..da9eb6b 100644
--- hbase-common/pom.xml
+++ hbase-common/pom.xml
@@ -84,7 +84,6 @@
run
-
generate
generate-sources
@@ -93,7 +92,7 @@
-
+
diff --git hbase-common/src/saveVersion.sh hbase-common/src/saveVersion.sh
index 890dc5a..771c282 100644
--- hbase-common/src/saveVersion.sh
+++ hbase-common/src/saveVersion.sh
@@ -23,6 +23,7 @@ unset LC_CTYPE
version=$1
outputDirectory=$2
+cppOutputDirectory=$3
pushd .
cd ..
@@ -65,3 +66,26 @@ cat >"$outputDirectory/org/apache/hadoop/hbase/package-info.java" <"$cppOutputDirectory/utils/version.h" <&1 > /dev/null && pwd && popd 2>&1 > /dev/null)
BASE_DIR=$(pushd "${BIN_DIR}/../" 2>&1 > /dev/null && pwd && popd 2>&1 > /dev/null)
+# TODO: this is wrong. These should be called from BUCK, but I could not find a
+# way to execute scripts in BUCK that are in under bin/.
${BIN_DIR}/copy-protobuf.sh
+${BIN_DIR}/copy-version.sh
# Go into the base dir. This just makes things cleaner.
pushd ${BASE_DIR}
diff --git hbase-native-client/serde/BUCK hbase-native-client/serde/BUCK
index c6809a8..38e7b4d 100644
--- hbase-native-client/serde/BUCK
+++ hbase-native-client/serde/BUCK
@@ -31,10 +31,7 @@ cxx_library(
"rpc.cc",
"zk.cc",
],
- deps=[
- "//if:if",
- "//third-party:folly",
- ],
+ deps=["//if:if", "//third-party:folly", "//utils:utils"],
tests=[
":client-deserializer-test",
":client-serializer-test",
diff --git hbase-native-client/serde/rpc.cc hbase-native-client/serde/rpc.cc
index d5bca62..e657a64 100644
--- hbase-native-client/serde/rpc.cc
+++ hbase-native-client/serde/rpc.cc
@@ -19,16 +19,18 @@
#include "serde/rpc.h"
+#include
#include
#include
#include
#include
#include
+#include
#include
-#include "if/HBase.pb.h"
#include "if/RPC.pb.h"
+#include "utils/version.h"
using namespace hbase;
@@ -111,12 +113,38 @@ unique_ptr RpcSerde::Header(const string &user) {
// TODO: send the service name and user from the RpcClient
h.set_service_name(INTERFACE);
+ std::unique_ptr version_info = CreateVersionInfo();
+
+ h.set_allocated_version_info(version_info.release());
+
if (codec_ != nullptr) {
h.set_cell_block_codec_class(codec_->java_class_name());
}
return PrependLength(SerializeMessage(h));
}
+std::unique_ptr RpcSerde::CreateVersionInfo() {
+ std::unique_ptr version_info = std::make_unique();
+ version_info->set_user(Version::user);
+ version_info->set_revision(Version::revision);
+ version_info->set_url(Version::url);
+ version_info->set_date(Version::date);
+ version_info->set_src_checksum(Version::src_checksum);
+ version_info->set_version(Version::version);
+
+ std::string version{Version::version};
+ std::vector version_parts;
+ boost::split(version_parts, version, boost::is_any_of("."), boost::token_compress_on);
+ uint32_t major_version = 0, minor_version = 0;
+ if (version_parts.size() >= 2) {
+ version_info->set_version_major(folly::to(version_parts[0]));
+ version_info->set_version_minor(folly::to(version_parts[1]));
+ }
+
+ VLOG(1) << "Client VersionInfo:" << version_info->ShortDebugString();
+ return version_info;
+}
+
unique_ptr RpcSerde::Request(const uint32_t call_id, const string &method,
const Message *msg) {
pb::RequestHeader rq;
diff --git hbase-native-client/serde/rpc.h hbase-native-client/serde/rpc.h
index c59f903..abebe94 100644
--- hbase-native-client/serde/rpc.h
+++ hbase-native-client/serde/rpc.h
@@ -21,6 +21,7 @@
#include
#include
+#include "if/HBase.pb.h"
#include "serde/cell-scanner.h"
#include "serde/codec.h"
@@ -120,5 +121,6 @@ class RpcSerde {
/* data */
uint8_t auth_type_;
std::shared_ptr codec_;
+ std::unique_ptr CreateVersionInfo();
};
} // namespace hbase
diff --git hbase-native-client/utils/BUCK hbase-native-client/utils/BUCK
index 120331a..796f2f5 100644
--- hbase-native-client/utils/BUCK
+++ hbase-native-client/utils/BUCK
@@ -17,7 +17,7 @@
cxx_library(
name="utils",
- exported_headers=["user-util.h",],
+ exported_headers=["user-util.h", "version.h"],
srcs=["user-util.cc",],
deps=['//third-party:folly',],
tests=[":user-util-test"],