@@ -28,6 +28,7 @@ public class ObHBaseParams extends ObKVParamsBase {
2828 boolean allowPartialResults = true ; // whether allow partial row return or not
2929 boolean isCacheBlock = false ; // whether enable server block cache and row cache or not
3030 boolean checkExistenceOnly = false ; // check the existence only
31+ String hbaseVersion = "1.3.6" ;
3132
3233 private static final int FLAG_ALLOW_PARTIAL_RESULTS = 1 << 0 ;
3334 private static final int FLAG_IS_CACHE_BLOCK = 1 << 1 ;
@@ -61,6 +62,10 @@ public void setCheckExistenceOnly(boolean checkExistenceOnly) {
6162 this .checkExistenceOnly = checkExistenceOnly ;
6263 }
6364
65+ public void setHbaseVersion (String version ) {
66+ this .hbaseVersion = version ;
67+ }
68+
6469 public int getCaching () {
6570 return caching ;
6671 }
@@ -81,6 +86,10 @@ public boolean isCheckExistenceOnly() {
8186 return checkExistenceOnly ;
8287 }
8388
89+ public String getHbaseVersion () {
90+ return hbaseVersion ;
91+ }
92+
8493 // encode all boolean type to one byte
8594 public byte [] booleansToByteArray () {
8695 byte [] bytes = new byte [1 ]; // 1 byte for 4 booleans
@@ -110,6 +119,9 @@ public byte[] encode() {
110119 idx += Serialization .getNeedBytes (callTimeout );
111120 System .arraycopy (booleansToByteArray (), 0 , bytes , idx , 1 );
112121 idx += 1 ;
122+ System .arraycopy (Serialization .encodeVString (hbaseVersion ), 0 , bytes , idx ,
123+ Serialization .getNeedBytes (hbaseVersion ));
124+ idx += Serialization .getNeedBytes (hbaseVersion );
113125
114126 return bytes ;
115127 }
@@ -125,19 +137,21 @@ public Object decode(ByteBuf buf) {
125137 caching = Serialization .decodeVi32 (buf );
126138 callTimeout = Serialization .decodeVi32 (buf );
127139 byteArrayToBooleans (buf );
140+ hbaseVersion = Serialization .decodeVString (buf );
128141 return this ;
129142 }
130143
131144 public long getPayloadContentSize () {
132145 return 1 + Serialization .getNeedBytes (caching ) + Serialization .getNeedBytes (callTimeout )
133- + 1 ; // all boolean to one byte
146+ + Serialization . getNeedBytes ( hbaseVersion ) + 1 ; // all boolean to one byte
134147 }
135148
136149 public String toString () {
137150 return "ObParams: {\n pType = " + pType + ", \n caching = " + caching
138151 + ", \n callTimeout = " + callTimeout + ", \n allowPartialResult = "
139152 + allowPartialResults + ", \n isCacheBlock = " + isCacheBlock
140- + ", \n checkExistenceOnly = " + checkExistenceOnly + "\n }\n " ;
153+ + ", \n checkExistenceOnly = " + checkExistenceOnly
154+ + ", \n hbaseVersion = " + hbaseVersion + "\n }\n " ;
141155 }
142156
143157}
0 commit comments