trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [1/4] incubator-trafodion git commit: TRAFODION-1643
Date Thu, 10 Dec 2015 04:28:38 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 15aa140bb -> 9c1161da5


TRAFODION-1643


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

Branch: refs/heads/master
Commit: e2d32a510bc29e25962604073d486fc355601a37
Parents: 80d6cff
Author: mashengchen <mashengchen@gmail.com>
Authored: Tue Dec 1 05:28:25 2015 +0000
Committer: mashengchen <mashengchen@gmail.com>
Committed: Tue Dec 1 05:28:25 2015 +0000

----------------------------------------------------------------------
 .../transactional/TrxTransactionState.java      | 49 ++++++++++++++++++--
 1 file changed, 45 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e2d32a51/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/regionserver/transactional/TrxTransactionState.java
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/regionserver/transactional/TrxTransactionState.java
b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/regionserver/transactional/TrxTransactionState.java
index d8c3d9a..29b21f7 100644
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/regionserver/transactional/TrxTransactionState.java
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/regionserver/transactional/TrxTransactionState.java
@@ -34,7 +34,6 @@
 package org.apache.hadoop.hbase.regionserver.transactional;
 
 import java.io.IOException;
-
 import java.lang.Class;
 
 import java.lang.reflect.Constructor;
@@ -65,6 +64,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValue.KVComparator;
 import org.apache.hadoop.hbase.KeyValue.Type;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.Delete;
@@ -80,6 +80,7 @@ import org.apache.hadoop.hbase.regionserver.ScanInfo;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.io.DataInputBuffer;
 
 /**
@@ -126,9 +127,9 @@ public class TrxTransactionState  extends TransactionState{
 	    }
 	    catch (NoSuchMethodException exc_nsm2) {
 		sb_sqm_98_4 = false;
+                LOG.info("Got info of Class ScanQueryMatcher for HBase version" + VersionInfo.getVersion());
 	    }
 	}
-
 	if (sb_sqm_98_1) {
 	    LOG.info("Got info of Class ScanQueryMatcher for HBase 98.1");
 	}
@@ -659,8 +660,48 @@ public class TrxTransactionState  extends TransactionState{
             super.setSequenceID(Long.MAX_VALUE);
             
             //Store.ScanInfo scaninfo = new Store.ScanInfo(null, 0, 1, HConstants.FOREVER,
false, 0, Cell.COMPARATOR);
-            ScanInfo scaninfo = new ScanInfo(null, 0, 1, HConstants.FOREVER, false, 0, KeyValue.COMPARATOR);
-            
+            //after hbase 0.98.8, ScanInfo instance need KeepDeletedCells as param instead
of boolean
+            ScanInfo scaninfo = null;
+            Class scaninfoClazz = null;
+            try {
+                scaninfoClazz = Class.forName("org.apache.hadoop.hbase.regionserver.ScanInfo");
+            } catch (ClassNotFoundException e) {
+                throw new RuntimeException(e.getMessage());
+            }
+            Class[] types = null;
+            Object[] args = null;
+            try {
+                types = new Class[] { byte[].class, int.class, int.class, long.class, boolean.class,
long.class, KVComparator.class };
+                Constructor constructor = scaninfoClazz.getConstructor(types);
+                args = new Object[] { null, 0, 1, HConstants.FOREVER, false, 0, KeyValue.COMPARATOR
};
+                scaninfo = (ScanInfo) constructor.newInstance(args);
+
+                if (LOG.isTraceEnabled())
+                    LOG.trace("Created ScanInfo instance before HBase 98.8");
+            } catch (Exception e) {
+                Class clazz = null;
+                try {
+                    clazz = Class.forName("org.apache.hadoop.hbase.KeepDeletedCells");
+                } catch (ClassNotFoundException e1) {
+                    throw new RuntimeException(e1.getMessage());
+                }
+                types = new Class[] { byte[].class, int.class, int.class, long.class, clazz,
long.class, KVComparator.class };
+                Constructor constructor = null;
+                try {
+                    constructor = scaninfoClazz.getConstructor(types);
+                } catch (Exception e1) {
+                    throw new RuntimeException(e1.getMessage());
+                }
+                args = new Object[] { null, 0, 1, HConstants.FOREVER, Enum.valueOf(clazz,
"FALSE"), 0, KeyValue.COMPARATOR };
+                try {
+                    scaninfo = (ScanInfo) constructor.newInstance(args);
+                } catch (Exception e1) {
+                    throw new RuntimeException(e1.getMessage());
+                }
+                if (LOG.isTraceEnabled())
+                    LOG.trace("Created ScanInfo instance after HBase 98.8");
+            }
+
             try {
 		if (sb_sqm_98_1) {
 		    try {


Mime
View raw message