hbase git commit: HBASE-18875 Thrift server supports read-only mode - addendum fixes compilation of TestThriftHBaseServiceHandlerWithReadOnly

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 9a940be13 -> 1af5bf110


HBASE-18875 Thrift server supports read-only mode - addendum fixes compilation 
of TestThriftHBaseServiceHandlerWithReadOnly


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1af5bf11
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1af5bf11
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1af5bf11

Branch: refs/heads/branch-1.4
Commit: 1af5bf110544e369c8da50404862a6e527008e62
Parents: 9a940be
Author: tedyu 
Authored: Mon Sep 25 18:42:27 2017 -0700
Committer: tedyu 
Committed: Mon Sep 25 18:42:27 2017 -0700

--
 .../hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/1af5bf11/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
--
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
index d9a6c3c..bc7bea3 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
@@ -85,7 +85,7 @@ public class TestThriftHBaseServiceHandlerWithReadOnly {
 UTIL.getConfiguration().setBoolean("hbase.thrift.readonly", true);
 UTIL.getConfiguration().set("hbase.client.retries.number", "3");
 UTIL.startMiniCluster();
-Admin admin = UTIL.getAdmin();
+Admin admin = UTIL.getHBaseAdmin();
 HTableDescriptor tableDescriptor = new 
HTableDescriptor(TableName.valueOf(tableAname));
 for (HColumnDescriptor family : families) {
   tableDescriptor.addFamily(family);
@@ -464,4 +464,4 @@ public class TestThriftHBaseServiceHandlerWithReadOnly {
   assertFalse(exceptionCaught);
 }
   }
-}
\ No newline at end of file
+}



hbase git commit: HBASE-18875 Thrift server supports read-only mode - addendum fixes compilation of TestThriftHBaseServiceHandlerWithReadOnly

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1 9485835e5 -> d6d62a546


HBASE-18875 Thrift server supports read-only mode - addendum fixes compilation 
of TestThriftHBaseServiceHandlerWithReadOnly


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d6d62a54
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d6d62a54
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d6d62a54

Branch: refs/heads/branch-1
Commit: d6d62a546724672acaff71b5acc4c687a4df119e
Parents: 9485835
Author: tedyu 
Authored: Mon Sep 25 18:41:55 2017 -0700
Committer: tedyu 
Committed: Mon Sep 25 18:41:55 2017 -0700

--
 .../hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/d6d62a54/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
--
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
index d9a6c3c..bc7bea3 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithReadOnly.java
@@ -85,7 +85,7 @@ public class TestThriftHBaseServiceHandlerWithReadOnly {
 UTIL.getConfiguration().setBoolean("hbase.thrift.readonly", true);
 UTIL.getConfiguration().set("hbase.client.retries.number", "3");
 UTIL.startMiniCluster();
-Admin admin = UTIL.getAdmin();
+Admin admin = UTIL.getHBaseAdmin();
 HTableDescriptor tableDescriptor = new 
HTableDescriptor(TableName.valueOf(tableAname));
 for (HColumnDescriptor family : families) {
   tableDescriptor.addFamily(family);
@@ -464,4 +464,4 @@ public class TestThriftHBaseServiceHandlerWithReadOnly {
   assertFalse(exceptionCaught);
 }
   }
-}
\ No newline at end of file
+}



hbase git commit: HBASE-18875 Thrift server supports read-only mode

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 e6e7ae4aa -> 9a940be13


HBASE-18875 Thrift server supports read-only mode

Signed-off-by: tedyu 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9a940be1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9a940be1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9a940be1

Branch: refs/heads/branch-1.4
Commit: 9a940be1339bfed35721daaccaa65d15f00c75d9
Parents: e6e7ae4
Author: Guangxu Cheng 
Authored: Tue Sep 26 08:33:00 2017 +0800
Committer: tedyu 
Committed: Mon Sep 25 18:05:07 2017 -0700

--
 .../thrift2/ThriftHBaseServiceHandler.java  |  27 +-
 .../hadoop/hbase/thrift2/ThriftServer.java  |  10 +
 ...stThriftHBaseServiceHandlerWithReadOnly.java | 467 +++
 3 files changed, 503 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/9a940be1/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
--
diff --git 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index b508a1f..185cd39 100644
--- 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -49,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.client.RegionLocator;
@@ -94,6 +95,10 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   static final String CLEANUP_INTERVAL = 
"hbase.thrift.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.thrift.connection.max-idletime";
 
+  private static final IOException ioe
+  = new DoNotRetryIOException("Thrift Server is in Read-only mode.");
+  private boolean isReadOnly;
+
   public static THBaseService.Iface newInstance(
   THBaseService.Iface handler, ThriftMetrics metrics) {
 return (THBaseService.Iface) 
Proxy.newProxyInstance(handler.getClass().getClassLoader(),
@@ -174,6 +179,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
 connectionCache = new ConnectionCache(
   conf, userProvider, cleanInterval, maxIdleTime);
+isReadOnly = conf.getBoolean("hbase.thrift.readonly", false);
   }
 
   private Table getTable(ByteBuffer tableName) {
@@ -294,6 +300,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void put(ByteBuffer table, TPut put) throws TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putFromThrift(put));
@@ -307,6 +314,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer 
family,
   ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   return htable.checkAndPut(byteBufferToByteArray(row), 
byteBufferToByteArray(family),
@@ -321,6 +329,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void putMultiple(ByteBuffer table, List puts) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putsFromThrift(puts));
@@ -333,6 +342,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void deleteSingle(ByteBuffer table, TDelete deleteSingle) throws 
TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deleteFromThrift(deleteSingle));
@@ -346,6 +356,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public List deleteMultiple(ByteBuffer table, List deletes) 
throws TIOError,
   TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deletesFromThrift(deletes));
@@ -361,6 +372,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   public boolean 

hbase git commit: HBASE-18875 Thrift server supports read-only mode

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1 d74bdc310 -> 9485835e5


HBASE-18875 Thrift server supports read-only mode

Signed-off-by: tedyu 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9485835e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9485835e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9485835e

Branch: refs/heads/branch-1
Commit: 9485835e555d4d8e317e10af780a3cd520931053
Parents: d74bdc3
Author: Guangxu Cheng 
Authored: Tue Sep 26 08:33:00 2017 +0800
Committer: tedyu 
Committed: Mon Sep 25 18:04:38 2017 -0700

--
 .../thrift2/ThriftHBaseServiceHandler.java  |  27 +-
 .../hadoop/hbase/thrift2/ThriftServer.java  |  10 +
 ...stThriftHBaseServiceHandlerWithReadOnly.java | 467 +++
 3 files changed, 503 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/9485835e/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
--
diff --git 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index b508a1f..185cd39 100644
--- 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -49,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.client.RegionLocator;
@@ -94,6 +95,10 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   static final String CLEANUP_INTERVAL = 
"hbase.thrift.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.thrift.connection.max-idletime";
 
+  private static final IOException ioe
+  = new DoNotRetryIOException("Thrift Server is in Read-only mode.");
+  private boolean isReadOnly;
+
   public static THBaseService.Iface newInstance(
   THBaseService.Iface handler, ThriftMetrics metrics) {
 return (THBaseService.Iface) 
Proxy.newProxyInstance(handler.getClass().getClassLoader(),
@@ -174,6 +179,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
 connectionCache = new ConnectionCache(
   conf, userProvider, cleanInterval, maxIdleTime);
+isReadOnly = conf.getBoolean("hbase.thrift.readonly", false);
   }
 
   private Table getTable(ByteBuffer tableName) {
@@ -294,6 +300,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void put(ByteBuffer table, TPut put) throws TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putFromThrift(put));
@@ -307,6 +314,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer 
family,
   ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   return htable.checkAndPut(byteBufferToByteArray(row), 
byteBufferToByteArray(family),
@@ -321,6 +329,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void putMultiple(ByteBuffer table, List puts) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putsFromThrift(puts));
@@ -333,6 +342,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void deleteSingle(ByteBuffer table, TDelete deleteSingle) throws 
TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deleteFromThrift(deleteSingle));
@@ -346,6 +356,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public List deleteMultiple(ByteBuffer table, List deletes) 
throws TIOError,
   TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deletesFromThrift(deletes));
@@ -361,6 +372,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   public boolean 

hbase git commit: HBASE-18875 Thrift server supports read-only mode

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-2 ad60bc5f6 -> bb81e9f3c


HBASE-18875 Thrift server supports read-only mode

Signed-off-by: tedyu 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bb81e9f3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bb81e9f3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bb81e9f3

Branch: refs/heads/branch-2
Commit: bb81e9f3ca669bc17b20e3157f2728309b4a3f3a
Parents: ad60bc5
Author: Guangxu Cheng 
Authored: Tue Sep 26 00:29:24 2017 +0800
Committer: tedyu 
Committed: Mon Sep 25 15:11:23 2017 -0700

--
 .../thrift2/ThriftHBaseServiceHandler.java  |  27 +-
 .../hadoop/hbase/thrift2/ThriftServer.java  |  10 +
 ...stThriftHBaseServiceHandlerWithReadOnly.java | 467 +++
 3 files changed, 503 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/bb81e9f3/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
--
diff --git 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index 031d093..b34241c 100644
--- 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -49,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.RegionLocator;
@@ -94,6 +95,10 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   static final String CLEANUP_INTERVAL = 
"hbase.thrift.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.thrift.connection.max-idletime";
 
+  private static final IOException ioe
+  = new DoNotRetryIOException("Thrift Server is in Read-only mode.");
+  private boolean isReadOnly;
+
   public static THBaseService.Iface newInstance(
   THBaseService.Iface handler, ThriftMetrics metrics) {
 return (THBaseService.Iface) 
Proxy.newProxyInstance(handler.getClass().getClassLoader(),
@@ -174,6 +179,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
 connectionCache = new ConnectionCache(
   conf, userProvider, cleanInterval, maxIdleTime);
+isReadOnly = conf.getBoolean("hbase.thrift.readonly", false);
   }
 
   private Table getTable(ByteBuffer tableName) {
@@ -294,6 +300,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void put(ByteBuffer table, TPut put) throws TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putFromThrift(put));
@@ -307,6 +314,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer 
family,
   ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   return htable.checkAndPut(byteBufferToByteArray(row), 
byteBufferToByteArray(family),
@@ -321,6 +329,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void putMultiple(ByteBuffer table, List puts) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putsFromThrift(puts));
@@ -333,6 +342,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void deleteSingle(ByteBuffer table, TDelete deleteSingle) throws 
TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deleteFromThrift(deleteSingle));
@@ -346,6 +356,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public List deleteMultiple(ByteBuffer table, List deletes) 
throws TIOError,
   TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deletesFromThrift(deletes));
@@ -361,6 +372,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   public boolean checkAndMutate(ByteBuffer table, 

hbase git commit: HBASE-18875 Thrift server supports read-only mode

2017-09-25 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/master 0ebd4b843 -> cfb6a54f6


HBASE-18875 Thrift server supports read-only mode

Signed-off-by: tedyu 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cfb6a54f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cfb6a54f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cfb6a54f

Branch: refs/heads/master
Commit: cfb6a54f69b1d847142afab56bdc1504638f118d
Parents: 0ebd4b8
Author: Guangxu Cheng 
Authored: Tue Sep 26 00:29:24 2017 +0800
Committer: tedyu 
Committed: Mon Sep 25 15:11:03 2017 -0700

--
 .../thrift2/ThriftHBaseServiceHandler.java  |  27 +-
 .../hadoop/hbase/thrift2/ThriftServer.java  |  10 +
 ...stThriftHBaseServiceHandlerWithReadOnly.java | 467 +++
 3 files changed, 503 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/cfb6a54f/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
--
diff --git 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index 031d093..b34241c 100644
--- 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -49,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.RegionLocator;
@@ -94,6 +95,10 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   static final String CLEANUP_INTERVAL = 
"hbase.thrift.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.thrift.connection.max-idletime";
 
+  private static final IOException ioe
+  = new DoNotRetryIOException("Thrift Server is in Read-only mode.");
+  private boolean isReadOnly;
+
   public static THBaseService.Iface newInstance(
   THBaseService.Iface handler, ThriftMetrics metrics) {
 return (THBaseService.Iface) 
Proxy.newProxyInstance(handler.getClass().getClassLoader(),
@@ -174,6 +179,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
 connectionCache = new ConnectionCache(
   conf, userProvider, cleanInterval, maxIdleTime);
+isReadOnly = conf.getBoolean("hbase.thrift.readonly", false);
   }
 
   private Table getTable(ByteBuffer tableName) {
@@ -294,6 +300,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void put(ByteBuffer table, TPut put) throws TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putFromThrift(put));
@@ -307,6 +314,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer 
family,
   ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   return htable.checkAndPut(byteBufferToByteArray(row), 
byteBufferToByteArray(family),
@@ -321,6 +329,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void putMultiple(ByteBuffer table, List puts) throws TIOError, 
TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.put(putsFromThrift(puts));
@@ -333,6 +342,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
 
   @Override
   public void deleteSingle(ByteBuffer table, TDelete deleteSingle) throws 
TIOError, TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deleteFromThrift(deleteSingle));
@@ -346,6 +356,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   @Override
   public List deleteMultiple(ByteBuffer table, List deletes) 
throws TIOError,
   TException {
+checkReadOnlyMode();
 Table htable = getTable(table);
 try {
   htable.delete(deletesFromThrift(deletes));
@@ -361,6 +372,7 @@ public class ThriftHBaseServiceHandler implements 
THBaseService.Iface {
   public boolean checkAndMutate(ByteBuffer table,