Author: brock
Date: Wed Nov 19 00:39:39 2014
New Revision: 1640460

URL: http://svn.apache.org/r1640460
Log:
HIVE-8872 - Hive view of HBase range scan intermittently returns incorrect 
data. (Yongzhi Chen via Brock)

Modified:
    
hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java

Modified: 
hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java?rev=1640460&r1=1640459&r2=1640460&view=diff
==============================================================================
--- 
hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java
 (original)
+++ 
hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java
 Wed Nov 19 00:39:39 2014
@@ -84,6 +84,7 @@ public class HiveHBaseTableInputFormat e
     implements InputFormat<ImmutableBytesWritable, ResultWritable> {
 
   static final Log LOG = LogFactory.getLog(HiveHBaseTableInputFormat.class);
+  private static final Object hbaseTableMonitor = new Object();
 
   @Override
   public RecordReader<ImmutableBytesWritable, ResultWritable> getRecordReader(
@@ -427,6 +428,12 @@ public class HiveHBaseTableInputFormat e
 
   @Override
   public InputSplit[] getSplits(JobConf jobConf, int numSplits) throws 
IOException {
+    synchronized (hbaseTableMonitor) {
+      return getSplitsInternal(jobConf, numSplits);
+    }
+  }
+
+  private InputSplit[] getSplitsInternal(JobConf jobConf, int numSplits) 
throws IOException {
 
     //obtain delegation tokens for the job
     if (UserGroupInformation.getCurrentUser().hasKerberosCredentials()) {


Reply via email to