You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by je...@apache.org on 2014/02/08 08:42:50 UTC
[01/11] Port Phoenix to Hbase0.98
Updated Branches:
refs/heads/4.0.0 214ad9e78 -> 53f7d3ce8
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndtoEndIndexingWithCompression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndtoEndIndexingWithCompression.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndtoEndIndexingWithCompression.java
index f783cbb..f357276 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndtoEndIndexingWithCompression.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndtoEndIndexingWithCompression.java
@@ -22,7 +22,7 @@ package org.apache.hadoop.hbase.index.covered.example;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
-import org.apache.hadoop.hbase.regionserver.wal.WALEditCodec;
+import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import org.junit.BeforeClass;
import org.apache.hadoop.hbase.index.IndexTestingUtils;
@@ -41,10 +41,11 @@ public class TestEndtoEndIndexingWithCompression extends TestEndToEndCoveredInde
// disable version checking, so we can test against whatever version of HBase happens to be
// installed (right now, its generally going to be SNAPSHOT versions).
conf.setBoolean(Indexer.CHECK_VERSION_CONF_KEY, false);
- conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY,
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY,
IndexedWALEditCodec.class.getName());
conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
-
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
//start the mini-cluster
UTIL.startMiniCluster();
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestFailWithoutRetries.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestFailWithoutRetries.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestFailWithoutRetries.java
index 66b6565..e4810ff 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestFailWithoutRetries.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestFailWithoutRetries.java
@@ -86,6 +86,8 @@ public class TestFailWithoutRetries {
Configuration conf = UTIL.getConfiguration();
IndexTestingUtils.setupConfig(conf);
IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
// start the cluster
UTIL.startMiniCluster();
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/filter/TestApplyAndFilterDeletesFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/filter/TestApplyAndFilterDeletesFilter.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/filter/TestApplyAndFilterDeletesFilter.java
index 8a1fb1e..a7a7b8b 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/filter/TestApplyAndFilterDeletesFilter.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/filter/TestApplyAndFilterDeletesFilter.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.util.ByteUtil;
/**
* Test filter to ensure that it correctly handles KVs of different types correctly
@@ -129,8 +130,7 @@ public class TestApplyAndFilterDeletesFilter {
}
private KeyValue createKvForType(Type t, long timestamp) {
- return new KeyValue(row, family, qualifier, 0, qualifier.length, timestamp, t, value, 0,
- value.length);
+ return new KeyValue(row, family, qualifier, timestamp, t, value);
}
/**
@@ -182,9 +182,7 @@ public class TestApplyAndFilterDeletesFilter {
ApplyAndFilterDeletesFilter filter = new ApplyAndFilterDeletesFilter(EMPTY_SET);
KeyValue d = createKvForType(Type.DeleteColumn, 12);
byte[] qual2 = Bytes.add(qualifier, Bytes.toBytes("-other"));
- KeyValue put =
- new KeyValue(row, family, qual2, 0, qual2.length, 11, Type.Put, value, 0,
- value.length);
+ KeyValue put = new KeyValue(row, family, qual2, 11, Type.Put, value);
assertEquals("Didn't filter out delete column", ReturnCode.SKIP, filter.filterKeyValue(d));
// different column put should still be visible
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/util/TestIndexManagementUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/util/TestIndexManagementUtil.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/util/TestIndexManagementUtil.java
index a66f381..6b39e8f 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/util/TestIndexManagementUtil.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/util/TestIndexManagementUtil.java
@@ -23,7 +23,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.regionserver.wal.IndexedHLogReader;
import org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
-import org.apache.hadoop.hbase.regionserver.wal.WALEditCodec;
+import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import org.junit.Test;
public class TestIndexManagementUtil {
@@ -32,7 +32,7 @@ public class TestIndexManagementUtil {
public void testUncompressedWal() throws Exception {
Configuration conf = new Configuration(false);
// works with WALEditcodec
- conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf);
// clear the codec and set the wal reader
conf = new Configuration(false);
@@ -49,7 +49,7 @@ public class TestIndexManagementUtil {
Configuration conf = new Configuration(false);
conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
// works with WALEditcodec
- conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf);
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/TestWALRecoveryCaching.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/TestWALRecoveryCaching.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/TestWALRecoveryCaching.java
index 054e961..497dd56 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/TestWALRecoveryCaching.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/TestWALRecoveryCaching.java
@@ -50,6 +50,7 @@ import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
@@ -213,7 +214,7 @@ public class TestWALRecoveryCaching {
LOG.info("\t== Offline: " + server.getServerName());
continue;
}
- List<HRegionInfo> regions = server.getOnlineRegions();
+ List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(server);
LOG.info("\t" + server.getServerName() + " regions: " + regions);
}
@@ -270,7 +271,7 @@ public class TestWALRecoveryCaching {
for (RegionServerThread rst : cluster.getRegionServerThreads()) {
// if its the server we are going to kill, get the regions we want to reassign
if (rst.getRegionServer().getServerName().equals(server)) {
- online = rst.getRegionServer().getOnlineRegions(table);
+ online = rst.getRegionServer().getOnlineRegions(org.apache.hadoop.hbase.TableName.valueOf(table));
break;
}
}
@@ -310,7 +311,7 @@ public class TestWALRecoveryCaching {
// force reassign the regions from the table
for (HRegion region : online) {
- cluster.getMaster().assign(region.getRegionName());
+ cluster.getMaster().assignRegion(region.getRegionInfo());
}
LOG.info("Starting region server:" + server.getHostname());
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java
index 5d9e9f2..d650246 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java
@@ -28,10 +28,23 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.wal.HLog;
+import org.apache.hadoop.hbase.regionserver.wal.HLogFactory;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import com.google.common.collect.Lists;
@@ -41,7 +54,8 @@ import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.hadoop.hbase.index.write.recovery.PerRegionIndexWriteCache;
public class TestPerRegionIndexWriteCache {
-
+ private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ private static final TableName tableName = TableName.valueOf("t1");
private static final byte[] row = Bytes.toBytes("row");
private static final byte[] family = Bytes.toBytes("family");
private static final byte[] qual = Bytes.toBytes("qual");
@@ -54,30 +68,53 @@ public class TestPerRegionIndexWriteCache {
p2.add(family, qual, val);
}
-
- HRegion r1 = new HRegion() {
- @Override
- public int hashCode() {
- return 1;
- }
-
- @Override
- public String toString() {
- return "testRegion1";
- }
- };
- HRegion r2 = new HRegion() {
- @Override
- public int hashCode() {
- return 2;
- }
-
- @Override
- public String toString() {
- return "testRegion1";
- }
- };
-
+ HRegion r1;
+ HRegion r2;
+
+ @Before
+ public void setUp() throws Exception {
+ FileSystem newFS = FileSystem.get(TEST_UTIL.getConfiguration());
+ Path hbaseRootDir = TEST_UTIL.getDataTestDir();
+
+ HRegionInfo hri = new HRegionInfo(tableName, null, null, false);
+ Path basedir = FSUtils.getTableDir(hbaseRootDir, tableName);
+ HLog wal = HLogFactory.createHLog(newFS,
+ hbaseRootDir, "logs", TEST_UTIL.getConfiguration());
+ HTableDescriptor htd = new HTableDescriptor(tableName);
+ HColumnDescriptor a = new HColumnDescriptor(Bytes.toBytes("a"));
+ htd.addFamily(a);
+
+ r1 = new HRegion(basedir, wal, newFS, TEST_UTIL.getConfiguration(), hri, htd, null) {
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ @Override
+ public String toString() {
+ return "testRegion1";
+ }
+ };
+
+ r2 = new HRegion(basedir, wal, newFS, TEST_UTIL.getConfiguration(), hri, htd, null) {
+ @Override
+ public int hashCode() {
+ return 2;
+ }
+
+ @Override
+ public String toString() {
+ return "testRegion1";
+ }
+ };
+ }
+
+ @After
+ public void cleanUp() throws Exception {
+ TEST_UTIL.cleanupTestDir();
+ }
+
+
@Test
public void testAddRemoveSingleRegion() {
PerRegionIndexWriteCache cache = new PerRegionIndexWriteCache();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestReadWriteKeyValuesWithCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestReadWriteKeyValuesWithCodec.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestReadWriteKeyValuesWithCodec.java
index 34499bd..c63d7af 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestReadWriteKeyValuesWithCodec.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestReadWriteKeyValuesWithCodec.java
@@ -2,6 +2,7 @@ package org.apache.hadoop.hbase.regionserver.wal;
import static org.junit.Assert.assertEquals;
+import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -11,18 +12,21 @@ import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.codec.Codec;
+import org.apache.hadoop.hbase.index.IndexTestingUtils;
+import org.apache.hadoop.hbase.index.wal.IndexedKeyValue;
+import org.apache.hadoop.hbase.io.util.LRUDictionary;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.apache.hadoop.hbase.index.IndexTestingUtils;
-import org.apache.hadoop.hbase.index.wal.IndexedKeyValue;
-
/**
* Simple test to read/write simple files via our custom {@link WALEditCodec} to ensure properly
* encoding/decoding without going through a cluster.
@@ -37,7 +41,7 @@ public class TestReadWriteKeyValuesWithCodec {
public static void setupCodec() {
Configuration conf = UTIL.getConfiguration();
IndexTestingUtils.setupConfig(conf);
- conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
}
@Test
@@ -48,9 +52,7 @@ public class TestReadWriteKeyValuesWithCodec {
FileSystem fs = UTIL.getTestFileSystem();
List<WALEdit> edits = getEdits();
- WALEditCodec codec = WALEditCodec.create(UTIL.getConfiguration(), null);
- writeReadAndVerify(codec, fs, edits, testFile);
-
+ writeReadAndVerify(null, fs, edits, testFile);
}
@Test
@@ -61,9 +63,8 @@ public class TestReadWriteKeyValuesWithCodec {
FileSystem fs = UTIL.getTestFileSystem();
List<WALEdit> edits = getEdits();
- CompressionContext compression = new CompressionContext(LRUDictionary.class);
- WALEditCodec codec = WALEditCodec.create(UTIL.getConfiguration(), compression);
- writeReadAndVerify(codec, fs, edits, testFile);
+ CompressionContext compression = new CompressionContext(LRUDictionary.class, false, false);
+ writeReadAndVerify(compression, fs, edits, testFile);
}
/**
@@ -110,23 +111,34 @@ public class TestReadWriteKeyValuesWithCodec {
* {@link WALEdit}.
*/
private void addMutation(WALEdit edit, Mutation m, byte[] family) {
- List<KeyValue> kvs = m.getFamilyMap().get(FAMILY);
- for (KeyValue kv : kvs) {
- edit.add(kv);
+ List<Cell> kvs = m.getFamilyCellMap().get(FAMILY);
+ for (Cell kv : kvs) {
+ edit.add(KeyValueUtil.ensureKeyValue(kv));
}
}
+
+ private void writeWALEdit(WALCellCodec codec, List<KeyValue> kvs, FSDataOutputStream out) throws IOException {
+ out.writeInt(kvs.size());
+ Codec.Encoder cellEncoder = codec.getEncoder(out);
+ // We interleave the two lists for code simplicity
+ for (KeyValue kv : kvs) {
+ cellEncoder.write(kv);
+ }
+ }
+
/**
* Write the edits to the specified path on the {@link FileSystem} using the given codec and then
* read them back in and ensure that we read the same thing we wrote.
*/
- private void writeReadAndVerify(WALEditCodec codec, FileSystem fs, List<WALEdit> edits,
+ private void writeReadAndVerify(final CompressionContext compressionContext, FileSystem fs, List<WALEdit> edits,
Path testFile) throws IOException {
+
+ WALCellCodec codec = WALCellCodec.create(UTIL.getConfiguration(), compressionContext);
// write the edits out
FSDataOutputStream out = fs.create(testFile);
for (WALEdit edit : edits) {
- edit.setCodec(codec);
- edit.write(out);
+ writeWALEdit(codec, edit.getKeyValues(), out);
}
out.close();
@@ -135,8 +147,8 @@ public class TestReadWriteKeyValuesWithCodec {
List<WALEdit> read = new ArrayList<WALEdit>();
for (int i = 0; i < edits.size(); i++) {
WALEdit edit = new WALEdit();
- edit.setCodec(codec);
- edit.readFields(in);
+ int numEdits = in.readInt();
+ edit.readFromCells(codec.getDecoder(in), numEdits);
read.add(edit);
}
in.close();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndCompressedWAL.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndCompressedWAL.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndCompressedWAL.java
index 79bc073..b8c78c9 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndCompressedWAL.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndCompressedWAL.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.RegionServerAccounting;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -77,7 +78,7 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
this.oldLogDir = new Path(this.hbaseRootDir, HConstants.HREGION_OLDLOGDIR_NAME);
this.logDir = new Path(this.hbaseRootDir, HConstants.HREGION_LOGDIR_NAME);
// reset the log reader to ensure we pull the one from this config
- HLog.resetLogReaderClass();
+ HLogFactory.resetLogReaderClass();
}
private void setupCluster() throws Exception {
@@ -91,6 +92,8 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
// enable WAL compression
conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
}
protected final void setDefaults(Configuration conf) {
@@ -140,8 +143,9 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
@Test
public void testReplayEditsWrittenViaHRegion() throws Exception {
final String tableNameStr = "testReplayEditsWrittenViaHRegion";
- final HRegionInfo hri = new HRegionInfo(Bytes.toBytes(tableNameStr), null, null, false);
- final Path basedir = new Path(this.hbaseRootDir, tableNameStr);
+ final HRegionInfo hri = new HRegionInfo(org.apache.hadoop.hbase.TableName.valueOf(tableNameStr),
+ null, null, false);
+ final Path basedir = FSUtils.getTableDir(hbaseRootDir, org.apache.hadoop.hbase.TableName.valueOf(tableNameStr));
deleteDir(basedir);
final HTableDescriptor htd = createBasic3FamilyHTD(tableNameStr);
@@ -161,22 +165,20 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
HLog wal = createWAL(this.conf);
RegionServerServices mockRS = Mockito.mock(RegionServerServices.class);
// mock out some of the internals of the RSS, so we can run CPs
- Mockito.when(mockRS.getWAL()).thenReturn(wal);
+ Mockito.when(mockRS.getWAL(null)).thenReturn(wal);
RegionServerAccounting rsa = Mockito.mock(RegionServerAccounting.class);
Mockito.when(mockRS.getRegionServerAccounting()).thenReturn(rsa);
ServerName mockServerName = Mockito.mock(ServerName.class);
- Mockito.when(mockServerName.getServerName()).thenReturn(tableNameStr + "-server-1234");
+ Mockito.when(mockServerName.getServerName()).thenReturn(tableNameStr + ",1234");
Mockito.when(mockRS.getServerName()).thenReturn(mockServerName);
HRegion region = new HRegion(basedir, wal, this.fs, this.conf, hri, htd, mockRS);
long seqid = region.initialize();
- // HRegionServer usually does this. It knows the largest seqid across all regions.
- wal.setSequenceNumber(seqid);
//make an attempted write to the primary that should also be indexed
byte[] rowkey = Bytes.toBytes("indexed_row_key");
Put p = new Put(rowkey);
p.add(family, Bytes.toBytes("qual"), Bytes.toBytes("value"));
- region.put(new Put[] { p });
+ region.put(p);
// we should then see the server go down
Mockito.verify(mockRS, Mockito.times(1)).abort(Mockito.anyString(),
@@ -232,10 +234,10 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
* @throws IOException
*/
private HLog createWAL(final Configuration c) throws IOException {
- HLog wal = new HLog(FileSystem.get(c), logDir, oldLogDir, c);
+ HLog wal = HLogFactory.createHLog(FileSystem.get(c), logDir, "localhost,1234", c);
// Set down maximum recovery so we dfsclient doesn't linger retrying something
// long gone.
- HBaseTestingUtility.setMaxRecoveryErrorCount(wal.getOutputStream(), 1);
+ HBaseTestingUtility.setMaxRecoveryErrorCount(((FSHLog) wal).getOutputStream(), 1);
return wal;
}
@@ -247,9 +249,9 @@ public class TestWALReplayWithIndexWritesAndCompressedWAL {
*/
private Path runWALSplit(final Configuration c) throws IOException {
FileSystem fs = FileSystem.get(c);
- HLogSplitter logSplitter = HLogSplitter.createLogSplitter(c, this.hbaseRootDir, this.logDir,
- this.oldLogDir, fs);
- List<Path> splits = logSplitter.splitLog();
+
+ List<Path> splits = HLogSplitter.split(this.hbaseRootDir, new Path(this.logDir, "localhost,1234"),
+ this.oldLogDir, fs, c);
// Split should generate only 1 file since there's only 1 region
assertEquals("splits=" + splits, 1, splits.size());
// Make sure the file exists
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9.java
index 48eeff9..fe23ce3 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9.java
@@ -20,5 +20,7 @@ public class TestWALReplayWithIndexWritesAndUncompressedWALInHBase_094_9 extends
// disable WAL compression
conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, false);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
index 980499e..dbdd374 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
@@ -142,14 +142,13 @@ public class TestClientKeyValueLocal {
private void validate(KeyValue kv, byte[] row, byte[] family, byte[] qualifier, long ts,
Type type, byte[] value) throws IOException {
DataOutputBuffer out = new DataOutputBuffer();
- kv.write(out);
+ KeyValue.write(kv, out);
out.close();
byte[] data = out.getData();
// read it back in
- KeyValue read = new KeyValue();
DataInputBuffer in = new DataInputBuffer();
in.reset(data, data.length);
- read.readFields(in);
+ KeyValue read = KeyValue.create(in);
in.close();
// validate that its the same
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/end2end/AlterTableTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/AlterTableTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/AlterTableTest.java
index 33139cc..83c29bf 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/AlterTableTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/end2end/AlterTableTest.java
@@ -79,10 +79,6 @@ public class AlterTableTest extends BaseHBaseManagedTimeTest {
conn.close();
}
}
-
-
-
-
@Test
public void testAddVarCharColToPK() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/end2end/NativeHBaseTypesTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/NativeHBaseTypesTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/NativeHBaseTypesTest.java
index bdffaa9..b8607cf 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/NativeHBaseTypesTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/end2end/NativeHBaseTypesTest.java
@@ -124,7 +124,7 @@ public class NativeHBaseTypesTest extends BaseClientManagedTimeTest {
// FIXME: the version of the Delete constructor without the lock args was introduced
// in 0.94.4, thus if we try to use it here we can no longer use the 0.94.2 version
// of the client.
- Delete del = new Delete(key, ts-2, null);
+ Delete del = new Delete(key, ts-2);
mutations.add(del);
put = new Put(key);
put.add(family, uintCol, ts, Bytes.toBytes(2000));
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
index b977230..5cd9f6d 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
@@ -35,13 +35,11 @@ import java.util.BitSet;
import java.util.List;
import java.util.Map;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
-
-import com.google.common.collect.Lists;
import org.apache.phoenix.client.KeyValueBuilder;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.ColumnModifier;
@@ -56,6 +54,8 @@ import org.apache.phoenix.util.IndexUtil;
import org.apache.phoenix.util.MetaDataUtil;
import org.apache.phoenix.util.SchemaUtil;
+import com.google.common.collect.Lists;
+
public class IndexTestUtil {
// the normal db metadata interface is insufficient for all fields needed for an
@@ -125,22 +125,22 @@ public class IndexTestUtil {
}
PRow row;
long ts = MetaDataUtil.getClientTimeStamp(dataMutation);
- if (dataMutation instanceof Delete && dataMutation.getFamilyMap().values().isEmpty()) {
+ if (dataMutation instanceof Delete && dataMutation.getFamilyCellMap().values().isEmpty()) {
indexTable.newKey(ptr, indexValues);
row = indexTable.newRow(builder, ts, ptr);
row.delete();
} else {
// If no column families in table, then nothing to look for
if (!dataTable.getColumnFamilies().isEmpty()) {
- for (Map.Entry<byte[],List<KeyValue>> entry : dataMutation.getFamilyMap().entrySet()) {
+ for (Map.Entry<byte[],List<Cell>> entry : dataMutation.getFamilyCellMap().entrySet()) {
PColumnFamily family = dataTable.getColumnFamily(entry.getKey());
- for (KeyValue kv : entry.getValue()) {
+ for (Cell kv : entry.getValue()) {
byte[] cq = kv.getQualifier();
if (Bytes.compareTo(QueryConstants.EMPTY_COLUMN_BYTES, cq) != 0) {
try {
PColumn dataColumn = family.getColumn(cq);
PColumn indexColumn = indexTable.getColumn(IndexUtil.getIndexColumnName(family.getName().getString(), dataColumn.getName().getString()));
- ptr.set(kv.getBuffer(),kv.getValueOffset(),kv.getValueLength());
+ ptr.set(kv.getValueArray(),kv.getValueOffset(),kv.getValueLength());
coerceDataValueToIndexValue(dataColumn, indexColumn, ptr);
indexValues[indexPKColumns.indexOf(indexColumn)-indexOffset] = ptr.copyBytes();
if (!SchemaUtil.isPKColumn(indexColumn)) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java b/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java
index 990b31c..886d3fc 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/filter/SkipScanFilterTest.java
@@ -1,5 +1,6 @@
package org.apache.phoenix.filter;
+import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -80,7 +81,7 @@ public class SkipScanFilterTest extends TestCase {
}
@Test
- public void test() {
+ public void test() throws IOException {
System.out.println("CNF: " + cnf + "\n" + "Expectations: " + expectations);
for (Expectation expectation : expectations) {
expectation.examine(skipper);
@@ -327,7 +328,7 @@ public class SkipScanFilterTest extends TestCase {
};
static interface Expectation {
- void examine(SkipScanFilter skipper);
+ void examine(SkipScanFilter skipper) throws IOException;
}
private static final class SeekNext implements Expectation {
private final byte[] rowkey, hint;
@@ -340,7 +341,7 @@ public class SkipScanFilterTest extends TestCase {
this.hint = hint;
}
- @Override public void examine(SkipScanFilter skipper) {
+ @Override public void examine(SkipScanFilter skipper) throws IOException {
KeyValue kv = KeyValue.createFirstOnRow(rowkey);
skipper.reset();
assertFalse(skipper.filterAllRemaining());
@@ -361,7 +362,7 @@ public class SkipScanFilterTest extends TestCase {
this.rowkey = Bytes.toBytes(rowkey);
}
- @Override public void examine(SkipScanFilter skipper) {
+ @Override public void examine(SkipScanFilter skipper) throws IOException {
KeyValue kv = KeyValue.createFirstOnRow(rowkey);
skipper.reset();
assertFalse(skipper.filterAllRemaining());
@@ -380,7 +381,7 @@ public class SkipScanFilterTest extends TestCase {
this.rowkey = Bytes.toBytes(rowkey);
}
- @Override public void examine(SkipScanFilter skipper) {
+ @Override public void examine(SkipScanFilter skipper) throws IOException {
KeyValue kv = KeyValue.createFirstOnRow(rowkey);
skipper.reset();
assertEquals(ReturnCode.NEXT_ROW,skipper.filterKeyValue(kv));
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/iterate/AggregateResultScannerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/iterate/AggregateResultScannerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/iterate/AggregateResultScannerTest.java
index 8ae9543..d5378f2 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/iterate/AggregateResultScannerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/iterate/AggregateResultScannerTest.java
@@ -112,13 +112,6 @@ public class AggregateResultScannerTest extends BaseConnectionlessQueryTest {
}
@Override
- public void readFields(DataInput arg0) throws IOException {
- }
- @Override
- public void write(DataOutput arg0) throws IOException {
- }
-
- @Override
public Integer getArraySize() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 94a997b..dd3baa7 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -67,6 +67,7 @@ import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.schema.TableAlreadyExistsException;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
public abstract class BaseTest {
private static final Map<String,String> tableDDLMap;
@@ -413,6 +414,7 @@ public abstract class BaseTest {
if (PhoenixEmbeddedDriver.isTestUrl(url)) {
PhoenixTestDriver driver = initDriver(new QueryServicesTestImpl(props));
assertTrue(DriverManager.getDriver(url) == driver);
+ driver.connect(url, TestUtil.TEST_PROPERTIES);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index 2816023..7d3112e 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -35,6 +35,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Properties;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.HTableInterface;
@@ -42,9 +43,14 @@ import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.coprocessor.Batch;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.compile.StatementContext;
import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
import org.apache.phoenix.expression.AndExpression;
import org.apache.phoenix.expression.ComparisonExpression;
import org.apache.phoenix.expression.Expression;
@@ -293,10 +299,9 @@ public class TestUtil {
+ res1.toString() + " compared to " + res2.toString());
}
for (int i = 0; i < res1.size(); i++) {
- KeyValue ourKV = res1.getValue(i);
- KeyValue replicatedKV = res2.getValue(i);
- if (!ourKV.equals(replicatedKV) ||
- !Bytes.equals(ourKV.getValue(), replicatedKV.getValue())) {
+ Cell ourKV = res1.getValue(i);
+ Cell replicatedKV = res2.getValue(i);
+ if (!ourKV.equals(replicatedKV)) {
throw new Exception("This result was different: "
+ res1.toString() + " compared to " + res2.toString());
}
@@ -306,14 +311,21 @@ public class TestUtil {
public static void clearMetaDataCache(Connection conn) throws Throwable {
PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
HTableInterface htable = pconn.getQueryServices().getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
- htable.coprocessorExec(MetaDataProtocol.class, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataProtocol, Void>() {
- @Override
- public Void call(MetaDataProtocol instance) throws IOException {
- instance.clearCache();
- return null;
- }
- });
+ htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, ClearCacheResponse>() {
+ @Override
+ public ClearCacheResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<ClearCacheResponse> rpcCallback =
+ new BlockingRpcCallback<ClearCacheResponse>();
+ ClearCacheRequest.Builder builder = ClearCacheRequest.newBuilder();
+ instance.clearCache(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
}
public static void closeStatement(Statement stmt) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-flume/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index cbf7d0b..fe3cd5c 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -32,13 +32,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- Needed by HBase to run the minicluster -->
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- <type>test-jar</type>
</dependency>
</dependencies>
@@ -54,6 +47,26 @@
</activation>
<dependencies>
<dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
</dependency>
@@ -75,6 +88,26 @@
</activation>
<dependencies>
<dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/README.txt
----------------------------------------------------------------------
diff --git a/phoenix-protocol/README.txt b/phoenix-protocol/README.txt
new file mode 100644
index 0000000..c38cc06
--- /dev/null
+++ b/phoenix-protocol/README.txt
@@ -0,0 +1,10 @@
+These are the protobuf definition files. The produced java classes are generated into
+phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated. Please check them in so no need
+to recreate them in every build.
+
+To regenerate the classes after making definition file changes, ensure first that
+the protobuf protoc(at least 2.5) tool is in your $PATH (You may need to download it and build
+it first; its part of the protobuf package obtainable from here:
+http://code.google.com/p/protobuf/downloads/list).
+
+Goto folder phoenix-protocol/src/main and run "./build-proto.sh"
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/src/main/MetaDataService.proto
----------------------------------------------------------------------
diff --git a/phoenix-protocol/src/main/MetaDataService.proto b/phoenix-protocol/src/main/MetaDataService.proto
new file mode 100644
index 0000000..1be664b
--- /dev/null
+++ b/phoenix-protocol/src/main/MetaDataService.proto
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.phoenix.coprocessor.generated";
+option java_outer_classname = "MetaDataProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+option optimize_for = SPEED;
+
+import "PTable.proto";
+
+enum MutationCode {
+ TABLE_ALREADY_EXISTS = 0;
+ TABLE_NOT_FOUND = 1;
+ COLUMN_NOT_FOUND = 2;
+ COLUMN_ALREADY_EXISTS = 3;
+ CONCURRENT_TABLE_MUTATION = 4;
+ TABLE_NOT_IN_REGION = 5;
+ NEWER_TABLE_FOUND = 6;
+ UNALLOWED_TABLE_MUTATION = 7;
+ NO_PK_COLUMNS = 8;
+ PARENT_TABLE_NOT_FOUND = 9;
+};
+
+message MetaDataResponse {
+ optional MutationCode returnCode = 1;
+ optional int64 mutationTime = 2;
+ optional PTable table = 3;
+ repeated bytes tablesToDelete = 4;
+ optional bytes columnName = 5;
+ optional bytes familyName = 6;
+}
+
+message GetTableRequest {
+ required bytes tenantId = 1;
+ required bytes schemaName = 2;
+ required bytes tableName = 3;
+ required int64 tableTimestamp = 4;
+ required int64 clientTimestamp = 5;
+}
+
+// each byte array represents a MutationProto instance
+message CreateTableRequest {
+ repeated bytes tableMetadataMutations = 1;
+}
+
+message DropTableRequest {
+ repeated bytes tableMetadataMutations = 1;
+ required string tableType = 2;
+}
+
+message AddColumnRequest {
+ repeated bytes tableMetadataMutations = 1;
+}
+
+message DropColumnRequest {
+ repeated bytes tableMetadataMutations = 1;
+}
+
+message UpdateIndexStateRequest {
+ repeated bytes tableMetadataMutations = 1;
+}
+
+message ClearCacheRequest {
+}
+
+message ClearCacheResponse {
+}
+
+message GetVersionRequest {
+}
+
+message GetVersionResponse {
+ required int64 version = 1;
+}
+
+service MetaDataService {
+ rpc getTable(GetTableRequest)
+ returns (MetaDataResponse);
+
+ rpc createTable(CreateTableRequest)
+ returns (MetaDataResponse);
+
+ rpc dropTable(DropTableRequest)
+ returns (MetaDataResponse);
+
+ rpc addColumn(AddColumnRequest)
+ returns (MetaDataResponse);
+
+ rpc dropColumn(DropColumnRequest)
+ returns (MetaDataResponse);
+
+ rpc updateIndexState(UpdateIndexStateRequest)
+ returns (MetaDataResponse);
+
+ rpc clearCache(ClearCacheRequest)
+ returns (ClearCacheResponse);
+
+ rpc getVersion(GetVersionRequest)
+ returns (GetVersionResponse);
+}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/src/main/PTable.proto
----------------------------------------------------------------------
diff --git a/phoenix-protocol/src/main/PTable.proto b/phoenix-protocol/src/main/PTable.proto
new file mode 100644
index 0000000..f011d0f
--- /dev/null
+++ b/phoenix-protocol/src/main/PTable.proto
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.phoenix.coprocessor.generated";
+option java_outer_classname = "PTableProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+option optimize_for = SPEED;
+
+enum PTableType {
+ SYSTEM = 0;
+ USER = 1;
+ VIEW = 2;
+ INDEX = 3;
+ JOIN = 4;
+}
+
+message PColumn {
+ required bytes columnNameBytes = 1;
+ optional bytes familyNameBytes = 2;
+ required string dataType = 3;
+ optional int32 maxLength = 4;
+ optional int32 scale = 5;
+ required bool nullable = 6;
+ required int32 position = 7;
+ required int32 columnModifier = 8;
+ optional int32 arraySize = 9;
+}
+
+message PTableStats {
+ required string key = 1;
+ repeated bytes values = 2;
+}
+
+message PTable {
+ required bytes schemaNameBytes = 1;
+ required bytes tableNameBytes = 2;
+ required PTableType tableType = 3;
+ optional string indexState = 4;
+ required int64 sequenceNumber = 5;
+ required int64 timeStamp = 6;
+ optional bytes pkNameBytes = 7;
+ required int32 bucketNum = 8;
+ repeated PColumn columns = 9;
+ repeated PTable indexes = 10;
+ required bool isImmutableRows = 11;
+ repeated PTableStats guidePosts = 12;
+ optional bytes dataTableNameBytes = 13;
+ optional bytes defaultFamilyName = 14;
+ required bool disableWAL = 15;
+ required bool multiTenant = 16;
+ optional bytes viewType = 17;
+ optional bytes viewStatement = 18;
+ repeated bytes physicalNames = 19;
+}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/src/main/ServerCacheFactory.proto
----------------------------------------------------------------------
diff --git a/phoenix-protocol/src/main/ServerCacheFactory.proto b/phoenix-protocol/src/main/ServerCacheFactory.proto
new file mode 100644
index 0000000..4b91d84
--- /dev/null
+++ b/phoenix-protocol/src/main/ServerCacheFactory.proto
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.phoenix.coprocessor.generated";
+option java_outer_classname = "ServerCacheFactoryProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+option optimize_for = SPEED;
+
+message ServerCacheFactory {
+ required string className = 1;
+}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/src/main/ServerCachingService.proto
----------------------------------------------------------------------
diff --git a/phoenix-protocol/src/main/ServerCachingService.proto b/phoenix-protocol/src/main/ServerCachingService.proto
new file mode 100644
index 0000000..63aeef9
--- /dev/null
+++ b/phoenix-protocol/src/main/ServerCachingService.proto
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.phoenix.coprocessor.generated";
+option java_outer_classname = "ServerCachingProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+option optimize_for = SPEED;
+
+import "ServerCacheFactory.proto";
+
+message ImmutableBytesWritable {
+ required bytes byteArray = 1;
+ required int32 offset = 2;
+ required int32 length = 3;
+}
+
+message AddServerCacheRequest {
+ optional bytes tenantId = 1;
+ required bytes cacheId = 2;
+ required ImmutableBytesWritable cachePtr = 3;
+ required ServerCacheFactory cacheFactory = 4;
+}
+
+message AddServerCacheResponse {
+ required bool return = 1;
+}
+
+message RemoveServerCacheRequest {
+ optional bytes tenantId = 1;
+ required bytes cacheId = 2;
+}
+
+message RemoveServerCacheResponse {
+ required bool return = 1;
+}
+
+service ServerCachingService {
+ rpc addServerCache(AddServerCacheRequest)
+ returns (AddServerCacheResponse);
+
+ rpc removeServerCache(RemoveServerCacheRequest)
+ returns (RemoveServerCacheResponse);
+}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-protocol/src/main/build-proto.sh
----------------------------------------------------------------------
diff --git a/phoenix-protocol/src/main/build-proto.sh b/phoenix-protocol/src/main/build-proto.sh
new file mode 100755
index 0000000..b80bf1d
--- /dev/null
+++ b/phoenix-protocol/src/main/build-proto.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+##
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+# script to run protoc to generate protocol buf files
+# run the script under folder src/protocol
+# usage: ./build-proto.sh
+#
+
+which protoc
+if [ $? != 0 ] ; then
+ echo "Must have protoc compiler in your path to generate code"
+ exit 1
+fi
+
+PROTO_ROOT_DIR=`dirname $0`
+PROTO_DIR=$PROTO_ROOT_DIR
+JAVA_DIR=$PROTO_ROOT_DIR/../../../phoenix-core/src/main/java
+
+set -x
+for f in $PROTO_DIR/*.proto ; do
+ protoc -I$PROTO_DIR --java_out=$JAVA_DIR $f
+done
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 05b3d3c..c7524d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,21 +59,21 @@
<test.output.tofile>true</test.output.tofile>
<!-- Hadoop Versions -->
+ <hbase-hadoop1.version>0.99.0-SNAPSHOT</hbase-hadoop1.version>
+ <hbase-hadoop2.version>0.99.0-SNAPSHOT</hbase-hadoop2.version>
<hadoop-one.version>1.0.4</hadoop-one.version>
- <hadoop-two.version>2.0.4-alpha</hadoop-two.version>
+ <hadoop-two.version>2.2.0</hadoop-two.version>
<!-- Dependency versions -->
- <hbase.version>0.94.12</hbase.version>
<commons-cli.version>1.2</commons-cli.version>
<hadoop.version>1.0.4</hadoop.version>
<pig.version>0.12.0</pig.version>
<jackson.version>1.8.8</jackson.version>
<antlr.version>3.5</antlr.version>
+ <log4j.version>1.2.17</log4j.version>
+ <slf4j.version>1.6.4</slf4j.version>
<opencsv.version>2.3</opencsv.version>
- <log4j.version>1.2.16</log4j.version>
- <slf4j-api.version>1.4.3.jar</slf4j-api.version>
- <slf4j-log4j.version>1.4.3</slf4j-log4j.version>
- <protobuf-java.version>2.4.0</protobuf-java.version>
+ <protobuf-java.version>2.5.0</protobuf-java.version>
<commons-configuration.version>1.6</commons-configuration.version>
<commons-io.version>2.1</commons-io.version>
<commons-lang.version>2.5</commons-lang.version>
@@ -85,6 +85,7 @@
<findbugs.version>1.3.2</findbugs.version>
<jline.version>2.11</jline.version>
<snappy.version>1.1.0.1</snappy.version>
+ <jruby.version>1.6.8</jruby.version>
<!-- Test Dependencies -->
<mockito-all.version>1.8.5</mockito-all.version>
@@ -296,17 +297,6 @@
<version>${pig.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- <version>${hbase.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.11</version>
@@ -336,22 +326,6 @@
<artifactId>snappy-java</artifactId>
<version>${snappy.version}</version>
</dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Needed by HBase to run the minicluster -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
@@ -380,7 +354,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
@@ -388,6 +361,31 @@
<version>${mockito-all.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf-java.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>${jruby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -421,10 +419,29 @@
<!-- Hadoop dependencies -->
<dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
- <version>${hadoop.version}</version>
- <optional>true</optional>
+ <version>${hadoop-one.version}</version>
<exclusions>
<exclusion>
<groupId>hsqldb</groupId>
@@ -451,7 +468,7 @@
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-test</artifactId>
- <version>${hadoop.version}</version>
+ <version>${hadoop-one.version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
@@ -487,6 +504,26 @@
<!-- Hadoop dependencies -->
<dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
[04/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java
new file mode 100644
index 0000000..69db21b
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java
@@ -0,0 +1,3447 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: ServerCachingService.proto
+
+package org.apache.phoenix.coprocessor.generated;
+
+public final class ServerCachingProtos {
+ private ServerCachingProtos() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface ImmutableBytesWritableOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bytes byteArray = 1;
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ boolean hasByteArray();
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ com.google.protobuf.ByteString getByteArray();
+
+ // required int32 offset = 2;
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ boolean hasOffset();
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ int getOffset();
+
+ // required int32 length = 3;
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ boolean hasLength();
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ int getLength();
+ }
+ /**
+ * Protobuf type {@code ImmutableBytesWritable}
+ */
+ public static final class ImmutableBytesWritable extends
+ com.google.protobuf.GeneratedMessage
+ implements ImmutableBytesWritableOrBuilder {
+ // Use ImmutableBytesWritable.newBuilder() to construct.
+ private ImmutableBytesWritable(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private ImmutableBytesWritable(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final ImmutableBytesWritable defaultInstance;
+ public static ImmutableBytesWritable getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public ImmutableBytesWritable getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private ImmutableBytesWritable(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ byteArray_ = input.readBytes();
+ break;
+ }
+ case 16: {
+ bitField0_ |= 0x00000002;
+ offset_ = input.readInt32();
+ break;
+ }
+ case 24: {
+ bitField0_ |= 0x00000004;
+ length_ = input.readInt32();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_ImmutableBytesWritable_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_ImmutableBytesWritable_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<ImmutableBytesWritable> PARSER =
+ new com.google.protobuf.AbstractParser<ImmutableBytesWritable>() {
+ public ImmutableBytesWritable parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new ImmutableBytesWritable(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<ImmutableBytesWritable> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bytes byteArray = 1;
+ public static final int BYTEARRAY_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString byteArray_;
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public boolean hasByteArray() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public com.google.protobuf.ByteString getByteArray() {
+ return byteArray_;
+ }
+
+ // required int32 offset = 2;
+ public static final int OFFSET_FIELD_NUMBER = 2;
+ private int offset_;
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public boolean hasOffset() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public int getOffset() {
+ return offset_;
+ }
+
+ // required int32 length = 3;
+ public static final int LENGTH_FIELD_NUMBER = 3;
+ private int length_;
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public boolean hasLength() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public int getLength() {
+ return length_;
+ }
+
+ private void initFields() {
+ byteArray_ = com.google.protobuf.ByteString.EMPTY;
+ offset_ = 0;
+ length_ = 0;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasByteArray()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasOffset()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasLength()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, byteArray_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeInt32(2, offset_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeInt32(3, length_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, byteArray_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(2, offset_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(3, length_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable other = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable) obj;
+
+ boolean result = true;
+ result = result && (hasByteArray() == other.hasByteArray());
+ if (hasByteArray()) {
+ result = result && getByteArray()
+ .equals(other.getByteArray());
+ }
+ result = result && (hasOffset() == other.hasOffset());
+ if (hasOffset()) {
+ result = result && (getOffset()
+ == other.getOffset());
+ }
+ result = result && (hasLength() == other.hasLength());
+ if (hasLength()) {
+ result = result && (getLength()
+ == other.getLength());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasByteArray()) {
+ hash = (37 * hash) + BYTEARRAY_FIELD_NUMBER;
+ hash = (53 * hash) + getByteArray().hashCode();
+ }
+ if (hasOffset()) {
+ hash = (37 * hash) + OFFSET_FIELD_NUMBER;
+ hash = (53 * hash) + getOffset();
+ }
+ if (hasLength()) {
+ hash = (37 * hash) + LENGTH_FIELD_NUMBER;
+ hash = (53 * hash) + getLength();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code ImmutableBytesWritable}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_ImmutableBytesWritable_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_ImmutableBytesWritable_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ byteArray_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ offset_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ length_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_ImmutableBytesWritable_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable build() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable buildPartial() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable result = new org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.byteArray_ = byteArray_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.offset_ = offset_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.length_ = length_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable other) {
+ if (other == org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance()) return this;
+ if (other.hasByteArray()) {
+ setByteArray(other.getByteArray());
+ }
+ if (other.hasOffset()) {
+ setOffset(other.getOffset());
+ }
+ if (other.hasLength()) {
+ setLength(other.getLength());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasByteArray()) {
+
+ return false;
+ }
+ if (!hasOffset()) {
+
+ return false;
+ }
+ if (!hasLength()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required bytes byteArray = 1;
+ private com.google.protobuf.ByteString byteArray_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public boolean hasByteArray() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public com.google.protobuf.ByteString getByteArray() {
+ return byteArray_;
+ }
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public Builder setByteArray(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ byteArray_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes byteArray = 1;</code>
+ */
+ public Builder clearByteArray() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ byteArray_ = getDefaultInstance().getByteArray();
+ onChanged();
+ return this;
+ }
+
+ // required int32 offset = 2;
+ private int offset_ ;
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public boolean hasOffset() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public int getOffset() {
+ return offset_;
+ }
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public Builder setOffset(int value) {
+ bitField0_ |= 0x00000002;
+ offset_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int32 offset = 2;</code>
+ */
+ public Builder clearOffset() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ offset_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // required int32 length = 3;
+ private int length_ ;
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public boolean hasLength() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public int getLength() {
+ return length_;
+ }
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public Builder setLength(int value) {
+ bitField0_ |= 0x00000004;
+ length_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int32 length = 3;</code>
+ */
+ public Builder clearLength() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ length_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:ImmutableBytesWritable)
+ }
+
+ static {
+ defaultInstance = new ImmutableBytesWritable(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:ImmutableBytesWritable)
+ }
+
+ public interface AddServerCacheRequestOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional bytes tenantId = 1;
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ boolean hasTenantId();
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ com.google.protobuf.ByteString getTenantId();
+
+ // required bytes cacheId = 2;
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ boolean hasCacheId();
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ com.google.protobuf.ByteString getCacheId();
+
+ // required .ImmutableBytesWritable cachePtr = 3;
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ boolean hasCachePtr();
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable getCachePtr();
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder getCachePtrOrBuilder();
+
+ // required .ServerCacheFactory cacheFactory = 4;
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ boolean hasCacheFactory();
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory getCacheFactory();
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder getCacheFactoryOrBuilder();
+ }
+ /**
+ * Protobuf type {@code AddServerCacheRequest}
+ */
+ public static final class AddServerCacheRequest extends
+ com.google.protobuf.GeneratedMessage
+ implements AddServerCacheRequestOrBuilder {
+ // Use AddServerCacheRequest.newBuilder() to construct.
+ private AddServerCacheRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private AddServerCacheRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final AddServerCacheRequest defaultInstance;
+ public static AddServerCacheRequest getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public AddServerCacheRequest getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private AddServerCacheRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ tenantId_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ cacheId_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = cachePtr_.toBuilder();
+ }
+ cachePtr_ = input.readMessage(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(cachePtr_);
+ cachePtr_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ case 34: {
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ subBuilder = cacheFactory_.toBuilder();
+ }
+ cacheFactory_ = input.readMessage(org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(cacheFactory_);
+ cacheFactory_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000008;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<AddServerCacheRequest> PARSER =
+ new com.google.protobuf.AbstractParser<AddServerCacheRequest>() {
+ public AddServerCacheRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new AddServerCacheRequest(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<AddServerCacheRequest> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional bytes tenantId = 1;
+ public static final int TENANTID_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString tenantId_;
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public boolean hasTenantId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTenantId() {
+ return tenantId_;
+ }
+
+ // required bytes cacheId = 2;
+ public static final int CACHEID_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString cacheId_;
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public boolean hasCacheId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public com.google.protobuf.ByteString getCacheId() {
+ return cacheId_;
+ }
+
+ // required .ImmutableBytesWritable cachePtr = 3;
+ public static final int CACHEPTR_FIELD_NUMBER = 3;
+ private org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable cachePtr_;
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public boolean hasCachePtr() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable getCachePtr() {
+ return cachePtr_;
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder getCachePtrOrBuilder() {
+ return cachePtr_;
+ }
+
+ // required .ServerCacheFactory cacheFactory = 4;
+ public static final int CACHEFACTORY_FIELD_NUMBER = 4;
+ private org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory cacheFactory_;
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public boolean hasCacheFactory() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory getCacheFactory() {
+ return cacheFactory_;
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder getCacheFactoryOrBuilder() {
+ return cacheFactory_;
+ }
+
+ private void initFields() {
+ tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ cacheId_ = com.google.protobuf.ByteString.EMPTY;
+ cachePtr_ = org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance();
+ cacheFactory_ = org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasCacheId()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasCachePtr()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasCacheFactory()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getCachePtr().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getCacheFactory().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, cacheId_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, cachePtr_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeMessage(4, cacheFactory_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, cacheId_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, cachePtr_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, cacheFactory_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest other = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest) obj;
+
+ boolean result = true;
+ result = result && (hasTenantId() == other.hasTenantId());
+ if (hasTenantId()) {
+ result = result && getTenantId()
+ .equals(other.getTenantId());
+ }
+ result = result && (hasCacheId() == other.hasCacheId());
+ if (hasCacheId()) {
+ result = result && getCacheId()
+ .equals(other.getCacheId());
+ }
+ result = result && (hasCachePtr() == other.hasCachePtr());
+ if (hasCachePtr()) {
+ result = result && getCachePtr()
+ .equals(other.getCachePtr());
+ }
+ result = result && (hasCacheFactory() == other.hasCacheFactory());
+ if (hasCacheFactory()) {
+ result = result && getCacheFactory()
+ .equals(other.getCacheFactory());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasTenantId()) {
+ hash = (37 * hash) + TENANTID_FIELD_NUMBER;
+ hash = (53 * hash) + getTenantId().hashCode();
+ }
+ if (hasCacheId()) {
+ hash = (37 * hash) + CACHEID_FIELD_NUMBER;
+ hash = (53 * hash) + getCacheId().hashCode();
+ }
+ if (hasCachePtr()) {
+ hash = (37 * hash) + CACHEPTR_FIELD_NUMBER;
+ hash = (53 * hash) + getCachePtr().hashCode();
+ }
+ if (hasCacheFactory()) {
+ hash = (37 * hash) + CACHEFACTORY_FIELD_NUMBER;
+ hash = (53 * hash) + getCacheFactory().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code AddServerCacheRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getCachePtrFieldBuilder();
+ getCacheFactoryFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ cacheId_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (cachePtrBuilder_ == null) {
+ cachePtr_ = org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance();
+ } else {
+ cachePtrBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ if (cacheFactoryBuilder_ == null) {
+ cacheFactory_ = org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance();
+ } else {
+ cacheFactoryBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheRequest_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest build() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest buildPartial() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest result = new org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.tenantId_ = tenantId_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.cacheId_ = cacheId_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (cachePtrBuilder_ == null) {
+ result.cachePtr_ = cachePtr_;
+ } else {
+ result.cachePtr_ = cachePtrBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ if (cacheFactoryBuilder_ == null) {
+ result.cacheFactory_ = cacheFactory_;
+ } else {
+ result.cacheFactory_ = cacheFactoryBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest other) {
+ if (other == org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest.getDefaultInstance()) return this;
+ if (other.hasTenantId()) {
+ setTenantId(other.getTenantId());
+ }
+ if (other.hasCacheId()) {
+ setCacheId(other.getCacheId());
+ }
+ if (other.hasCachePtr()) {
+ mergeCachePtr(other.getCachePtr());
+ }
+ if (other.hasCacheFactory()) {
+ mergeCacheFactory(other.getCacheFactory());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasCacheId()) {
+
+ return false;
+ }
+ if (!hasCachePtr()) {
+
+ return false;
+ }
+ if (!hasCacheFactory()) {
+
+ return false;
+ }
+ if (!getCachePtr().isInitialized()) {
+
+ return false;
+ }
+ if (!getCacheFactory().isInitialized()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional bytes tenantId = 1;
+ private com.google.protobuf.ByteString tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public boolean hasTenantId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTenantId() {
+ return tenantId_;
+ }
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public Builder setTenantId(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ tenantId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public Builder clearTenantId() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ tenantId_ = getDefaultInstance().getTenantId();
+ onChanged();
+ return this;
+ }
+
+ // required bytes cacheId = 2;
+ private com.google.protobuf.ByteString cacheId_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public boolean hasCacheId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public com.google.protobuf.ByteString getCacheId() {
+ return cacheId_;
+ }
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public Builder setCacheId(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ cacheId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public Builder clearCacheId() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ cacheId_ = getDefaultInstance().getCacheId();
+ onChanged();
+ return this;
+ }
+
+ // required .ImmutableBytesWritable cachePtr = 3;
+ private org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable cachePtr_ = org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder> cachePtrBuilder_;
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public boolean hasCachePtr() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable getCachePtr() {
+ if (cachePtrBuilder_ == null) {
+ return cachePtr_;
+ } else {
+ return cachePtrBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public Builder setCachePtr(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable value) {
+ if (cachePtrBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ cachePtr_ = value;
+ onChanged();
+ } else {
+ cachePtrBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public Builder setCachePtr(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder builderForValue) {
+ if (cachePtrBuilder_ == null) {
+ cachePtr_ = builderForValue.build();
+ onChanged();
+ } else {
+ cachePtrBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public Builder mergeCachePtr(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable value) {
+ if (cachePtrBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ cachePtr_ != org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance()) {
+ cachePtr_ =
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.newBuilder(cachePtr_).mergeFrom(value).buildPartial();
+ } else {
+ cachePtr_ = value;
+ }
+ onChanged();
+ } else {
+ cachePtrBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public Builder clearCachePtr() {
+ if (cachePtrBuilder_ == null) {
+ cachePtr_ = org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.getDefaultInstance();
+ onChanged();
+ } else {
+ cachePtrBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder getCachePtrBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getCachePtrFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder getCachePtrOrBuilder() {
+ if (cachePtrBuilder_ != null) {
+ return cachePtrBuilder_.getMessageOrBuilder();
+ } else {
+ return cachePtr_;
+ }
+ }
+ /**
+ * <code>required .ImmutableBytesWritable cachePtr = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder>
+ getCachePtrFieldBuilder() {
+ if (cachePtrBuilder_ == null) {
+ cachePtrBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritable.Builder, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ImmutableBytesWritableOrBuilder>(
+ cachePtr_,
+ getParentForChildren(),
+ isClean());
+ cachePtr_ = null;
+ }
+ return cachePtrBuilder_;
+ }
+
+ // required .ServerCacheFactory cacheFactory = 4;
+ private org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory cacheFactory_ = org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder> cacheFactoryBuilder_;
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public boolean hasCacheFactory() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory getCacheFactory() {
+ if (cacheFactoryBuilder_ == null) {
+ return cacheFactory_;
+ } else {
+ return cacheFactoryBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public Builder setCacheFactory(org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory value) {
+ if (cacheFactoryBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ cacheFactory_ = value;
+ onChanged();
+ } else {
+ cacheFactoryBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public Builder setCacheFactory(
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder builderForValue) {
+ if (cacheFactoryBuilder_ == null) {
+ cacheFactory_ = builderForValue.build();
+ onChanged();
+ } else {
+ cacheFactoryBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public Builder mergeCacheFactory(org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory value) {
+ if (cacheFactoryBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008) &&
+ cacheFactory_ != org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance()) {
+ cacheFactory_ =
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.newBuilder(cacheFactory_).mergeFrom(value).buildPartial();
+ } else {
+ cacheFactory_ = value;
+ }
+ onChanged();
+ } else {
+ cacheFactoryBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public Builder clearCacheFactory() {
+ if (cacheFactoryBuilder_ == null) {
+ cacheFactory_ = org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance();
+ onChanged();
+ } else {
+ cacheFactoryBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ return this;
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder getCacheFactoryBuilder() {
+ bitField0_ |= 0x00000008;
+ onChanged();
+ return getCacheFactoryFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder getCacheFactoryOrBuilder() {
+ if (cacheFactoryBuilder_ != null) {
+ return cacheFactoryBuilder_.getMessageOrBuilder();
+ } else {
+ return cacheFactory_;
+ }
+ }
+ /**
+ * <code>required .ServerCacheFactory cacheFactory = 4;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder>
+ getCacheFactoryFieldBuilder() {
+ if (cacheFactoryBuilder_ == null) {
+ cacheFactoryBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder>(
+ cacheFactory_,
+ getParentForChildren(),
+ isClean());
+ cacheFactory_ = null;
+ }
+ return cacheFactoryBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:AddServerCacheRequest)
+ }
+
+ static {
+ defaultInstance = new AddServerCacheRequest(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:AddServerCacheRequest)
+ }
+
+ public interface AddServerCacheResponseOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bool return = 1;
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ boolean hasReturn();
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ boolean getReturn();
+ }
+ /**
+ * Protobuf type {@code AddServerCacheResponse}
+ */
+ public static final class AddServerCacheResponse extends
+ com.google.protobuf.GeneratedMessage
+ implements AddServerCacheResponseOrBuilder {
+ // Use AddServerCacheResponse.newBuilder() to construct.
+ private AddServerCacheResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private AddServerCacheResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final AddServerCacheResponse defaultInstance;
+ public static AddServerCacheResponse getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public AddServerCacheResponse getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private AddServerCacheResponse(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ return_ = input.readBool();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheResponse_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<AddServerCacheResponse> PARSER =
+ new com.google.protobuf.AbstractParser<AddServerCacheResponse>() {
+ public AddServerCacheResponse parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new AddServerCacheResponse(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<AddServerCacheResponse> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bool return = 1;
+ public static final int RETURN_FIELD_NUMBER = 1;
+ private boolean return_;
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public boolean hasReturn() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public boolean getReturn() {
+ return return_;
+ }
+
+ private void initFields() {
+ return_ = false;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasReturn()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBool(1, return_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(1, return_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse other = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse) obj;
+
+ boolean result = true;
+ result = result && (hasReturn() == other.hasReturn());
+ if (hasReturn()) {
+ result = result && (getReturn()
+ == other.getReturn());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasReturn()) {
+ hash = (37 * hash) + RETURN_FIELD_NUMBER;
+ hash = (53 * hash) + hashBoolean(getReturn());
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code AddServerCacheResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponseOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheResponse_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return_ = false;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_AddServerCacheResponse_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse build() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse buildPartial() {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse result = new org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.return_ = return_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse other) {
+ if (other == org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse.getDefaultInstance()) return this;
+ if (other.hasReturn()) {
+ setReturn(other.getReturn());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasReturn()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required bool return = 1;
+ private boolean return_ ;
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public boolean hasReturn() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public boolean getReturn() {
+ return return_;
+ }
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public Builder setReturn(boolean value) {
+ bitField0_ |= 0x00000001;
+ return_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bool return = 1;</code>
+ */
+ public Builder clearReturn() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return_ = false;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:AddServerCacheResponse)
+ }
+
+ static {
+ defaultInstance = new AddServerCacheResponse(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:AddServerCacheResponse)
+ }
+
+ public interface RemoveServerCacheRequestOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional bytes tenantId = 1;
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ boolean hasTenantId();
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ com.google.protobuf.ByteString getTenantId();
+
+ // required bytes cacheId = 2;
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ boolean hasCacheId();
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ com.google.protobuf.ByteString getCacheId();
+ }
+ /**
+ * Protobuf type {@code RemoveServerCacheRequest}
+ */
+ public static final class RemoveServerCacheRequest extends
+ com.google.protobuf.GeneratedMessage
+ implements RemoveServerCacheRequestOrBuilder {
+ // Use RemoveServerCacheRequest.newBuilder() to construct.
+ private RemoveServerCacheRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private RemoveServerCacheRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final RemoveServerCacheRequest defaultInstance;
+ public static RemoveServerCacheRequest getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public RemoveServerCacheRequest getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private RemoveServerCacheRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ tenantId_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ cacheId_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_RemoveServerCacheRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCachingProtos.internal_static_RemoveServerCacheRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest.class, org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<RemoveServerCacheRequest> PARSER =
+ new com.google.protobuf.AbstractParser<RemoveServerCacheRequest>() {
+ public RemoveServerCacheRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new RemoveServerCacheRequest(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<RemoveServerCacheRequest> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional bytes tenantId = 1;
+ public static final int TENANTID_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString tenantId_;
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public boolean hasTenantId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional bytes tenantId = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTenantId() {
+ return tenantId_;
+ }
+
+ // required bytes cacheId = 2;
+ public static final int CACHEID_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString cacheId_;
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public boolean hasCacheId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes cacheId = 2;</code>
+ */
+ public com.google.protobuf.ByteString getCacheId() {
+ return cacheId_;
+ }
+
+ private void initFields() {
+ tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ cacheId_ = com.google.protobuf.ByteString.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasCacheId()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, cacheId_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, cacheId_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest other = (org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest) obj;
+
+ boolean result = true;
+ result = result && (hasTenantId() == other.hasTenantId());
+ if (hasTenantId()) {
+ result = result && getTenantId()
+ .equals(other.getTenantId());
+ }
+ result = result && (hasCacheId() == other.hasCacheId
<TRUNCATED>
[08/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 325c3a7..54eb014 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -19,25 +19,22 @@
*/
package org.apache.phoenix.coprocessor;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
import java.util.Collections;
import java.util.List;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableUtils;
-
-import com.google.common.collect.Lists;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
import org.apache.phoenix.schema.PColumn;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.schema.PTableImpl;
import org.apache.phoenix.util.ByteUtil;
import org.apache.phoenix.util.MetaDataUtil;
+import com.google.common.collect.Lists;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.HBaseZeroCopyByteString;
+
/**
*
@@ -56,7 +53,7 @@ import org.apache.phoenix.util.MetaDataUtil;
*
* @since 0.1
*/
-public interface MetaDataProtocol extends CoprocessorProtocol {
+public abstract class MetaDataProtocol extends MetaDataService {
public static final int PHOENIX_MAJOR_VERSION = 3;
public static final int PHOENIX_MINOR_VERSION = 0;
public static final int PHOENIX_PATCH_NUMBER = 0;
@@ -92,7 +89,7 @@ public interface MetaDataProtocol extends CoprocessorProtocol {
PARENT_TABLE_NOT_FOUND
};
- public static class MetaDataMutationResult implements Writable {
+ public static class MetaDataMutationResult {
private MutationCode returnCode;
private long mutationTime;
private PTable table;
@@ -156,114 +153,54 @@ public interface MetaDataProtocol extends CoprocessorProtocol {
return familyName;
}
- @Override
- public void readFields(DataInput input) throws IOException {
- this.returnCode = MutationCode.values()[WritableUtils.readVInt(input)];
- this.mutationTime = input.readLong();
- wasUpdated = input.readBoolean();
- if (wasUpdated) {
- this.table = new PTableImpl();
- this.table.readFields(input);
- }
- columnName = Bytes.readByteArray(input);
- if (columnName.length > 0) {
- familyName = Bytes.readByteArray(input);
- }
- boolean hasTablesToDelete = input.readBoolean();
- if (hasTablesToDelete) {
- int count = input.readInt();
- tableNamesToDelete = Lists.newArrayListWithExpectedSize(count);
- for( int i = 0 ; i < count ; i++ ){
- byte[] tableName = Bytes.readByteArray(input);
- tableNamesToDelete.add(tableName);
- }
+ public static MetaDataMutationResult constructFromProto(MetaDataResponse proto) {
+ MetaDataMutationResult result = new MetaDataMutationResult();
+ result.returnCode = MutationCode.values()[proto.getReturnCode().ordinal()];
+ result.mutationTime = proto.getMutationTime();
+ if (proto.hasTable()) {
+ result.wasUpdated = true;
+ result.table = PTableImpl.createFromProto(proto.getTable());
+ }
+ if (proto.getTablesToDeleteCount() > 0) {
+ result.tableNamesToDelete =
+ Lists.newArrayListWithExpectedSize(proto.getTablesToDeleteCount());
+ for (ByteString tableName : proto.getTablesToDeleteList()) {
+ result.tableNamesToDelete.add(tableName.toByteArray());
}
+ }
+ result.columnName = ByteUtil.EMPTY_BYTE_ARRAY;
+ if(proto.hasColumnName()){
+ result.columnName = proto.getColumnName().toByteArray();
+ }
+ if(proto.hasFamilyName()){
+ result.familyName = proto.getFamilyName().toByteArray();
+ }
+ return result;
}
-
- @Override
- public void write(DataOutput output) throws IOException {
- WritableUtils.writeVInt(output, returnCode.ordinal());
- output.writeLong(mutationTime);
- output.writeBoolean(table != null);
- if (table != null) {
- table.write(output);
+
+ public static MetaDataResponse toProto(MetaDataMutationResult result) {
+ MetaDataProtos.MetaDataResponse.Builder builder =
+ MetaDataProtos.MetaDataResponse.newBuilder();
+ if (result != null) {
+ builder.setReturnCode(MetaDataProtos.MutationCode.values()[result.getMutationCode()
+ .ordinal()]);
+ builder.setMutationTime(result.getMutationTime());
+ if (result.table != null) {
+ builder.setTable(PTableImpl.toProto(result.table));
}
- Bytes.writeByteArray(output, columnName == null ? ByteUtil.EMPTY_BYTE_ARRAY : columnName);
- if (columnName != null) {
- Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName);
+ if (result.getTableNamesToDelete() != null) {
+ for (byte[] tableName : result.tableNamesToDelete) {
+ builder.addTablesToDelete(HBaseZeroCopyByteString.wrap(tableName));
+ }
}
- if(tableNamesToDelete != null && tableNamesToDelete.size() > 0 ) {
- output.writeBoolean(true);
- output.writeInt(tableNamesToDelete.size());
- for(byte[] tableName : tableNamesToDelete) {
- Bytes.writeByteArray(output,tableName);
- }
-
- } else {
- output.writeBoolean(false);
+ if(result.getColumnName() != null){
+ builder.setColumnName(HBaseZeroCopyByteString.wrap(result.getColumnName()));
}
-
+ if(result.getFamilyName() != null){
+ builder.setFamilyName(HBaseZeroCopyByteString.wrap(result.getFamilyName()));
+ }
+ }
+ return builder.build();
}
}
-
- /**
- * The the latest Phoenix table at or before the given clientTimestamp. If the
- * client already has the latest (based on the tableTimestamp), then no table
- * is returned.
- * @param tenantId
- * @param schemaName
- * @param tableName
- * @param tableTimestamp
- * @param clientTimestamp
- * @return MetaDataMutationResult
- * @throws IOException
- */
- MetaDataMutationResult getTable(byte[] tenantId, byte[] schemaName, byte[] tableName, long tableTimestamp, long clientTimestamp) throws IOException;
-
- /**
- * Create a new Phoenix table
- * @param tableMetadata
- * @return MetaDataMutationResult
- * @throws IOException
- */
- MetaDataMutationResult createTable(List<Mutation> tableMetadata) throws IOException;
-
- /**
- * Drop an existing Phoenix table
- * @param tableMetadata
- * @param tableType
- * @return MetaDataMutationResult
- * @throws IOException
- */
- MetaDataMutationResult dropTable(List<Mutation> tableMetadata, String tableType) throws IOException;
-
- /**
- * Add a column to an existing Phoenix table
- * @param tableMetadata
- * @return MetaDataMutationResult
- * @throws IOException
- */
- MetaDataMutationResult addColumn(List<Mutation> tableMetadata) throws IOException;
-
- /**
- * Drop a column from an existing Phoenix table
- * @param tableMetadata
- * @return MetaDataMutationResult
- * @throws IOException
- */
- MetaDataMutationResult dropColumn(List<Mutation> tableMetadata) throws IOException;
-
- MetaDataMutationResult updateIndexState(List<Mutation> tableMetadata) throws IOException;
-
- /**
- * Clears the server-side cache of table meta data. Used between test runs to
- * ensure no side effects.
- */
- void clearCache();
-
- /**
- * Get the version of the server-side HBase and phoenix.jar. Used when initially connecting
- * to a cluster to ensure that the client and server jars are compatible.
- */
- long getVersion();
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
index 543cde0..a153e73 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
@@ -26,6 +26,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
@@ -186,7 +187,7 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
try {
if (isFilterDone()) {
return false;
@@ -211,6 +212,11 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
} finally {
chunk.close(); }
}
+
+ @Override
+ public long getMaxResultSize() {
+ return s.getMaxResultSize();
+ }
};
}
@@ -224,7 +230,7 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
return new RegionScanner() {
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
try {
return s.next(results);
} catch (Throwable t) {
@@ -234,17 +240,7 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean next(List<KeyValue> results, String metric) throws IOException {
- try {
- return s.next(results, metric);
- } catch (Throwable t) {
- ServerUtil.throwIOException(c.getEnvironment().getRegion().getRegionNameAsString(), t);
- return false; // impossible
- }
- }
-
- @Override
- public boolean next(List<KeyValue> result, int limit) throws IOException {
+ public boolean next(List<Cell> result, int limit) throws IOException {
try {
return s.next(result, limit);
} catch (Throwable t) {
@@ -254,16 +250,6 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean next(List<KeyValue> result, int limit, String metric) throws IOException {
- try {
- return s.next(result, limit, metric);
- } catch (Throwable t) {
- ServerUtil.throwIOException(c.getEnvironment().getRegion().getRegionNameAsString(), t);
- return false; // impossible
- }
- }
-
- @Override
public void close() throws IOException {
s.close();
}
@@ -274,7 +260,7 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean isFilterDone() {
+ public boolean isFilterDone() throws IOException {
return s.isFilterDone();
}
@@ -289,9 +275,9 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean nextRaw(List<KeyValue> result, String metric) throws IOException {
+ public boolean nextRaw(List<Cell> result) throws IOException {
try {
- return s.nextRaw(result, metric);
+ return s.nextRaw(result);
} catch (Throwable t) {
ServerUtil.throwIOException(c.getEnvironment().getRegion().getRegionNameAsString(), t);
return false; // impossible
@@ -299,14 +285,19 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean nextRaw(List<KeyValue> result, int limit, String metric) throws IOException {
+ public boolean nextRaw(List<Cell> result, int limit) throws IOException {
try {
- return s.nextRaw(result, limit, metric);
+ return s.nextRaw(result, limit);
} catch (Throwable t) {
ServerUtil.throwIOException(c.getEnvironment().getRegion().getRegionNameAsString(), t);
return false; // impossible
}
}
+
+ @Override
+ public long getMaxResultSize() {
+ return s.getMaxResultSize();
+ }
};
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java
index f1bebd4..e82d4ee 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java
@@ -4,8 +4,9 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.NavigableMap;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Append;
@@ -20,10 +21,9 @@ import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.HRegion.RowLock;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.hadoop.hbase.util.Pair;
-
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.query.QueryConstants;
@@ -34,6 +34,8 @@ import org.apache.phoenix.util.KeyValueUtil;
import org.apache.phoenix.util.MetaDataUtil;
import org.apache.phoenix.util.ServerUtil;
+import com.google.common.collect.Lists;
+
/**
*
* Region observer coprocessor for sequence operations:
@@ -58,11 +60,21 @@ public class SequenceRegionObserver extends BaseRegionObserver {
private static Result getErrorResult(byte[] row, long timestamp, int errorCode) {
byte[] errorCodeBuf = new byte[PDataType.INTEGER.getByteSize()];
PDataType.INTEGER.getCodec().encodeInt(errorCode, errorCodeBuf, 0);
- return new Result(Collections.singletonList(
- KeyValueUtil.newKeyValue(row,
+ return Result.create(Collections.singletonList(
+ (Cell)KeyValueUtil.newKeyValue(row,
PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES,
QueryConstants.EMPTY_COLUMN_BYTES, timestamp, errorCodeBuf)));
}
+
+ private static void acquireLock(HRegion region, byte[] key, List<RowLock> locks)
+ throws IOException {
+ RowLock rowLock = region.getRowLock(key);
+ if (rowLock == null) {
+ throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
+ }
+ locks.add(rowLock);
+ }
+
/**
*
* Use PreIncrement hook of BaseRegionObserver to overcome deficiencies in Increment
@@ -83,10 +95,11 @@ public class SequenceRegionObserver extends BaseRegionObserver {
e.complete();
HRegion region = env.getRegion();
byte[] row = increment.getRow();
+ List<RowLock> locks = Lists.newArrayList();
TimeRange tr = increment.getTimeRange();
region.startRegionOperation();
try {
- Integer lid = region.getLock(null, row, true);
+ acquireLock(region, row, locks);
try {
long maxTimestamp = tr.getMax();
if (maxTimestamp == HConstants.LATEST_TIMESTAMP) {
@@ -95,10 +108,10 @@ public class SequenceRegionObserver extends BaseRegionObserver {
}
Get get = new Get(row);
get.setTimeRange(tr.getMin(), tr.getMax());
- for (Map.Entry<byte[],NavigableMap<byte[], Long>> entry : increment.getFamilyMap().entrySet()) {
+ for (Map.Entry<byte[], List<Cell>> entry : increment.getFamilyCellMap().entrySet()) {
byte[] cf = entry.getKey();
- for (byte[] cq : entry.getValue().keySet()) {
- get.addColumn(cf, cq);
+ for (Cell cq : entry.getValue()) {
+ get.addColumn(cf, CellUtil.cloneQualifier(cq));
}
}
Result result = region.get(get);
@@ -108,24 +121,26 @@ public class SequenceRegionObserver extends BaseRegionObserver {
KeyValue currentValueKV = Sequence.getCurrentValueKV(result);
KeyValue incrementByKV = Sequence.getIncrementByKV(result);
KeyValue cacheSizeKV = Sequence.getCacheSizeKV(result);
- long value = PDataType.LONG.getCodec().decodeLong(currentValueKV.getBuffer(), currentValueKV.getValueOffset(), null);
- long incrementBy = PDataType.LONG.getCodec().decodeLong(incrementByKV.getBuffer(), incrementByKV.getValueOffset(), null);
- int cacheSize = PDataType.INTEGER.getCodec().decodeInt(cacheSizeKV.getBuffer(), cacheSizeKV.getValueOffset(), null);
+ long value = PDataType.LONG.getCodec().decodeLong(currentValueKV.getValueArray(), currentValueKV.getValueOffset(), null);
+ long incrementBy = PDataType.LONG.getCodec().decodeLong(incrementByKV.getValueArray(), incrementByKV.getValueOffset(), null);
+ int cacheSize = PDataType.INTEGER.getCodec().decodeInt(cacheSizeKV.getValueArray(), cacheSizeKV.getValueOffset(), null);
value += incrementBy * cacheSize;
byte[] valueBuffer = new byte[PDataType.LONG.getByteSize()];
PDataType.LONG.getCodec().encodeLong(value, valueBuffer, 0);
Put put = new Put(row, currentValueKV.getTimestamp());
// Hold timestamp constant for sequences, so that clients always only see the latest value
// regardless of when they connect.
- KeyValue newCurrentValueKV = KeyValueUtil.newKeyValue(row, currentValueKV.getFamily(), currentValueKV.getQualifier(), currentValueKV.getTimestamp(), valueBuffer);
+ KeyValue newCurrentValueKV = KeyValueUtil.newKeyValue(row, 0, row.length,
+ currentValueKV.getFamilyArray(), currentValueKV.getFamilyOffset(), currentValueKV.getFamilyLength(),
+ currentValueKV.getQualifierArray(), currentValueKV.getQualifierOffset(), currentValueKV.getQualifierLength(),
+ currentValueKV.getTimestamp(), valueBuffer, 0, valueBuffer.length);
+
put.add(newCurrentValueKV);
- @SuppressWarnings("unchecked")
- Pair<Mutation,Integer>[] mutations = new Pair[1];
- mutations[0] = new Pair<Mutation,Integer>(put, lid);
+ Mutation[] mutations = new Mutation[]{put};
region.batchMutate(mutations);
return Sequence.replaceCurrentValueKV(result, newCurrentValueKV);
} finally {
- region.releaseRowLock(lid);
+ region.releaseRowLocks(locks);
}
} catch (Throwable t) {
ServerUtil.throwIOException("Increment of sequence " + Bytes.toStringBinary(row), t);
@@ -149,7 +164,7 @@ public class SequenceRegionObserver extends BaseRegionObserver {
return null;
}
Op op = Op.values()[opBuf[0]];
- KeyValue keyValue = append.getFamilyMap().values().iterator().next().iterator().next();
+ Cell keyValue = append.getFamilyCellMap().values().iterator().next().iterator().next();
long clientTimestamp = HConstants.LATEST_TIMESTAMP;
long minGetTimestamp = MetaDataProtocol.MIN_TABLE_TIMESTAMP;
@@ -187,12 +202,13 @@ public class SequenceRegionObserver extends BaseRegionObserver {
e.complete();
HRegion region = env.getRegion();
byte[] row = append.getRow();
+ List<RowLock> locks = Lists.newArrayList();
region.startRegionOperation();
try {
- Integer lid = region.getLock(null, row, true);
+ acquireLock(region, row, locks);
try {
- byte[] family = keyValue.getFamily();
- byte[] qualifier = keyValue.getQualifier();
+ byte[] family = CellUtil.cloneFamily(keyValue);
+ byte[] qualifier = CellUtil.cloneQualifier(keyValue);
Get get = new Get(row);
get.setTimeRange(minGetTimestamp, maxGetTimestamp);
@@ -212,40 +228,42 @@ public class SequenceRegionObserver extends BaseRegionObserver {
case RETURN_SEQUENCE:
KeyValue currentValueKV = result.raw()[0];
long expectedValue = PDataType.LONG.getCodec().decodeLong(append.getAttribute(CURRENT_VALUE_ATTRIB), 0, null);
- long value = PDataType.LONG.getCodec().decodeLong(currentValueKV.getBuffer(), currentValueKV.getValueOffset(), null);
+ long value = PDataType.LONG.getCodec().decodeLong(currentValueKV.getValueArray(),
+ currentValueKV.getValueOffset(), null);
// Timestamp should match exactly, or we may have the wrong sequence
if (expectedValue != value || currentValueKV.getTimestamp() != clientTimestamp) {
- return new Result(Collections.singletonList(KeyValueUtil.newKeyValue(row, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, currentValueKV.getTimestamp(), ByteUtil.EMPTY_BYTE_ARRAY)));
+ return Result.create(Collections.singletonList(
+ (Cell)KeyValueUtil.newKeyValue(row, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES,
+ QueryConstants.EMPTY_COLUMN_BYTES, currentValueKV.getTimestamp(), ByteUtil.EMPTY_BYTE_ARRAY)));
}
m = new Put(row, currentValueKV.getTimestamp());
- m.getFamilyMap().putAll(append.getFamilyMap());
+ m.getFamilyCellMap().putAll(append.getFamilyCellMap());
break;
case DROP_SEQUENCE:
- m = new Delete(row, clientTimestamp, null);
+ m = new Delete(row, clientTimestamp);
break;
case CREATE_SEQUENCE:
m = new Put(row, clientTimestamp);
- m.getFamilyMap().putAll(append.getFamilyMap());
+ m.getFamilyCellMap().putAll(append.getFamilyCellMap());
break;
}
if (!hadClientTimestamp) {
- for (List<KeyValue> kvs : m.getFamilyMap().values()) {
- for (KeyValue kv : kvs) {
- kv.updateLatestStamp(clientTimestampBuf);
+ for (List<Cell> kvs : m.getFamilyCellMap().values()) {
+ for (Cell kv : kvs) {
+ ((KeyValue)kv).updateLatestStamp(clientTimestampBuf);
}
}
}
- @SuppressWarnings("unchecked")
- Pair<Mutation,Integer>[] mutations = new Pair[1];
- mutations[0] = new Pair<Mutation,Integer>(m, lid);
+ Mutation[] mutations = new Mutation[]{m};
region.batchMutate(mutations);
long serverTimestamp = MetaDataUtil.getClientTimeStamp(m);
// Return result with single KeyValue. The only piece of information
// the client cares about is the timestamp, which is the timestamp of
// when the mutation was actually performed (useful in the case of .
- return new Result(Collections.singletonList(KeyValueUtil.newKeyValue(row, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, serverTimestamp, SUCCESS_VALUE)));
+ return Result.create(Collections.singletonList(
+ (Cell)KeyValueUtil.newKeyValue(row, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, serverTimestamp, SUCCESS_VALUE)));
} finally {
- region.releaseRowLock(lid);
+ region.releaseRowLocks(locks);
}
} catch (Throwable t) {
ServerUtil.throwIOException("Increment of sequence " + Bytes.toStringBinary(row), t);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
index e624c9a..9331547 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
@@ -19,18 +19,29 @@
*/
package org.apache.phoenix.coprocessor;
+import java.io.IOException;
import java.sql.SQLException;
-import org.apache.hadoop.hbase.coprocessor.BaseEndpointCoprocessor;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.phoenix.cache.GlobalCache;
import org.apache.phoenix.cache.TenantCache;
+import org.apache.phoenix.coprocessor.ServerCachingProtocol.ServerCacheFactory;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheResponse;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ServerCachingService;
+import org.apache.phoenix.protobuf.ProtobufUtil;
-
-
+import com.google.protobuf.RpcCallback;
+import com.google.protobuf.RpcController;
+import com.google.protobuf.Service;
/**
*
@@ -39,19 +50,74 @@ import org.apache.phoenix.cache.TenantCache;
*
* @since 0.1
*/
-public class ServerCachingEndpointImpl extends BaseEndpointCoprocessor implements ServerCachingProtocol {
+public class ServerCachingEndpointImpl extends ServerCachingService implements CoprocessorService,
+ Coprocessor {
+
+ private RegionCoprocessorEnvironment env;
- @Override
- public boolean addServerCache(byte[] tenantId, byte[] cacheId, ImmutableBytesWritable cachePtr, ServerCacheFactory cacheFactory) throws SQLException {
- TenantCache tenantCache = GlobalCache.getTenantCache((RegionCoprocessorEnvironment)this.getEnvironment(), tenantId == null ? null : new ImmutableBytesPtr(tenantId));
- tenantCache.addServerCache(new ImmutableBytesPtr(cacheId), cachePtr, cacheFactory);
- return true;
+ @Override
+ public void addServerCache(RpcController controller, AddServerCacheRequest request,
+ RpcCallback<AddServerCacheResponse> done) {
+ ImmutableBytesPtr tenantId = null;
+ if (request.hasTenantId()) {
+ tenantId = new ImmutableBytesPtr(request.getTenantId().toByteArray());
}
+ TenantCache tenantCache = GlobalCache.getTenantCache(this.env, tenantId);
+ ImmutableBytesWritable cachePtr =
+ org.apache.phoenix.protobuf.ProtobufUtil
+ .toImmutableBytesWritable(request.getCachePtr());
- @Override
- public boolean removeServerCache(byte[] tenantId, byte[] cacheId) throws SQLException {
- TenantCache tenantCache = GlobalCache.getTenantCache((RegionCoprocessorEnvironment)this.getEnvironment(), tenantId == null ? null : new ImmutableBytesPtr(tenantId));
- tenantCache.removeServerCache(new ImmutableBytesPtr(cacheId));
- return true;
+ try {
+ @SuppressWarnings("unchecked")
+ Class<ServerCacheFactory> serverCacheFactoryClass =
+ (Class<ServerCacheFactory>) Class.forName(request.getCacheFactory().getClassName());
+ ServerCacheFactory cacheFactory = serverCacheFactoryClass.newInstance();
+ tenantCache.addServerCache(new ImmutableBytesPtr(request.getCacheId().toByteArray()),
+ cachePtr, cacheFactory);
+ } catch (Throwable e) {
+ ProtobufUtil.setControllerException(controller, new IOException(e));
}
+ AddServerCacheResponse.Builder responseBuilder = AddServerCacheResponse.newBuilder();
+ responseBuilder.setReturn(true);
+ AddServerCacheResponse result = responseBuilder.build();
+ done.run(result);
+ }
+
+ @Override
+ public void removeServerCache(RpcController controller, RemoveServerCacheRequest request,
+ RpcCallback<RemoveServerCacheResponse> done) {
+ ImmutableBytesPtr tenantId = null;
+ if (request.hasTenantId()) {
+ tenantId = new ImmutableBytesPtr(request.getTenantId().toByteArray());
+ }
+ TenantCache tenantCache = GlobalCache.getTenantCache(this.env, tenantId);
+ try {
+ tenantCache.removeServerCache(new ImmutableBytesPtr(request.getCacheId().toByteArray()));
+ } catch (SQLException e) {
+ ProtobufUtil.setControllerException(controller, new IOException(e));
+ }
+ RemoveServerCacheResponse.Builder responseBuilder = RemoveServerCacheResponse.newBuilder();
+ responseBuilder.setReturn(true);
+ RemoveServerCacheResponse result = responseBuilder.build();
+ done.run(result);
+ }
+
+ @Override
+ public void start(CoprocessorEnvironment env) throws IOException {
+ if (env instanceof RegionCoprocessorEnvironment) {
+ this.env = (RegionCoprocessorEnvironment) env;
+ } else {
+ throw new CoprocessorException("Must be loaded on a table region!");
+ }
+ }
+
+ @Override
+ public void stop(CoprocessorEnvironment arg0) throws IOException {
+ // nothing to do
+ }
+
+ @Override
+ public Service getService() {
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java
index 3c6123d..3115216 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java
@@ -23,7 +23,6 @@ import java.io.Closeable;
import java.sql.SQLException;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
import org.apache.hadoop.io.Writable;
import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
@@ -37,7 +36,7 @@ import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
*
* @since 0.1
*/
-public interface ServerCachingProtocol extends CoprocessorProtocol {
+public interface ServerCachingProtocol {
public static interface ServerCacheFactory extends Writable {
public Closeable newCache(ImmutableBytesWritable cachePtr, MemoryChunk chunk) throws SQLException;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 9207588..42de847 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -36,6 +36,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
@@ -47,10 +48,8 @@ import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.regionserver.HRegion;
-import org.apache.hadoop.hbase.regionserver.MultiVersionConsistencyControl;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.io.WritableUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +57,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.phoenix.client.KeyValueBuilder;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
import org.apache.phoenix.exception.ValueTypeIncompatibleException;
import org.apache.phoenix.expression.Expression;
import org.apache.phoenix.expression.ExpressionType;
@@ -90,7 +90,8 @@ import org.apache.phoenix.util.SchemaUtil;
* @since 0.1
*/
public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver {
- private static final Logger logger = LoggerFactory.getLogger(UngroupedAggregateRegionObserver.class);
+ private static final Logger logger = LoggerFactory.getLogger(UngroupedAggregateRegionObserver.class);
+
// TODO: move all constants into a single class
public static final String UNGROUPED_AGG = "UngroupedAgg";
public static final String DELETE_AGG = "DeleteAgg";
@@ -107,16 +108,16 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
this.kvBuilder = KeyValueBuilder.get(e.getHBaseVersion());
}
- private static void commitBatch(HRegion region, List<Pair<Mutation,Integer>> mutations, byte[] indexUUID) throws IOException {
- if (indexUUID != null) {
- for (Pair<Mutation,Integer> pair : mutations) {
- pair.getFirst().setAttribute(PhoenixIndexCodec.INDEX_UUID, indexUUID);
- }
- }
- @SuppressWarnings("unchecked")
- Pair<Mutation,Integer>[] mutationArray = new Pair[mutations.size()];
- // TODO: should we use the one that is all or none?
- region.batchMutate(mutations.toArray(mutationArray));
+ private static void commitBatch(HRegion region, List<Mutation> mutations, byte[] indexUUID) throws IOException {
+ if (indexUUID != null) {
+ for (Mutation m : mutations) {
+ m.setAttribute(PhoenixIndexCodec.INDEX_UUID, indexUUID);
+ }
+ }
+ @SuppressWarnings("unchecked")
+ Mutation[] mutationArray = new Mutation[mutations.size()];
+ // TODO: should we use the one that is all or none?
+ region.batchMutate(mutations.toArray(mutationArray));
}
public static void serializeIntoScan(Scan scan) {
@@ -168,7 +169,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
int batchSize = 0;
long ts = scan.getTimeRange().getMax();
HRegion region = c.getEnvironment().getRegion();
- List<Pair<Mutation,Integer>> mutations = Collections.emptyList();
+ List<Mutation> mutations = Collections.emptyList();
if (isDelete || isUpsert || (deleteCQ != null && deleteCF != null) || emptyCF != null) {
// TODO: size better
mutations = Lists.newArrayListWithExpectedSize(1024);
@@ -184,17 +185,16 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
logger.info("Starting ungrouped coprocessor scan " + scan);
}
long rowCount = 0;
- MultiVersionConsistencyControl.setThreadReadPoint(innerScanner.getMvccReadPoint());
region.startRegionOperation();
try {
do {
- List<KeyValue> results = new ArrayList<KeyValue>();
+ List<Cell> results = new ArrayList<Cell>();
// Results are potentially returned even when the return value of s.next is false
// since this is an indication of whether or not there are more values after the
// ones returned
- hasMore = innerScanner.nextRaw(results, null);
+ hasMore = innerScanner.nextRaw(results);
if (!results.isEmpty()) {
- rowCount++;
+ rowCount++;
result.setKeyValues(results);
try {
if (isDelete) {
@@ -202,8 +202,10 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
// FIXME: the version of the Delete constructor without the lock args was introduced
// in 0.94.4, thus if we try to use it here we can no longer use the 0.94.2 version
// of the client.
- Delete delete = new Delete(results.get(0).getRow(),ts,null);
- mutations.add(new Pair<Mutation,Integer>(delete,null));
+ Cell firstKV = results.get(0);
+ Delete delete = new Delete(firstKV.getRowArray(), firstKV.getRowOffset(),
+ firstKV.getRowLength(),ts);
+ mutations.add(delete);
} else if (isUpsert) {
Arrays.fill(values, null);
int i = 0;
@@ -246,15 +248,16 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
}
}
for (Mutation mutation : row.toRowMutations()) {
- mutations.add(new Pair<Mutation,Integer>(mutation,null));
+ mutations.add(mutation);
}
} else if (deleteCF != null && deleteCQ != null) {
// No need to search for delete column, since we project only it
// if no empty key value is being set
if (emptyCF == null || result.getValue(deleteCF, deleteCQ) != null) {
- Delete delete = new Delete(results.get(0).getRow());
+ Delete delete = new Delete(results.get(0).getRowArray(), results.get(0).getRowOffset(),
+ results.get(0).getRowLength());
delete.deleteColumns(deleteCF, deleteCQ, ts);
- mutations.add(new Pair<Mutation,Integer>(delete,null));
+ mutations.add(delete);
}
}
if (emptyCF != null) {
@@ -267,18 +270,18 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
* We insert one empty key value per row per timestamp.
*/
Set<Long> timeStamps = Sets.newHashSetWithExpectedSize(results.size());
- for (KeyValue kv : results) {
+ for (Cell kv : results) {
long kvts = kv.getTimestamp();
if (!timeStamps.contains(kvts)) {
- Put put = new Put(kv.getRow());
+ Put put = new Put(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength());
put.add(emptyCF, QueryConstants.EMPTY_COLUMN_BYTES, kvts, ByteUtil.EMPTY_BYTE_ARRAY);
- mutations.add(new Pair<Mutation,Integer>(put,null));
+ mutations.add(put);
}
}
}
// Commit in batches based on UPSERT_BATCH_SIZE_ATTRIB in config
if (!mutations.isEmpty() && batchSize > 0 && mutations.size() % batchSize == 0) {
- commitBatch(region,mutations, indexUUID);
+ commitBatch(region, mutations, indexUUID);
mutations.clear();
}
} catch (ConstraintViolationException e) {
@@ -330,32 +333,28 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
}
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
if (done) return false;
done = true;
results.add(aggKeyValue);
return false;
}
+
+ @Override
+ public long getMaxResultSize() {
+ return scan.getMaxResultSize();
+ }
};
return scanner;
}
private static PTable deserializeTable(byte[] b) {
- ByteArrayInputStream stream = new ByteArrayInputStream(b);
try {
- DataInputStream input = new DataInputStream(stream);
- PTable table = new PTableImpl();
- table.readFields(input);
- return table;
+ PTableProtos.PTable ptableProto = PTableProtos.PTable.parseFrom(b);
+ return PTableImpl.createFromProto(ptableProto);
} catch (IOException e) {
throw new RuntimeException(e);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ }
}
private static List<Expression> deserializeExpressions(byte[] b) {
@@ -383,20 +382,8 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
}
public static byte[] serialize(PTable projectedTable) {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- try {
- DataOutputStream output = new DataOutputStream(stream);
- projectedTable.write(output);
- return stream.toByteArray();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ PTableProtos.PTable ptableProto = PTableImpl.toProto(projectedTable);
+ return ptableProto.toByteArray();
}
public static byte[] serialize(List<Expression> selectExpressions) {
[09/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index bc357b1..cc0dc05 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -52,8 +52,6 @@ import static org.apache.phoenix.schema.PTableType.INDEX;
import static org.apache.phoenix.util.SchemaUtil.getVarCharLength;
import static org.apache.phoenix.util.SchemaUtil.getVarChars;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
@@ -63,14 +61,19 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.coprocessor.BaseEndpointCoprocessor;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterBase;
@@ -80,11 +83,25 @@ import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.hadoop.hbase.index.util.IndexManagementUtil;
import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.HRegion.RowLock;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.phoenix.cache.GlobalCache;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.AddColumnRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.DropColumnRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.DropTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetVersionRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetVersionResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.UpdateIndexStateRequest;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.protobuf.ProtobufUtil;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.AmbiguousColumnException;
import org.apache.phoenix.schema.ColumnFamilyNotFoundException;
@@ -113,6 +130,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
+import com.google.protobuf.RpcCallback;
+import com.google.protobuf.RpcController;
+import com.google.protobuf.Service;
/**
*
@@ -129,7 +149,7 @@ import com.google.common.collect.Lists;
*
* @since 0.1
*/
-public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements MetaDataProtocol {
+public class MetaDataEndpointImpl extends MetaDataProtocol implements CoprocessorService, Coprocessor {
private static final Logger logger = LoggerFactory.getLogger(MetaDataEndpointImpl.class);
// KeyValues for Table
@@ -203,7 +223,8 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
private static final int COLUMN_SIZE_INDEX = COLUMN_KV_COLUMNS.indexOf(COLUMN_SIZE_KV);
private static final int NULLABLE_INDEX = COLUMN_KV_COLUMNS.indexOf(NULLABLE_KV);
private static final int SQL_DATA_TYPE_INDEX = COLUMN_KV_COLUMNS.indexOf(DATA_TYPE_KV);
- private static final int ORDINAL_POSITION_INDEX = COLUMN_KV_COLUMNS.indexOf(ORDINAL_POSITION_KV);
+ private static final int ORDINAL_POSITION_INDEX = COLUMN_KV_COLUMNS
+ .indexOf(ORDINAL_POSITION_KV);
private static final int COLUMN_MODIFIER_INDEX = COLUMN_KV_COLUMNS.indexOf(COLUMN_MODIFIER_KV);
private static final int ARRAY_SIZE_INDEX = COLUMN_KV_COLUMNS.indexOf(ARRAY_SIZE_KV);
@@ -219,8 +240,9 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
System.arraycopy(keyBuffer, keyOffset, pnameBuf, 0, length);
return PNameFactory.newName(pnameBuf);
}
-
- private static Scan newTableRowsScan(byte[] key, long startTimeStamp, long stopTimeStamp) throws IOException {
+
+ private static Scan newTableRowsScan(byte[] key, long startTimeStamp, long stopTimeStamp)
+ throws IOException {
Scan scan = new Scan();
scan.setTimeRange(startTimeStamp, stopTimeStamp);
scan.setStartRow(key);
@@ -230,18 +252,159 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
return scan;
}
+ private RegionCoprocessorEnvironment env;
+
+ private static MetaDataMutationResult checkTableKeyInRegion(byte[] key, HRegion region) {
+ byte[] startKey = region.getStartKey();
+ byte[] endKey = region.getEndKey();
+ if (Bytes.compareTo(startKey, key) <= 0
+ && (Bytes.compareTo(HConstants.LAST_ROW, endKey) == 0 || Bytes.compareTo(key,
+ endKey) < 0)) {
+ return null; // normal case;
+ }
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_IN_REGION,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
+ }
+
+ /**
+ * Stores a reference to the coprocessor environment provided by the
+ * {@link org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost} from the region where this
+ * coprocessor is loaded. Since this is a coprocessor endpoint, it always expects to be loaded
+ * on a table region, so always expects this to be an instance of
+ * {@link RegionCoprocessorEnvironment}.
+ * @param env the environment provided by the coprocessor host
+ * @throws IOException if the provided environment is not an instance of
+ * {@code RegionCoprocessorEnvironment}
+ */
@Override
- public RegionCoprocessorEnvironment getEnvironment() {
- return (RegionCoprocessorEnvironment)super.getEnvironment();
+ public void start(CoprocessorEnvironment env) throws IOException {
+ if (env instanceof RegionCoprocessorEnvironment) {
+ this.env = (RegionCoprocessorEnvironment) env;
+ } else {
+ throw new CoprocessorException("Must be loaded on a table region!");
+ }
}
-
- private PTable buildTable(byte[] key, ImmutableBytesPtr cacheKey, HRegion region, long clientTimeStamp) throws IOException, SQLException {
+
+ @Override
+ public void stop(CoprocessorEnvironment env) throws IOException {
+ // nothing to do
+ }
+
+ @Override
+ public Service getService() {
+ return this;
+ }
+
+ @Override
+ public void getTable(RpcController controller, GetTableRequest request,
+ RpcCallback<MetaDataResponse> done) {
+ MetaDataResponse.Builder builder = MetaDataResponse.newBuilder();
+ byte[] tenantId = request.getTenantId().toByteArray();
+ byte[] schemaName = request.getSchemaName().toByteArray();
+ byte[] tableName = request.getTableName().toByteArray();
+ byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
+ long tableTimeStamp = request.getTableTimestamp();
+
+ try {
+ // TODO: check that key is within region.getStartKey() and region.getEndKey()
+ // and return special code to force client to lookup region from meta.
+ HRegion region = env.getRegion();
+ MetaDataMutationResult result = checkTableKeyInRegion(key, region);
+ if (result != null) {
+ done.run(MetaDataMutationResult.toProto(result));
+ return;
+ }
+
+ long currentTime = EnvironmentEdgeManager.currentTimeMillis();
+ PTable table = doGetTable(key, request.getClientTimestamp());
+ if (table == null) {
+ builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_NOT_FOUND);
+ builder.setMutationTime(currentTime);
+ done.run(builder.build());
+ return;
+ }
+ builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS);
+ builder.setMutationTime(currentTime);
+ if (table.getTimeStamp() != tableTimeStamp) {
+ builder.setTable(PTableImpl.toProto(table));
+ }
+ done.run(builder.build());
+ return;
+ } catch (Throwable t) {
+ logger.error("getTable failed", t);
+ ProtobufUtil.setControllerException(controller,
+ ServerUtil.createIOException(SchemaUtil.getTableName(schemaName, tableName), t));
+ }
+ }
+
+ private PTable doGetTable(byte[] key, long clientTimeStamp) throws IOException, SQLException {
+ ImmutableBytesPtr cacheKey = new ImmutableBytesPtr(key);
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
+ PTable table = metaDataCache.get(cacheKey);
+ // We only cache the latest, so we'll end up building the table with every call if the
+ // client connection has specified an SCN.
+ // TODO: If we indicate to the client that we're returning an older version, but there's a
+ // newer version available, the client
+ // can safely not call this, since we only allow modifications to the latest.
+ if (table != null && table.getTimeStamp() < clientTimeStamp) {
+ // Table on client is up-to-date with table on server, so just return
+ if (isTableDeleted(table)) {
+ return null;
+ }
+ return table;
+ }
+ // Ask Lars about the expense of this call - if we don't take the lock, we still won't get
+ // partial results
+ // get the co-processor environment
+ // TODO: check that key is within region.getStartKey() and region.getEndKey()
+ // and return special code to force client to lookup region from meta.
+ HRegion region = env.getRegion();
+ /*
+ * Lock directly on key, though it may be an index table. This will just prevent a table
+ * from getting rebuilt too often.
+ */
+ RowLock rowLock = region.getRowLock(key);
+ if (rowLock == null) {
+ throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
+ }
+ try {
+ // Try cache again in case we were waiting on a lock
+ table = metaDataCache.get(cacheKey);
+ // We only cache the latest, so we'll end up building the table with every call if the
+ // client connection has specified an SCN.
+ // TODO: If we indicate to the client that we're returning an older version, but there's
+ // a newer version available, the client
+ // can safely not call this, since we only allow modifications to the latest.
+ if (table != null && table.getTimeStamp() < clientTimeStamp) {
+ // Table on client is up-to-date with table on server, so just return
+ if (isTableDeleted(table)) {
+ return null;
+ }
+ return table;
+ }
+ // Query for the latest table first, since it's not cached
+ table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP);
+ if (table != null && table.getTimeStamp() < clientTimeStamp) {
+ return table;
+ }
+ // Otherwise, query for an older version of the table - it won't be cached
+ return buildTable(key, cacheKey, region, clientTimeStamp);
+ } finally {
+ rowLock.release();
+ }
+ }
+
+ private PTable buildTable(byte[] key, ImmutableBytesPtr cacheKey, HRegion region,
+ long clientTimeStamp) throws IOException, SQLException {
Scan scan = newTableRowsScan(key, MIN_TABLE_TIMESTAMP, clientTimeStamp);
RegionScanner scanner = region.getScanner(scan);
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
try {
PTable oldTable = metaDataCache.get(cacheKey);
- long tableTimeStamp = oldTable == null ? MIN_TABLE_TIMESTAMP-1 : oldTable.getTimeStamp();
+ long tableTimeStamp =
+ oldTable == null ? MIN_TABLE_TIMESTAMP - 1 : oldTable.getTimeStamp();
PTable newTable;
newTable = getTable(scanner, clientTimeStamp, tableTimeStamp);
if (newTable == null) {
@@ -249,14 +412,24 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
}
if (oldTable == null || tableTimeStamp < newTable.getTimeStamp()) {
if (logger.isDebugEnabled()) {
- logger.debug("Caching table " + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(), cacheKey.getLength()) + " at seqNum " + newTable.getSequenceNumber() + " with newer timestamp " + newTable.getTimeStamp() + " versus " + tableTimeStamp);
+ logger.debug("Caching table "
+ + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(),
+ cacheKey.getLength()) + " at seqNum "
+ + newTable.getSequenceNumber() + " with newer timestamp "
+ + newTable.getTimeStamp() + " versus " + tableTimeStamp);
}
oldTable = metaDataCache.put(cacheKey, newTable);
if (logger.isDebugEnabled()) {
if (oldTable == null) {
- logger.debug("No previously cached table " + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(), cacheKey.getLength()));
+ logger.debug("No previously cached table "
+ + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(),
+ cacheKey.getLength()));
} else {
- logger.debug("Previously cached table " + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(), cacheKey.getLength()) + " was at seqNum " + oldTable.getSequenceNumber() + " with timestamp " + oldTable.getTimeStamp());
+ logger.debug("Previously cached table "
+ + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(),
+ cacheKey.getLength()) + " was at seqNum "
+ + oldTable.getSequenceNumber() + " with timestamp "
+ + oldTable.getTimeStamp());
}
}
}
@@ -276,14 +449,17 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
indexes.add(indexTable);
}
- private void addColumnToTable(List<KeyValue> results, PName colName, PName famName, KeyValue[] colKeyValues, List<PColumn> columns) {
+ private void addColumnToTable(List<Cell> results, PName colName, PName famName,
+ Cell[] colKeyValues, List<PColumn> columns) {
int i = 0;
int j = 0;
while (i < results.size() && j < COLUMN_KV_COLUMNS.size()) {
- KeyValue kv = results.get(i);
- KeyValue searchKv = COLUMN_KV_COLUMNS.get(j);
- int cmp = Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(),
- searchKv.getBuffer(), searchKv.getQualifierOffset(), searchKv.getQualifierLength());
+ Cell kv = results.get(i);
+ Cell searchKv = COLUMN_KV_COLUMNS.get(j);
+ int cmp =
+ Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(),
+ kv.getQualifierLength(), searchKv.getQualifierArray(),
+ searchKv.getQualifierOffset(), searchKv.getQualifierLength());
if (cmp == 0) {
colKeyValues[j++] = kv;
i++;
@@ -293,53 +469,77 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
i++; // shouldn't happen - means unexpected KV in system table column row
}
}
- // COLUMN_SIZE and DECIMAL_DIGIT are optional. NULLABLE, DATA_TYPE and ORDINAL_POSITION_KV are required.
+ // COLUMN_SIZE and DECIMAL_DIGIT are optional. NULLABLE, DATA_TYPE and ORDINAL_POSITION_KV
+ // are required.
if (colKeyValues[SQL_DATA_TYPE_INDEX] == null || colKeyValues[NULLABLE_INDEX] == null
|| colKeyValues[ORDINAL_POSITION_INDEX] == null) {
- throw new IllegalStateException("Didn't find all required key values in '" + colName.getString() + "' column metadata row");
+ throw new IllegalStateException("Didn't find all required key values in '"
+ + colName.getString() + "' column metadata row");
}
- KeyValue columnSizeKv = colKeyValues[COLUMN_SIZE_INDEX];
- Integer maxLength = columnSizeKv == null ? null : PDataType.INTEGER.getCodec().decodeInt(columnSizeKv.getBuffer(), columnSizeKv.getValueOffset(), null);
- KeyValue decimalDigitKv = colKeyValues[DECIMAL_DIGITS_INDEX];
- Integer scale = decimalDigitKv == null ? null : PDataType.INTEGER.getCodec().decodeInt(decimalDigitKv.getBuffer(), decimalDigitKv.getValueOffset(), null);
- KeyValue ordinalPositionKv = colKeyValues[ORDINAL_POSITION_INDEX];
- int position = PDataType.INTEGER.getCodec().decodeInt(ordinalPositionKv.getBuffer(), ordinalPositionKv.getValueOffset(), null);
- KeyValue nullableKv = colKeyValues[NULLABLE_INDEX];
- boolean isNullable = PDataType.INTEGER.getCodec().decodeInt(nullableKv.getBuffer(), nullableKv.getValueOffset(), null) != ResultSetMetaData.columnNoNulls;
- KeyValue sqlDataTypeKv = colKeyValues[SQL_DATA_TYPE_INDEX];
- PDataType dataType = PDataType.fromTypeId(PDataType.INTEGER.getCodec().decodeInt(sqlDataTypeKv.getBuffer(), sqlDataTypeKv.getValueOffset(), null));
- if (maxLength == null && dataType == PDataType.BINARY) dataType = PDataType.VARBINARY; // For backward compatibility.
- KeyValue columnModifierKv = colKeyValues[COLUMN_MODIFIER_INDEX];
- ColumnModifier sortOrder = columnModifierKv == null ? null : ColumnModifier.fromSystemValue(PDataType.INTEGER.getCodec().decodeInt(columnModifierKv.getBuffer(), columnModifierKv.getValueOffset(), null));
- KeyValue arraySizeKv = colKeyValues[ARRAY_SIZE_INDEX];
- Integer arraySize = arraySizeKv == null ? null : PDataType.INTEGER.getCodec().decodeInt(arraySizeKv.getBuffer(), arraySizeKv.getValueOffset(), null);
- PColumn column = new PColumnImpl(colName, famName, dataType, maxLength, scale, isNullable, position-1, sortOrder, arraySize);
+ Cell columnSizeKv = colKeyValues[COLUMN_SIZE_INDEX];
+ Integer maxLength =
+ columnSizeKv == null ? null : PDataType.INTEGER.getCodec().decodeInt(
+ columnSizeKv.getValueArray(), columnSizeKv.getValueOffset(), null);
+ Cell decimalDigitKv = colKeyValues[DECIMAL_DIGITS_INDEX];
+ Integer scale =
+ decimalDigitKv == null ? null : PDataType.INTEGER.getCodec().decodeInt(
+ decimalDigitKv.getValueArray(), decimalDigitKv.getValueOffset(), null);
+ Cell ordinalPositionKv = colKeyValues[ORDINAL_POSITION_INDEX];
+ int position =
+ PDataType.INTEGER.getCodec().decodeInt(ordinalPositionKv.getValueArray(),
+ ordinalPositionKv.getValueOffset(), null);
+ Cell nullableKv = colKeyValues[NULLABLE_INDEX];
+ boolean isNullable =
+ PDataType.INTEGER.getCodec().decodeInt(nullableKv.getValueArray(),
+ nullableKv.getValueOffset(), null) != ResultSetMetaData.columnNoNulls;
+ Cell sqlDataTypeKv = colKeyValues[SQL_DATA_TYPE_INDEX];
+ PDataType dataType =
+ PDataType.fromTypeId(PDataType.INTEGER.getCodec().decodeInt(
+ sqlDataTypeKv.getValueArray(), sqlDataTypeKv.getValueOffset(), null));
+ if (maxLength == null && dataType == PDataType.BINARY) dataType = PDataType.VARBINARY; // For
+ // backward
+ // compatibility.
+ Cell columnModifierKv = colKeyValues[COLUMN_MODIFIER_INDEX];
+ ColumnModifier sortOrder =
+ columnModifierKv == null ? null : ColumnModifier.fromSystemValue(PDataType.INTEGER
+ .getCodec().decodeInt(columnModifierKv.getValueArray(),
+ columnModifierKv.getValueOffset(), null));
+
+ Cell arraySizeKv = colKeyValues[ARRAY_SIZE_INDEX];
+ Integer arraySize = arraySizeKv == null ? null :
+ PDataType.INTEGER.getCodec().decodeInt(arraySizeKv.getValueArray(), arraySizeKv.getValueOffset(), null);
+
+ PColumn column =
+ new PColumnImpl(colName, famName, dataType, maxLength, scale, isNullable,
+ position - 1, sortOrder, arraySize);
columns.add(column);
}
-
- private PTable getTable(RegionScanner scanner, long clientTimeStamp, long tableTimeStamp) throws IOException, SQLException {
- List<KeyValue> results = Lists.newArrayList();
+
+ private PTable getTable(RegionScanner scanner, long clientTimeStamp, long tableTimeStamp)
+ throws IOException, SQLException {
+ List<Cell> results = Lists.newArrayList();
scanner.next(results);
if (results.isEmpty()) {
return null;
}
- KeyValue[] tableKeyValues = new KeyValue[TABLE_KV_COLUMNS.size()];
- KeyValue[] colKeyValues = new KeyValue[COLUMN_KV_COLUMNS.size()];
-
+ Cell[] tableKeyValues = new Cell[TABLE_KV_COLUMNS.size()];
+ Cell[] colKeyValues = new Cell[COLUMN_KV_COLUMNS.size()];
+
// Create PTable based on KeyValues from scan
- KeyValue keyValue = results.get(0);
- byte[] keyBuffer = keyValue.getBuffer();
+ Cell keyValue = results.get(0);
+ byte[] keyBuffer = keyValue.getRowArray();
int keyLength = keyValue.getRowLength();
int keyOffset = keyValue.getRowOffset();
PName tenantId = newPName(keyBuffer, keyOffset, keyLength);
int tenantIdLength = tenantId.getBytes().length;
- PName schemaName = newPName(keyBuffer, keyOffset+tenantIdLength+1, keyLength);
+ PName schemaName = newPName(keyBuffer, keyOffset + tenantIdLength + 1, keyLength);
int schemaNameLength = schemaName.getBytes().length;
- int tableNameLength = keyLength-schemaNameLength-1-tenantIdLength-1;
+ int tableNameLength = keyLength - schemaNameLength - 1 - tenantIdLength - 1;
byte[] tableNameBytes = new byte[tableNameLength];
- System.arraycopy(keyBuffer, keyOffset+schemaNameLength+1+tenantIdLength+1, tableNameBytes, 0, tableNameLength);
+ System.arraycopy(keyBuffer, keyOffset + schemaNameLength + 1 + tenantIdLength + 1,
+ tableNameBytes, 0, tableNameLength);
PName tableName = PNameFactory.newName(tableNameBytes);
-
+
int offset = tenantIdLength + schemaNameLength + tableNameLength + 3;
// This will prevent the client from continually looking for the current
// table when we know that there will never be one since we disallow updates
@@ -349,20 +549,23 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
// bump up the timeStamp to right before the client time stamp, since
// we know it can't possibly change.
long timeStamp = keyValue.getTimestamp();
-// long timeStamp = tableTimeStamp > keyValue.getTimestamp() &&
-// clientTimeStamp < tableTimeStamp
-// ? clientTimeStamp-1
-// : keyValue.getTimestamp();
-
+ // long timeStamp = tableTimeStamp > keyValue.getTimestamp() &&
+ // clientTimeStamp < tableTimeStamp
+ // ? clientTimeStamp-1
+ // : keyValue.getTimestamp();
+
int i = 0;
int j = 0;
while (i < results.size() && j < TABLE_KV_COLUMNS.size()) {
- KeyValue kv = results.get(i);
- KeyValue searchKv = TABLE_KV_COLUMNS.get(j);
- int cmp = Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(),
- searchKv.getBuffer(), searchKv.getQualifierOffset(), searchKv.getQualifierLength());
+ Cell kv = results.get(i);
+ Cell searchKv = TABLE_KV_COLUMNS.get(j);
+ int cmp =
+ Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(),
+ kv.getQualifierLength(), searchKv.getQualifierArray(),
+ searchKv.getQualifierOffset(), searchKv.getQualifierLength());
if (cmp == 0) {
- timeStamp = Math.max(timeStamp, kv.getTimestamp()); // Find max timestamp of table header row
+ timeStamp = Math.max(timeStamp, kv.getTimestamp()); // Find max timestamp of table
+ // header row
tableKeyValues[j++] = kv;
i++;
} else if (cmp > 0) {
@@ -374,83 +577,105 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
// TABLE_TYPE, TABLE_SEQ_NUM and COLUMN_COUNT are required.
if (tableKeyValues[TABLE_TYPE_INDEX] == null || tableKeyValues[TABLE_SEQ_NUM_INDEX] == null
|| tableKeyValues[COLUMN_COUNT_INDEX] == null) {
- throw new IllegalStateException("Didn't find expected key values for table row in metadata row");
+ throw new IllegalStateException(
+ "Didn't find expected key values for table row in metadata row");
}
- KeyValue tableTypeKv = tableKeyValues[TABLE_TYPE_INDEX];
- PTableType tableType = PTableType.fromSerializedValue(tableTypeKv.getBuffer()[tableTypeKv.getValueOffset()]);
- KeyValue tableSeqNumKv = tableKeyValues[TABLE_SEQ_NUM_INDEX];
- long tableSeqNum = PDataType.LONG.getCodec().decodeLong(tableSeqNumKv.getBuffer(), tableSeqNumKv.getValueOffset(), null);
- KeyValue columnCountKv = tableKeyValues[COLUMN_COUNT_INDEX];
- int columnCount = PDataType.INTEGER.getCodec().decodeInt(columnCountKv.getBuffer(), columnCountKv.getValueOffset(), null);
- KeyValue pkNameKv = tableKeyValues[PK_NAME_INDEX];
- PName pkName = pkNameKv != null ? newPName(pkNameKv.getBuffer(), pkNameKv.getValueOffset(), pkNameKv.getValueLength()) : null;
- KeyValue saltBucketNumKv = tableKeyValues[SALT_BUCKETS_INDEX];
- Integer saltBucketNum = saltBucketNumKv != null ? (Integer)PDataType.INTEGER.getCodec().decodeInt(saltBucketNumKv.getBuffer(), saltBucketNumKv.getValueOffset(), null) : null;
- KeyValue dataTableNameKv = tableKeyValues[DATA_TABLE_NAME_INDEX];
- PName dataTableName = dataTableNameKv != null ? newPName(dataTableNameKv.getBuffer(), dataTableNameKv.getValueOffset(), dataTableNameKv.getValueLength()) : null;
- KeyValue indexStateKv = tableKeyValues[INDEX_STATE_INDEX];
- PIndexState indexState = indexStateKv == null ? null : PIndexState.fromSerializedValue(indexStateKv.getBuffer()[indexStateKv.getValueOffset()]);
- KeyValue immutableRowsKv = tableKeyValues[IMMUTABLE_ROWS_INDEX];
- boolean isImmutableRows = immutableRowsKv == null ? false : (Boolean)PDataType.BOOLEAN.toObject(immutableRowsKv.getBuffer(), immutableRowsKv.getValueOffset(), immutableRowsKv.getValueLength());
- KeyValue defaultFamilyNameKv = tableKeyValues[DEFAULT_COLUMN_FAMILY_INDEX];
- PName defaultFamilyName = defaultFamilyNameKv != null ? newPName(defaultFamilyNameKv.getBuffer(), defaultFamilyNameKv.getValueOffset(), defaultFamilyNameKv.getValueLength()) : null;
- KeyValue viewStatementKv = tableKeyValues[VIEW_STATEMENT_INDEX];
- String viewStatement = viewStatementKv != null ? (String)PDataType.VARCHAR.toObject(viewStatementKv.getBuffer(), viewStatementKv.getValueOffset(), viewStatementKv.getValueLength()) : null;
- KeyValue disableWALKv = tableKeyValues[DISABLE_WAL_INDEX];
- boolean disableWAL = disableWALKv == null ? PTable.DEFAULT_DISABLE_WAL : Boolean.TRUE.equals(PDataType.BOOLEAN.toObject(disableWALKv.getBuffer(), disableWALKv.getValueOffset(), disableWALKv.getValueLength()));
- KeyValue multiTenantKv = tableKeyValues[MULTI_TENANT_INDEX];
- boolean multiTenant = multiTenantKv == null ? false : Boolean.TRUE.equals(PDataType.BOOLEAN.toObject(multiTenantKv.getBuffer(), multiTenantKv.getValueOffset(), multiTenantKv.getValueLength()));
- KeyValue viewTypeKv = tableKeyValues[VIEW_TYPE_INDEX];
- ViewType viewType = viewTypeKv == null ? null : ViewType.fromSerializedValue(viewTypeKv.getBuffer()[viewTypeKv.getValueOffset()]);
+ Cell tableTypeKv = tableKeyValues[TABLE_TYPE_INDEX];
+ PTableType tableType =
+ PTableType
+ .fromSerializedValue(tableTypeKv.getValueArray()[tableTypeKv.getValueOffset()]);
+ Cell tableSeqNumKv = tableKeyValues[TABLE_SEQ_NUM_INDEX];
+ long tableSeqNum =
+ PDataType.LONG.getCodec().decodeLong(tableSeqNumKv.getValueArray(),
+ tableSeqNumKv.getValueOffset(), null);
+ Cell columnCountKv = tableKeyValues[COLUMN_COUNT_INDEX];
+ int columnCount =
+ PDataType.INTEGER.getCodec().decodeInt(columnCountKv.getValueArray(),
+ columnCountKv.getValueOffset(), null);
+ Cell pkNameKv = tableKeyValues[PK_NAME_INDEX];
+ PName pkName =
+ pkNameKv != null ? newPName(pkNameKv.getValueArray(), pkNameKv.getValueOffset(),
+ pkNameKv.getValueLength()) : null;
+ Cell saltBucketNumKv = tableKeyValues[SALT_BUCKETS_INDEX];
+ Integer saltBucketNum =
+ saltBucketNumKv != null ? (Integer) PDataType.INTEGER.getCodec().decodeInt(
+ saltBucketNumKv.getValueArray(), saltBucketNumKv.getValueOffset(), null) : null;
+ Cell dataTableNameKv = tableKeyValues[DATA_TABLE_NAME_INDEX];
+ PName dataTableName =
+ dataTableNameKv != null ? newPName(dataTableNameKv.getValueArray(),
+ dataTableNameKv.getValueOffset(), dataTableNameKv.getValueLength()) : null;
+ Cell indexStateKv = tableKeyValues[INDEX_STATE_INDEX];
+ PIndexState indexState =
+ indexStateKv == null ? null : PIndexState.fromSerializedValue(indexStateKv
+ .getValueArray()[indexStateKv.getValueOffset()]);
+ Cell immutableRowsKv = tableKeyValues[IMMUTABLE_ROWS_INDEX];
+ boolean isImmutableRows =
+ immutableRowsKv == null ? false : (Boolean) PDataType.BOOLEAN.toObject(
+ immutableRowsKv.getValueArray(), immutableRowsKv.getValueOffset(),
+ immutableRowsKv.getValueLength());
+ Cell defaultFamilyNameKv = tableKeyValues[DEFAULT_COLUMN_FAMILY_INDEX];
+ PName defaultFamilyName = defaultFamilyNameKv != null ? newPName(defaultFamilyNameKv.getValueArray(), defaultFamilyNameKv.getValueOffset(), defaultFamilyNameKv.getValueLength()) : null;
+ Cell viewStatementKv = tableKeyValues[VIEW_STATEMENT_INDEX];
+ String viewStatement = viewStatementKv != null ? (String)PDataType.VARCHAR.toObject(viewStatementKv.getValueArray(), viewStatementKv.getValueOffset(), viewStatementKv.getValueLength()) : null;
+ Cell disableWALKv = tableKeyValues[DISABLE_WAL_INDEX];
+ boolean disableWAL = disableWALKv == null ? PTable.DEFAULT_DISABLE_WAL : Boolean.TRUE.equals(PDataType.BOOLEAN.toObject(disableWALKv.getValueArray(), disableWALKv.getValueOffset(), disableWALKv.getValueLength()));
+ Cell multiTenantKv = tableKeyValues[MULTI_TENANT_INDEX];
+ boolean multiTenant = multiTenantKv == null ? false : Boolean.TRUE.equals(PDataType.BOOLEAN.toObject(multiTenantKv.getValueArray(), multiTenantKv.getValueOffset(), multiTenantKv.getValueLength()));
+ Cell viewTypeKv = tableKeyValues[VIEW_TYPE_INDEX];
+ ViewType viewType = viewTypeKv == null ? null : ViewType.fromSerializedValue(viewTypeKv.getValueArray()[viewTypeKv.getValueOffset()]);
List<PColumn> columns = Lists.newArrayListWithExpectedSize(columnCount);
List<PTable> indexes = new ArrayList<PTable>();
List<PName> physicalTables = new ArrayList<PName>();
while (true) {
- results.clear();
- scanner.next(results);
- if (results.isEmpty()) {
- break;
- }
- KeyValue colKv = results.get(LINK_TYPE_INDEX);
- int colKeyLength = colKv.getRowLength();
- PName colName = newPName(colKv.getBuffer(), colKv.getRowOffset() + offset, colKeyLength-offset);
- int colKeyOffset = offset + colName.getBytes().length + 1;
- PName famName = newPName(colKv.getBuffer(), colKv.getRowOffset() + colKeyOffset, colKeyLength-colKeyOffset);
- if (colName.getString().isEmpty() && famName != null) {
- LinkType linkType = LinkType.fromSerializedValue(colKv.getBuffer()[colKv.getValueOffset()]);
- if (linkType == LinkType.INDEX_TABLE) {
- addIndexToTable(tenantId, schemaName, famName, tableName, clientTimeStamp, indexes);
- } else if (linkType == LinkType.PHYSICAL_TABLE) {
- physicalTables.add(famName);
- } else {
- logger.warn("Unknown link type: " + colKv.getBuffer()[colKv.getValueOffset()] + " for " + SchemaUtil.getTableName(schemaName.getString(), tableName.getString()));
- }
- } else {
- addColumnToTable(results, colName, famName, colKeyValues, columns);
- }
+ results.clear();
+ scanner.next(results);
+ if (results.isEmpty()) {
+ break;
+ }
+ Cell colKv = results.get(LINK_TYPE_INDEX);
+ int colKeyLength = colKv.getRowLength();
+ PName colName = newPName(colKv.getRowArray(), colKv.getRowOffset() + offset, colKeyLength-offset);
+ int colKeyOffset = offset + colName.getBytes().length + 1;
+ PName famName = newPName(colKv.getRowArray(), colKv.getRowOffset() + colKeyOffset, colKeyLength-colKeyOffset);
+ if (colName.getString().isEmpty() && famName != null) {
+ LinkType linkType = LinkType.fromSerializedValue(colKv.getValueArray()[colKv.getValueOffset()]);
+ if (linkType == LinkType.INDEX_TABLE) {
+ addIndexToTable(tenantId, schemaName, famName, tableName, clientTimeStamp, indexes);
+ } else if (linkType == LinkType.PHYSICAL_TABLE) {
+ physicalTables.add(famName);
+ } else {
+ logger.warn("Unknown link type: " + colKv.getValueArray()[colKv.getValueOffset()] + " for " + SchemaUtil.getTableName(schemaName.getString(), tableName.getString()));
+ }
+ } else {
+ addColumnToTable(results, colName, famName, colKeyValues, columns);
+ }
}
- return PTableImpl.makePTable(schemaName, tableName, tableType, indexState, timeStamp, tableSeqNum, pkName, saltBucketNum, columns, tableType == INDEX ? dataTableName : null,
- indexes, isImmutableRows, physicalTables, defaultFamilyName, viewStatement, disableWAL, multiTenant, viewType);
+ return PTableImpl.makePTable(schemaName, tableName, tableType, indexState, timeStamp,
+ tableSeqNum, pkName, saltBucketNum, columns, tableType == INDEX ? dataTableName : null,
+ indexes, isImmutableRows, physicalTables, defaultFamilyName, viewStatement, disableWAL,
+ multiTenant, viewType);
}
- private PTable buildDeletedTable(byte[] key, ImmutableBytesPtr cacheKey, HRegion region, long clientTimeStamp) throws IOException {
+ private PTable buildDeletedTable(byte[] key, ImmutableBytesPtr cacheKey, HRegion region,
+ long clientTimeStamp) throws IOException {
if (clientTimeStamp == HConstants.LATEST_TIMESTAMP) {
return null;
}
-
+
Scan scan = newTableRowsScan(key, clientTimeStamp, HConstants.LATEST_TIMESTAMP);
scan.setFilter(new FirstKeyOnlyFilter());
scan.setRaw(true);
RegionScanner scanner = region.getScanner(scan);
- List<KeyValue> results = Lists.<KeyValue>newArrayList();
+ List<Cell> results = Lists.<Cell> newArrayList();
scanner.next(results);
// HBase ignores the time range on a raw scan (HBASE-7362)
if (!results.isEmpty() && results.get(0).getTimestamp() > clientTimeStamp) {
- KeyValue kv = results.get(0);
- if (kv.isDelete()) {
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ Cell kv = results.get(0);
+ if (kv.getTypeByte() == Type.Delete.getCode()) {
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
PTable table = newDeletedTableMarker(kv.getTimestamp());
metaDataCache.put(cacheKey, table);
return table;
@@ -467,16 +692,21 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
return table.getName() == null;
}
- private PTable loadTable(RegionCoprocessorEnvironment env, byte[] key, ImmutableBytesPtr cacheKey, long clientTimeStamp, long asOfTimeStamp) throws IOException, SQLException {
+ private PTable loadTable(RegionCoprocessorEnvironment env, byte[] key,
+ ImmutableBytesPtr cacheKey, long clientTimeStamp, long asOfTimeStamp)
+ throws IOException, SQLException {
HRegion region = env.getRegion();
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
PTable table = metaDataCache.get(cacheKey);
// We always cache the latest version - fault in if not in cache
if (table != null || (table = buildTable(key, cacheKey, region, asOfTimeStamp)) != null) {
return table;
}
- // if not found then check if newer table already exists and add delete marker for timestamp found
- if (table == null && (table=buildDeletedTable(key, cacheKey, region, clientTimeStamp)) != null) {
+ // if not found then check if newer table already exists and add delete marker for timestamp
+ // found
+ if (table == null
+ && (table = buildDeletedTable(key, cacheKey, region, clientTimeStamp)) != null) {
return table;
}
return null;
@@ -484,102 +714,136 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
@Override
- public MetaDataMutationResult createTable(List<Mutation> tableMetadata) throws IOException {
+ public void createTable(RpcController controller, CreateTableRequest request,
+ RpcCallback<MetaDataResponse> done) {
+ MetaDataResponse.Builder builder = MetaDataResponse.newBuilder();
byte[][] rowKeyMetaData = new byte[3][];
- MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata,rowKeyMetaData);
- byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
- byte[] schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
- byte[] tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
-
+ byte[] schemaName = null;
+ byte[] tableName = null;
+
try {
+ List<Mutation> tableMetadata = ProtobufUtil.getMutations(request);
+ MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, rowKeyMetaData);
+ byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
+ schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
+ tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
byte[] parentTableName = MetaDataUtil.getParentTableName(tableMetadata);
byte[] lockTableName = parentTableName == null ? tableName : parentTableName;
byte[] lockKey = SchemaUtil.getTableKey(tenantIdBytes, schemaName, lockTableName);
- byte[] key = parentTableName == null ? lockKey : SchemaUtil.getTableKey(tenantIdBytes, schemaName, tableName);
+ byte[] key =
+ parentTableName == null ? lockKey : SchemaUtil.getTableKey(tenantIdBytes,
+ schemaName, tableName);
byte[] parentKey = parentTableName == null ? null : lockKey;
-
- RegionCoprocessorEnvironment env = getEnvironment();
+
HRegion region = env.getRegion();
MetaDataMutationResult result = checkTableKeyInRegion(lockKey, region);
if (result != null) {
- return result;
+ done.run(MetaDataMutationResult.toProto(result));
+ return;
}
- List<Integer> lids = Lists.newArrayList(5);
+ List<RowLock> locks = Lists.newArrayList();
long clientTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetadata);
try {
- acquireLock(region, lockKey, lids);
+ acquireLock(region, lockKey, locks);
if (key != lockKey) {
- acquireLock(region, key, lids);
+ acquireLock(region, key, locks);
}
// Load parent table first
PTable parentTable = null;
ImmutableBytesPtr parentCacheKey = null;
if (parentKey != null) {
parentCacheKey = new ImmutableBytesPtr(parentKey);
- parentTable = loadTable(env, parentKey, parentCacheKey, clientTimeStamp, clientTimeStamp);
+ parentTable =
+ loadTable(env, parentKey, parentCacheKey, clientTimeStamp,
+ clientTimeStamp);
if (parentTable == null || isTableDeleted(parentTable)) {
- return new MetaDataMutationResult(MutationCode.PARENT_TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), parentTable);
+ builder.setReturnCode(MetaDataProtos.MutationCode.PARENT_TABLE_NOT_FOUND);
+ builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+ builder.setTable(PTableImpl.toProto(parentTable));
+ done.run(builder.build());
+ return;
}
// If parent table isn't at the expected sequence number, then return
- if (parentTable.getSequenceNumber() != MetaDataUtil.getParentSequenceNumber(tableMetadata)) {
- return new MetaDataMutationResult(MutationCode.CONCURRENT_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), parentTable);
+ if (parentTable.getSequenceNumber() != MetaDataUtil
+ .getParentSequenceNumber(tableMetadata)) {
+ builder.setReturnCode(MetaDataProtos.MutationCode.CONCURRENT_TABLE_MUTATION);
+ builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+ builder.setTable(PTableImpl.toProto(parentTable));
+ done.run(builder.build());
+ return;
}
}
// Load child table next
ImmutableBytesPtr cacheKey = new ImmutableBytesPtr(key);
- // Get as of latest timestamp so we can detect if we have a newer table that already exists
+ // Get as of latest timestamp so we can detect if we have a newer table that already
+ // exists
// without making an additional query
- PTable table = loadTable(env, key, cacheKey, clientTimeStamp, HConstants.LATEST_TIMESTAMP);
+ PTable table =
+ loadTable(env, key, cacheKey, clientTimeStamp, HConstants.LATEST_TIMESTAMP);
if (table != null) {
if (table.getTimeStamp() < clientTimeStamp) {
- // If the table is older than the client time stamp and it's deleted, continue
+ // If the table is older than the client time stamp and it's deleted,
+ // continue
if (!isTableDeleted(table)) {
- return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, EnvironmentEdgeManager.currentTimeMillis(), table);
+ builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS);
+ builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+ builder.setTable(PTableImpl.toProto(table));
+ done.run(builder.build());
+ return;
}
} else {
- return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), table);
+ builder.setReturnCode(MetaDataProtos.MutationCode.NEWER_TABLE_FOUND);
+ builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+ builder.setTable(PTableImpl.toProto(table));
+ done.run(builder.build());
+ return;
}
}
-
- // TODO: Switch this to HRegion#batchMutate when we want to support indexes on the system
+ // TODO: Switch this to HRegion#batchMutate when we want to support indexes on the
+ // system
// table. Basically, we get all the locks that we don't already hold for all the
- // tableMetadata rows. This ensures we don't have deadlock situations (ensuring primary and
- // then index table locks are held, in that order). For now, we just don't support indexing
- // on the system table. This is an issue because of the way we manage batch mutation in the
+ // tableMetadata rows. This ensures we don't have deadlock situations (ensuring
+ // primary and
+ // then index table locks are held, in that order). For now, we just don't support
+ // indexing
+ // on the system table. This is an issue because of the way we manage batch mutation
+ // in the
// Indexer.
- region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]>emptySet());
-
+ region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]> emptySet());
+
// Invalidate the cache - the next getTable call will add it
- // TODO: consider loading the table that was just created here, patching up the parent table, and updating the cache
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ // TODO: consider loading the table that was just created here, patching up the
+ // parent table, and updating the cache
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
if (parentCacheKey != null) {
metaDataCache.remove(parentCacheKey);
}
metaDataCache.remove(cacheKey);
// Get timeStamp from mutations - the above method sets it if it's unset
long currentTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetadata);
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, currentTimeStamp, null);
+ builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_NOT_FOUND);
+ builder.setMutationTime(currentTimeStamp);
+ done.run(builder.build());
+ return;
} finally {
- releaseLocks(region, lids);
+ region.releaseRowLocks(locks);
}
} catch (Throwable t) {
- ServerUtil.throwIOException(SchemaUtil.getTableName(schemaName, tableName), t);
- return null; // impossible
+ logger.error("createTable failed", t);
+ ProtobufUtil.setControllerException(controller,
+ ServerUtil.createIOException(SchemaUtil.getTableName(schemaName, tableName), t));
}
}
- private static void acquireLock(HRegion region, byte[] key, List<Integer> lids) throws IOException {
- Integer lid = region.getLock(null, key, true);
- if (lid == null) {
+
+ private static void acquireLock(HRegion region, byte[] key, List<RowLock> locks)
+ throws IOException {
+ RowLock rowLock = region.getRowLock(key);
+ if (rowLock == null) {
throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
}
- lids.add(lid);
- }
-
- private static void releaseLocks(HRegion region, List<Integer> lids) {
- for (Integer lid : lids) {
- region.releaseRowLock(lid);
- }
+ locks.add(rowLock);
}
private static final byte[] PHYSICAL_TABLE_BYTES = new byte[] {PTable.LinkType.PHYSICAL_TABLE.getSerializedValue()};
@@ -610,7 +874,7 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
scan.addColumn(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES);
RegionScanner scanner = region.getScanner(scan);
try {
- List<KeyValue> results = newArrayList();
+ List<Cell> results = newArrayList();
scanner.next(results);
return results.size() > 0;
}
@@ -620,108 +884,141 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
}
@Override
- public MetaDataMutationResult dropTable(List<Mutation> tableMetadata, String tableType) throws IOException {
+ public void dropTable(RpcController controller, DropTableRequest request,
+ RpcCallback<MetaDataResponse> done) {
+ MetaDataResponse.Builder builder = MetaDataResponse.newBuilder();
byte[][] rowKeyMetaData = new byte[3][];
- MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata,rowKeyMetaData);
- byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
- byte[] schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
- byte[] tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
- // Disallow deletion of a system table
- if (tableType.equals(PTableType.SYSTEM.getSerializedValue())) {
- return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), null);
- }
- List<byte[]> tableNamesToDelete = Lists.newArrayList();
+ String tableType = request.getTableType();
+ byte[] schemaName = null;
+ byte[] tableName = null;
+
try {
+ List<Mutation> tableMetadata = ProtobufUtil.getMutations(request);
+ MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, rowKeyMetaData);
+ byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
+ schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
+ tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
+ // Disallow deletion of a system table
+ if (tableType.equals(PTableType.SYSTEM.getSerializedValue())) {
+ builder.setReturnCode(MetaDataProtos.MutationCode.UNALLOWED_TABLE_MUTATION);
+ builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+ done.run(builder.build());
+ return;
+ }
+ List<byte[]> tableNamesToDelete = Lists.newArrayList();
byte[] parentTableName = MetaDataUtil.getParentTableName(tableMetadata);
byte[] lockTableName = parentTableName == null ? tableName : parentTableName;
byte[] lockKey = SchemaUtil.getTableKey(tenantIdBytes, schemaName, lockTableName);
- byte[] key = parentTableName == null ? lockKey : SchemaUtil.getTableKey(tenantIdBytes, schemaName, tableName);
-
- RegionCoprocessorEnvironment env = getEnvironment();
+ byte[] key =
+ parentTableName == null ? lockKey : SchemaUtil.getTableKey(tenantIdBytes,
+ schemaName, tableName);
+
HRegion region = env.getRegion();
MetaDataMutationResult result = checkTableKeyInRegion(key, region);
if (result != null) {
- return result;
+ done.run(MetaDataMutationResult.toProto(result));
+ return;
}
- List<Integer> lids = Lists.newArrayList(5);
+ List<RowLock> locks = Lists.newArrayList();
try {
- acquireLock(region, lockKey, lids);
+ acquireLock(region, lockKey, locks);
if (key != lockKey) {
- acquireLock(region, key, lids);
+ acquireLock(region, key, locks);
}
List<ImmutableBytesPtr> invalidateList = new ArrayList<ImmutableBytesPtr>();
- result = doDropTable(key, tenantIdBytes, schemaName, tableName, PTableType.fromSerializedValue(tableType), tableMetadata, invalidateList, lids, tableNamesToDelete);
- if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS || result.getTable() == null) {
- return result;
+ result =
+ doDropTable(key, tenantIdBytes, schemaName, tableName,
+ PTableType.fromSerializedValue(tableType), tableMetadata,
+ invalidateList, locks, tableNamesToDelete);
+ if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS
+ || result.getTable() == null) {
+ done.run(MetaDataMutationResult.toProto(result));
+ return;
}
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
// Commit the list of deletion.
- region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]>emptySet());
+ region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]> emptySet());
long currentTime = MetaDataUtil.getClientTimeStamp(tableMetadata);
- for (ImmutableBytesPtr ckey: invalidateList) {
+ for (ImmutableBytesPtr ckey : invalidateList) {
metaDataCache.put(ckey, newDeletedTableMarker(currentTime));
}
if (parentTableName != null) {
ImmutableBytesPtr parentCacheKey = new ImmutableBytesPtr(lockKey);
metaDataCache.remove(parentCacheKey);
}
- return result;
+ done.run(MetaDataMutationResult.toProto(result));
+ return;
} finally {
- releaseLocks(region, lids);
+ region.releaseRowLocks(locks);
}
} catch (Throwable t) {
- ServerUtil.throwIOException(SchemaUtil.getTableName(schemaName, tableName), t);
- return null; // impossible
+ logger.error("dropTable failed", t);
+ ProtobufUtil.setControllerException(controller,
+ ServerUtil.createIOException(SchemaUtil.getTableName(schemaName, tableName), t));
}
}
- private MetaDataMutationResult doDropTable(byte[] key, byte[] tenantId, byte[] schemaName, byte[] tableName, PTableType tableType,
- List<Mutation> rowsToDelete, List<ImmutableBytesPtr> invalidateList, List<Integer> lids, List<byte[]> tableNamesToDelete) throws IOException, SQLException {
+ private MetaDataMutationResult doDropTable(byte[] key, byte[] tenantId, byte[] schemaName,
+ byte[] tableName, PTableType tableType, List<Mutation> rowsToDelete,
+ List<ImmutableBytesPtr> invalidateList, List<RowLock> locks,
+ List<byte[]> tableNamesToDelete) throws IOException, SQLException {
long clientTimeStamp = MetaDataUtil.getClientTimeStamp(rowsToDelete);
-
- RegionCoprocessorEnvironment env = getEnvironment();
+
HRegion region = env.getRegion();
ImmutableBytesPtr cacheKey = new ImmutableBytesPtr(key);
-
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
PTable table = metaDataCache.get(cacheKey);
-
+
// We always cache the latest version - fault in if not in cache
- if (table != null || (table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP)) != null) {
+ if (table != null
+ || (table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP)) != null) {
if (table.getTimeStamp() < clientTimeStamp) {
// If the table is older than the client time stamp and its deleted, continue
if (isTableDeleted(table)) {
- return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
- if ( tableType != table.getType()) {
+ if (tableType != table.getType()) {
// We said to drop a table, but found a view or visa versa
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
} else {
- return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), table);
+ return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), table);
}
}
if (table == null && buildDeletedTable(key, cacheKey, region, clientTimeStamp) != null) {
- return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
// Get mutations for main table.
Scan scan = newTableRowsScan(key, MIN_TABLE_TIMESTAMP, clientTimeStamp);
RegionScanner scanner = region.getScanner(scan);
- List<KeyValue> results = Lists.newArrayList();
+ List<Cell> results = Lists.newArrayList();
scanner.next(results);
if (results.isEmpty()) {
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
- KeyValue typeKeyValue = KeyValueUtil.getColumnLatest(results, PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.TABLE_TYPE_BYTES);
- assert(typeKeyValue != null && typeKeyValue.getValueLength() == 1);
- if ( tableType != PTableType.fromSerializedValue(typeKeyValue.getBuffer()[typeKeyValue.getValueOffset()])) {
+ Cell typeKeyValue =
+ KeyValueUtil.getColumnLatest(results, PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
+ PhoenixDatabaseMetaData.TABLE_TYPE_BYTES);
+ assert (typeKeyValue != null && typeKeyValue.getValueLength() == 1);
+ if (tableType != PTableType.fromSerializedValue(typeKeyValue.getValueArray()[typeKeyValue
+ .getValueOffset()])) {
// We said to drop a table, but found a view or visa versa
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
// Don't allow a table with views to be deleted
// TODO: support CASCADE with DROP
if (tableType == PTableType.TABLE && hasViews(region, tenantId, table)) {
- return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
if (table.getType() != PTableType.VIEW) { // Add to list of HTables to delete, unless it's a view
tableNamesToDelete.add(table.getName().getBytes());
@@ -729,141 +1026,178 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
List<byte[]> indexNames = Lists.newArrayList();
invalidateList.add(cacheKey);
byte[][] rowKeyMetaData = new byte[5][];
- byte[] rowKey;
do {
- KeyValue kv = results.get(LINK_TYPE_INDEX);
- rowKey = kv.getRow();
- int nColumns = getVarChars(rowKey, rowKeyMetaData);
- if (nColumns == 5 && rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX].length == 0 && rowKeyMetaData[PhoenixDatabaseMetaData.INDEX_NAME_INDEX].length > 0
- && Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(), LINK_TYPE_BYTES, 0, LINK_TYPE_BYTES.length) == 0
- && LinkType.fromSerializedValue(kv.getBuffer()[kv.getValueOffset()]) == LinkType.INDEX_TABLE) {
+ Cell kv = results.get(LINK_TYPE_INDEX);
+ int nColumns = getVarChars(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), 0, rowKeyMetaData);
+ if (nColumns == 5
+ && rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX].length == 0
+ && rowKeyMetaData[PhoenixDatabaseMetaData.INDEX_NAME_INDEX].length > 0
+ && Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), LINK_TYPE_BYTES, 0, LINK_TYPE_BYTES.length) == 0
+ && LinkType.fromSerializedValue(kv.getValueArray()[kv.getValueOffset()]) == LinkType.INDEX_TABLE) {
indexNames.add(rowKeyMetaData[PhoenixDatabaseMetaData.INDEX_NAME_INDEX]);
}
- @SuppressWarnings("deprecation") // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
+ @SuppressWarnings("deprecation")
+ // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
// FIXME: the version of the Delete constructor without the lock args was introduced
// in 0.94.4, thus if we try to use it here we can no longer use the 0.94.2 version
// of the client.
- Delete delete = new Delete(rowKey, clientTimeStamp, null);
+ Delete delete = new Delete(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), clientTimeStamp);
rowsToDelete.add(delete);
results.clear();
scanner.next(results);
} while (!results.isEmpty());
-
+
// Recursively delete indexes
for (byte[] indexName : indexNames) {
byte[] indexKey = SchemaUtil.getTableKey(tenantId, schemaName, indexName);
- @SuppressWarnings("deprecation") // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
+ @SuppressWarnings("deprecation")
+ // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
// FIXME: the version of the Delete constructor without the lock args was introduced
// in 0.94.4, thus if we try to use it here we can no longer use the 0.94.2 version
// of the client.
- Delete delete = new Delete(indexKey, clientTimeStamp, null);
+ Delete delete = new Delete(indexKey, clientTimeStamp);
rowsToDelete.add(delete);
- acquireLock(region, indexKey, lids);
- MetaDataMutationResult result = doDropTable(indexKey, tenantId, schemaName, indexName, PTableType.INDEX, rowsToDelete, invalidateList, lids, tableNamesToDelete);
- if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS || result.getTable() == null) {
+ acquireLock(region, indexKey, locks);
+ MetaDataMutationResult result =
+ doDropTable(indexKey, tenantId, schemaName, indexName, PTableType.INDEX,
+ rowsToDelete, invalidateList, locks, tableNamesToDelete);
+ if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS
+ || result.getTable() == null) {
return result;
}
}
-
- return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, EnvironmentEdgeManager.currentTimeMillis(), table, tableNamesToDelete);
+
+ return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS,
+ EnvironmentEdgeManager.currentTimeMillis(), table, tableNamesToDelete);
}
private static interface ColumnMutator {
- MetaDataMutationResult updateMutation(PTable table, byte[][] rowKeyMetaData, List<Mutation> tableMetadata, HRegion region, List<ImmutableBytesPtr> invalidateList, List<Integer> lids) throws IOException, SQLException;
+ MetaDataMutationResult updateMutation(PTable table, byte[][] rowKeyMetaData,
+ List<Mutation> tableMetadata, HRegion region,
+ List<ImmutableBytesPtr> invalidateList, List<RowLock> locks) throws IOException,
+ SQLException;
}
- private MetaDataMutationResult mutateColumn(List<Mutation> tableMetadata, ColumnMutator mutator) throws IOException {
+ private MetaDataMutationResult
+ mutateColumn(List<Mutation> tableMetadata, ColumnMutator mutator) throws IOException {
byte[][] rowKeyMetaData = new byte[5][];
- MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata,rowKeyMetaData);
+ MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, rowKeyMetaData);
byte[] tenantId = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
byte[] schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
byte[] tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
try {
- RegionCoprocessorEnvironment env = getEnvironment();
byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
HRegion region = env.getRegion();
MetaDataMutationResult result = checkTableKeyInRegion(key, region);
if (result != null) {
- return result;
+ return result;
}
- List<Integer> lids = Lists.newArrayList(5);
+ List<RowLock> locks = Lists.newArrayList();
try {
- acquireLock(region, key, lids);
+ acquireLock(region, key, locks);
ImmutableBytesPtr cacheKey = new ImmutableBytesPtr(key);
List<ImmutableBytesPtr> invalidateList = new ArrayList<ImmutableBytesPtr>();
invalidateList.add(cacheKey);
- Map<ImmutableBytesPtr,PTable> metaDataCache = GlobalCache.getInstance(this.getEnvironment()).getMetaDataCache();
+ Map<ImmutableBytesPtr, PTable> metaDataCache =
+ GlobalCache.getInstance(this.env).getMetaDataCache();
PTable table = metaDataCache.get(cacheKey);
if (logger.isDebugEnabled()) {
if (table == null) {
- logger.debug("Table " + Bytes.toStringBinary(key) + " not found in cache. Will build through scan");
+ logger.debug("Table " + Bytes.toStringBinary(key)
+ + " not found in cache. Will build through scan");
} else {
- logger.debug("Table " + Bytes.toStringBinary(key) + " found in cache with timestamp " + table.getTimeStamp() + " seqNum " + table.getSequenceNumber());
+ logger.debug("Table " + Bytes.toStringBinary(key)
+ + " found in cache with timestamp " + table.getTimeStamp()
+ + " seqNum " + table.getSequenceNumber());
}
}
// Get client timeStamp from mutations
long clientTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetadata);
- if (table == null && (table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP)) == null) {
- // if not found then call newerTableExists and add delete marker for timestamp found
+ if (table == null
+ && (table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP)) == null) {
+ // if not found then call newerTableExists and add delete marker for timestamp
+ // found
if (buildDeletedTable(key, cacheKey, region, clientTimeStamp) != null) {
- return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
if (table.getTimeStamp() >= clientTimeStamp) {
- return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), table);
+ return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), table);
} else if (isTableDeleted(table)) {
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
}
-
- long expectedSeqNum = MetaDataUtil.getSequenceNumber(tableMetadata) - 1; // lookup TABLE_SEQ_NUM in tableMetaData
+
+ long expectedSeqNum = MetaDataUtil.getSequenceNumber(tableMetadata) - 1; // lookup
+ // TABLE_SEQ_NUM
+ // in
+ // tableMetaData
if (logger.isDebugEnabled()) {
- logger.debug("For table " + Bytes.toStringBinary(key) + " expecting seqNum " + expectedSeqNum + " and found seqNum " + table.getSequenceNumber() + " with " + table.getColumns().size() + " columns: " + table.getColumns());
+ logger.debug("For table " + Bytes.toStringBinary(key) + " expecting seqNum "
+ + expectedSeqNum + " and found seqNum " + table.getSequenceNumber()
+ + " with " + table.getColumns().size() + " columns: "
+ + table.getColumns());
}
if (expectedSeqNum != table.getSequenceNumber()) {
if (logger.isDebugEnabled()) {
- logger.debug("For table " + Bytes.toStringBinary(key) + " returning CONCURRENT_TABLE_MUTATION due to unexpected seqNum");
+ logger.debug("For table " + Bytes.toStringBinary(key)
+ + " returning CONCURRENT_TABLE_MUTATION due to unexpected seqNum");
}
- return new MetaDataMutationResult(MutationCode.CONCURRENT_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), table);
+ return new MetaDataMutationResult(MutationCode.CONCURRENT_TABLE_MUTATION,
+ EnvironmentEdgeManager.currentTimeMillis(), table);
}
-
+
PTableType type = table.getType();
- if (type == PTableType.INDEX) {
+ if (type == PTableType.INDEX) {
// Disallow mutation of an index table
- return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), null);
+ return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION,
+ EnvironmentEdgeManager.currentTimeMillis(), null);
} else {
- PTableType expectedType = MetaDataUtil.getTableType(tableMetadata);
- // We said to drop a table, but found a view or visa versa
- if (type != expectedType) {
- return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
- }
- if (hasViews(region, tenantId, table)) {
- // Disallow any column mutations for parents of tenant tables
- return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), null);
- }
+ PTableType expectedType = MetaDataUtil.getTableType(tableMetadata);
+ // We said to drop a table, but found a view or visa versa
+ if (type != expectedType) {
+ return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
+ }
+ if (hasViews(region, tenantId, table)) {
+ // Disallow any column mutations for parents of tenant tables
+ return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(), null);
+ }
}
- result = mutator.updateMutation(table, rowKeyMetaData, tableMetadata, region, invalidateList, lids);
+ result = mutator.updateMutation(table, rowKeyMetaData, tableMetadata, region,
+ invalidateList, locks);
if (result != null) {
return result;
}
-
- region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]>emptySet());
+
+ region.mutateRowsWithLocks(tableMetadata, Collections.<byte[]> emptySet());
// Invalidate from cache
for (ImmutableBytesPtr invalidateKey : invalidateList) {
PTable invalidatedTable = metaDataCache.remove(invalidateKey);
if (logger.isDebugEnabled()) {
if (invalidatedTable == null) {
- logger.debug("Attempted to invalidated table key " + Bytes.toStringBinary(cacheKey.get(),cacheKey.getOffset(),cacheKey.getLength()) + " but found no cached table");
+ logger.debug("Attempted to invalidated table key "
+ + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(),
+ cacheKey.getLength()) + " but found no cached table");
} else {
- logger.debug("Invalidated table key " + Bytes.toStringBinary(cacheKey.get(),cacheKey.getOffset(),cacheKey.getLength()) + " with timestamp " + invalidatedTable.getTimeStamp() + " and seqNum " + invalidatedTable.getSequenceNumber());
+ logger.debug("Invalidated table key "
+ + Bytes.toStringBinary(cacheKey.get(), cacheKey.getOffset(),
+ cacheKey.getLength()) + " with timestamp "
+ + invalidatedTable.getTimeStamp() + " and seqNum "
+ + invalidatedTable.getSequenceNumber());
}
}
}
- // Get client timeStamp from mutations, since it may get updated by the mutateRowsWithLocks call
+ // Get client timeStamp from mutations, since it may get updated by the
+ // mutateRowsWithLocks call
long currentTime = MetaDataUtil.getClientTimeStamp(tableMetadata);
- return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, currentTime, null);
+ return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, currentTime,
+ null);
} finally {
- releaseLocks(region,lids);
+ region.releaseRowLocks(locks);
}
} catch (Throwable t) {
ServerUtil.throwIOException(SchemaUtil.getTableName(schemaName, tableName), t);
@@ -871,261 +1205,251 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
}
}
+
@Override
- public MetaDataMutationResult addColumn(List<Mutation> tableMetaData) throws IOException {
- return mutateColumn(tableMetaData, new ColumnMutator() {
- @Override
- public MetaDataMutationResult updateMutation(PTable table, byte[][] rowKeyMetaData, List<Mutation> tableMetaData, HRegion region, List<ImmutableBytesPtr> invalidateList, List<Integer> lids) {
- byte[] tenantId = rowKeyMetaData[TENANT_ID_INDEX];
- byte[] schemaName = rowKeyMetaData[SCHEMA_NAME_INDEX];
- byte[] tableName = rowKeyMetaData[TABLE_NAME_INDEX];
- for (Mutation m : tableMetaData) {
- byte[] key = m.getRow();
- boolean addingPKColumn = false;
- int pkCount = getVarChars(key, rowKeyMetaData);
- if (pkCount > COLUMN_NAME_INDEX
- && Bytes.compareTo(schemaName, rowKeyMetaData[SCHEMA_NAME_INDEX]) == 0
- && Bytes.compareTo(tableName, rowKeyMetaData[TABLE_NAME_INDEX]) == 0 ) {
- try {
- if (pkCount > FAMILY_NAME_INDEX && rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX].length > 0) {
- PColumnFamily family = table.getColumnFamily(rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX]);
- family.getColumn(rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]);
- } else if (pkCount > COLUMN_NAME_INDEX && rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX].length > 0) {
- addingPKColumn = true;
- table.getPKColumn(new String(rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]));
- } else {
- continue;
- }
- return new MetaDataMutationResult(MutationCode.COLUMN_ALREADY_EXISTS, EnvironmentEdgeManager.currentTimeMillis(), table);
- } catch (ColumnFamilyNotFoundException e) {
- continue;
- } catch (ColumnNotFoundException e) {
- if (addingPKColumn) {
- // Add all indexes to invalidate list, as they will all be adding the same PK column
- // No need to lock them, as we have the parent table lock at this point
- for (PTable index : table.getIndexes()) {
- invalidateList.add(new ImmutableBytesPtr(SchemaUtil.getTableKey(tenantId, index.getSchemaName().getBytes(),index.getTableName().getBytes())));
- }
- }
- continue;
- }
- }
- }
- return null;
- }
- });
- }
-
- @Override
- public MetaDataMutationResult dropColumn(List<Mutation> tableMetaData) throws IOException {
- final long clientTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetaData);
- final List<byte[]> tableNamesToDelete = Lists.newArrayList();
- return mutateColumn(tableMetaData, new ColumnMutator() {
- @SuppressWarnings("deprecation")
- @Override
- public MetaDataMutationResult updateMutation(PTable table, byte[][] rowKeyMetaData, List<Mutation> tableMetaData, HRegion region, List<ImmutableBytesPtr> invalidateList, List<Integer> lids) throws IOException, SQLException {
- byte[] tenantId = rowKeyMetaData[TENANT_ID_INDEX];
- byte[] schemaName = rowKeyMetaData[SCHEMA_NAME_INDEX];
- byte[] tableName = rowKeyMetaData[TABLE_NAME_INDEX];
- boolean deletePKColumn = false;
- List<Mutation> additionalTableMetaData = Lists.newArrayList();
- for (Mutation m : tableMetaData) {
- if (m instanceof Delete) {
+ public void addColumn(RpcController controller, AddColumnRequest request,
+ RpcCallback<MetaDataResponse> done) {
+ try {
+ List<Mutation> tableMetaData = ProtobufUtil.getMutations(request);
+ MetaDataMutationResult result = mutateColumn(tableMetaData, new ColumnMutator() {
+ @Override
+ public MetaDataMutationResult updateMutation(PTable table, byte[][] rowKeyMetaData,
+ List<Mutation> tableMetaData, HRegion region,
+ List<ImmutableBytesPtr> invalidateList, List<RowLock> locks) {
+ byte[] tenantId = rowKeyMetaData[TENANT_ID_INDEX];
+ byte[] schemaName = rowKeyMetaData[SCHEMA_NAME_INDEX];
+ byte[] tableName = rowKeyMetaData[TABLE_NAME_INDEX];
+ for (Mutation m : tableMetaData) {
byte[] key = m.getRow();
+ boolean addingPKColumn = false;
int pkCount = getVarChars(key, rowKeyMetaData);
- if (pkCount > COLUMN_NAME_INDEX
- && Bytes.compareTo(schemaName, rowKeyMetaData[SCHEMA_NAME_INDEX]) == 0
- && Bytes.compareTo(tableName, rowKeyMetaData[TABLE_NAME_INDEX]) == 0 ) {
- PColumn columnToDelete = null;
+ if (pkCount > COLUMN_NAME_INDEX
+ && Bytes.compareTo(schemaName, rowKeyMetaData[SCHEMA_NAME_INDEX]) == 0
+ && Bytes.compareTo(tableName, rowKeyMetaData[TABLE_NAME_INDEX]) == 0) {
try {
- if (pkCount > FAMILY_NAME_INDEX && rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX].length > 0) {
- PColumnFamily family = table.getColumnFamily(rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX]);
- columnToDelete = family.getColumn(rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]);
- } else if (pkCount > COLUMN_NAME_INDEX && rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX].length > 0) {
- deletePKColumn = true;
- columnToDelete = table.getPKColumn(new String(rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]));
+ if (pkCount > FAMILY_NAME_INDEX
+ && rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX].length > 0) {
+ PColumnFamily family =
+ table.getColumnFamily(rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX]);
+ family.getColumn(rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]);
+ } else if (pkCount > COLUMN_NAME_INDEX
+ && rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX].length > 0) {
+ addingPKColumn = true;
+ table.getPKColumn(new String(
+ rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX]));
} else {
continue;
}
- // Look for columnToDelete in any indexes. If found as PK column, get lock and drop the index. If found as covered column, delete from index (do this client side?).
- // In either case, invalidate index if the column is in it
-
<TRUNCATED>
[06/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
new file mode 100644
index 0000000..ab57bae
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
@@ -0,0 +1,5315 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: PTable.proto
+
+package org.apache.phoenix.coprocessor.generated;
+
+public final class PTableProtos {
+ private PTableProtos() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ /**
+ * Protobuf enum {@code PTableType}
+ */
+ public enum PTableType
+ implements com.google.protobuf.ProtocolMessageEnum {
+ /**
+ * <code>SYSTEM = 0;</code>
+ */
+ SYSTEM(0, 0),
+ /**
+ * <code>USER = 1;</code>
+ */
+ USER(1, 1),
+ /**
+ * <code>VIEW = 2;</code>
+ */
+ VIEW(2, 2),
+ /**
+ * <code>INDEX = 3;</code>
+ */
+ INDEX(3, 3),
+ /**
+ * <code>JOIN = 4;</code>
+ */
+ JOIN(4, 4),
+ ;
+
+ /**
+ * <code>SYSTEM = 0;</code>
+ */
+ public static final int SYSTEM_VALUE = 0;
+ /**
+ * <code>USER = 1;</code>
+ */
+ public static final int USER_VALUE = 1;
+ /**
+ * <code>VIEW = 2;</code>
+ */
+ public static final int VIEW_VALUE = 2;
+ /**
+ * <code>INDEX = 3;</code>
+ */
+ public static final int INDEX_VALUE = 3;
+ /**
+ * <code>JOIN = 4;</code>
+ */
+ public static final int JOIN_VALUE = 4;
+
+
+ public final int getNumber() { return value; }
+
+ public static PTableType valueOf(int value) {
+ switch (value) {
+ case 0: return SYSTEM;
+ case 1: return USER;
+ case 2: return VIEW;
+ case 3: return INDEX;
+ case 4: return JOIN;
+ default: return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap<PTableType>
+ internalGetValueMap() {
+ return internalValueMap;
+ }
+ private static com.google.protobuf.Internal.EnumLiteMap<PTableType>
+ internalValueMap =
+ new com.google.protobuf.Internal.EnumLiteMap<PTableType>() {
+ public PTableType findValueByNumber(int number) {
+ return PTableType.valueOf(number);
+ }
+ };
+
+ public final com.google.protobuf.Descriptors.EnumValueDescriptor
+ getValueDescriptor() {
+ return getDescriptor().getValues().get(index);
+ }
+ public final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptorForType() {
+ return getDescriptor();
+ }
+ public static final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.getDescriptor().getEnumTypes().get(0);
+ }
+
+ private static final PTableType[] VALUES = values();
+
+ public static PTableType valueOf(
+ com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+ if (desc.getType() != getDescriptor()) {
+ throw new java.lang.IllegalArgumentException(
+ "EnumValueDescriptor is not for this type.");
+ }
+ return VALUES[desc.getIndex()];
+ }
+
+ private final int index;
+ private final int value;
+
+ private PTableType(int index, int value) {
+ this.index = index;
+ this.value = value;
+ }
+
+ // @@protoc_insertion_point(enum_scope:PTableType)
+ }
+
+ public interface PColumnOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bytes columnNameBytes = 1;
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ boolean hasColumnNameBytes();
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ com.google.protobuf.ByteString getColumnNameBytes();
+
+ // optional bytes familyNameBytes = 2;
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ boolean hasFamilyNameBytes();
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ com.google.protobuf.ByteString getFamilyNameBytes();
+
+ // required string dataType = 3;
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ boolean hasDataType();
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ java.lang.String getDataType();
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ com.google.protobuf.ByteString
+ getDataTypeBytes();
+
+ // optional int32 maxLength = 4;
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ boolean hasMaxLength();
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ int getMaxLength();
+
+ // optional int32 scale = 5;
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ boolean hasScale();
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ int getScale();
+
+ // required bool nullable = 6;
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ boolean hasNullable();
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ boolean getNullable();
+
+ // required int32 position = 7;
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ boolean hasPosition();
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ int getPosition();
+
+ // required int32 columnModifier = 8;
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ boolean hasColumnModifier();
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ int getColumnModifier();
+
+ // optional int32 arraySize = 9;
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ boolean hasArraySize();
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ int getArraySize();
+ }
+ /**
+ * Protobuf type {@code PColumn}
+ */
+ public static final class PColumn extends
+ com.google.protobuf.GeneratedMessage
+ implements PColumnOrBuilder {
+ // Use PColumn.newBuilder() to construct.
+ private PColumn(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PColumn(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PColumn defaultInstance;
+ public static PColumn getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PColumn getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PColumn(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ columnNameBytes_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ familyNameBytes_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ bitField0_ |= 0x00000004;
+ dataType_ = input.readBytes();
+ break;
+ }
+ case 32: {
+ bitField0_ |= 0x00000008;
+ maxLength_ = input.readInt32();
+ break;
+ }
+ case 40: {
+ bitField0_ |= 0x00000010;
+ scale_ = input.readInt32();
+ break;
+ }
+ case 48: {
+ bitField0_ |= 0x00000020;
+ nullable_ = input.readBool();
+ break;
+ }
+ case 56: {
+ bitField0_ |= 0x00000040;
+ position_ = input.readInt32();
+ break;
+ }
+ case 64: {
+ bitField0_ |= 0x00000080;
+ columnModifier_ = input.readInt32();
+ break;
+ }
+ case 72: {
+ bitField0_ |= 0x00000100;
+ arraySize_ = input.readInt32();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PColumn_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PColumn_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.class, org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PColumn> PARSER =
+ new com.google.protobuf.AbstractParser<PColumn>() {
+ public PColumn parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PColumn(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PColumn> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bytes columnNameBytes = 1;
+ public static final int COLUMNNAMEBYTES_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString columnNameBytes_;
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public boolean hasColumnNameBytes() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public com.google.protobuf.ByteString getColumnNameBytes() {
+ return columnNameBytes_;
+ }
+
+ // optional bytes familyNameBytes = 2;
+ public static final int FAMILYNAMEBYTES_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString familyNameBytes_;
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public boolean hasFamilyNameBytes() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public com.google.protobuf.ByteString getFamilyNameBytes() {
+ return familyNameBytes_;
+ }
+
+ // required string dataType = 3;
+ public static final int DATATYPE_FIELD_NUMBER = 3;
+ private java.lang.Object dataType_;
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public boolean hasDataType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public java.lang.String getDataType() {
+ java.lang.Object ref = dataType_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ dataType_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public com.google.protobuf.ByteString
+ getDataTypeBytes() {
+ java.lang.Object ref = dataType_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ dataType_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional int32 maxLength = 4;
+ public static final int MAXLENGTH_FIELD_NUMBER = 4;
+ private int maxLength_;
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public boolean hasMaxLength() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public int getMaxLength() {
+ return maxLength_;
+ }
+
+ // optional int32 scale = 5;
+ public static final int SCALE_FIELD_NUMBER = 5;
+ private int scale_;
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public boolean hasScale() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public int getScale() {
+ return scale_;
+ }
+
+ // required bool nullable = 6;
+ public static final int NULLABLE_FIELD_NUMBER = 6;
+ private boolean nullable_;
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public boolean hasNullable() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public boolean getNullable() {
+ return nullable_;
+ }
+
+ // required int32 position = 7;
+ public static final int POSITION_FIELD_NUMBER = 7;
+ private int position_;
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public boolean hasPosition() {
+ return ((bitField0_ & 0x00000040) == 0x00000040);
+ }
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public int getPosition() {
+ return position_;
+ }
+
+ // required int32 columnModifier = 8;
+ public static final int COLUMNMODIFIER_FIELD_NUMBER = 8;
+ private int columnModifier_;
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public boolean hasColumnModifier() {
+ return ((bitField0_ & 0x00000080) == 0x00000080);
+ }
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public int getColumnModifier() {
+ return columnModifier_;
+ }
+
+ // optional int32 arraySize = 9;
+ public static final int ARRAYSIZE_FIELD_NUMBER = 9;
+ private int arraySize_;
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public boolean hasArraySize() {
+ return ((bitField0_ & 0x00000100) == 0x00000100);
+ }
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public int getArraySize() {
+ return arraySize_;
+ }
+
+ private void initFields() {
+ columnNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ familyNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ dataType_ = "";
+ maxLength_ = 0;
+ scale_ = 0;
+ nullable_ = false;
+ position_ = 0;
+ columnModifier_ = 0;
+ arraySize_ = 0;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasColumnNameBytes()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasDataType()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasNullable()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasPosition()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasColumnModifier()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, columnNameBytes_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, familyNameBytes_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeBytes(3, getDataTypeBytes());
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeInt32(4, maxLength_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeInt32(5, scale_);
+ }
+ if (((bitField0_ & 0x00000020) == 0x00000020)) {
+ output.writeBool(6, nullable_);
+ }
+ if (((bitField0_ & 0x00000040) == 0x00000040)) {
+ output.writeInt32(7, position_);
+ }
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ output.writeInt32(8, columnModifier_);
+ }
+ if (((bitField0_ & 0x00000100) == 0x00000100)) {
+ output.writeInt32(9, arraySize_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, columnNameBytes_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, familyNameBytes_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(3, getDataTypeBytes());
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(4, maxLength_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(5, scale_);
+ }
+ if (((bitField0_ & 0x00000020) == 0x00000020)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(6, nullable_);
+ }
+ if (((bitField0_ & 0x00000040) == 0x00000040)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(7, position_);
+ }
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(8, columnModifier_);
+ }
+ if (((bitField0_ & 0x00000100) == 0x00000100)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(9, arraySize_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn other = (org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn) obj;
+
+ boolean result = true;
+ result = result && (hasColumnNameBytes() == other.hasColumnNameBytes());
+ if (hasColumnNameBytes()) {
+ result = result && getColumnNameBytes()
+ .equals(other.getColumnNameBytes());
+ }
+ result = result && (hasFamilyNameBytes() == other.hasFamilyNameBytes());
+ if (hasFamilyNameBytes()) {
+ result = result && getFamilyNameBytes()
+ .equals(other.getFamilyNameBytes());
+ }
+ result = result && (hasDataType() == other.hasDataType());
+ if (hasDataType()) {
+ result = result && getDataType()
+ .equals(other.getDataType());
+ }
+ result = result && (hasMaxLength() == other.hasMaxLength());
+ if (hasMaxLength()) {
+ result = result && (getMaxLength()
+ == other.getMaxLength());
+ }
+ result = result && (hasScale() == other.hasScale());
+ if (hasScale()) {
+ result = result && (getScale()
+ == other.getScale());
+ }
+ result = result && (hasNullable() == other.hasNullable());
+ if (hasNullable()) {
+ result = result && (getNullable()
+ == other.getNullable());
+ }
+ result = result && (hasPosition() == other.hasPosition());
+ if (hasPosition()) {
+ result = result && (getPosition()
+ == other.getPosition());
+ }
+ result = result && (hasColumnModifier() == other.hasColumnModifier());
+ if (hasColumnModifier()) {
+ result = result && (getColumnModifier()
+ == other.getColumnModifier());
+ }
+ result = result && (hasArraySize() == other.hasArraySize());
+ if (hasArraySize()) {
+ result = result && (getArraySize()
+ == other.getArraySize());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasColumnNameBytes()) {
+ hash = (37 * hash) + COLUMNNAMEBYTES_FIELD_NUMBER;
+ hash = (53 * hash) + getColumnNameBytes().hashCode();
+ }
+ if (hasFamilyNameBytes()) {
+ hash = (37 * hash) + FAMILYNAMEBYTES_FIELD_NUMBER;
+ hash = (53 * hash) + getFamilyNameBytes().hashCode();
+ }
+ if (hasDataType()) {
+ hash = (37 * hash) + DATATYPE_FIELD_NUMBER;
+ hash = (53 * hash) + getDataType().hashCode();
+ }
+ if (hasMaxLength()) {
+ hash = (37 * hash) + MAXLENGTH_FIELD_NUMBER;
+ hash = (53 * hash) + getMaxLength();
+ }
+ if (hasScale()) {
+ hash = (37 * hash) + SCALE_FIELD_NUMBER;
+ hash = (53 * hash) + getScale();
+ }
+ if (hasNullable()) {
+ hash = (37 * hash) + NULLABLE_FIELD_NUMBER;
+ hash = (53 * hash) + hashBoolean(getNullable());
+ }
+ if (hasPosition()) {
+ hash = (37 * hash) + POSITION_FIELD_NUMBER;
+ hash = (53 * hash) + getPosition();
+ }
+ if (hasColumnModifier()) {
+ hash = (37 * hash) + COLUMNMODIFIER_FIELD_NUMBER;
+ hash = (53 * hash) + getColumnModifier();
+ }
+ if (hasArraySize()) {
+ hash = (37 * hash) + ARRAYSIZE_FIELD_NUMBER;
+ hash = (53 * hash) + getArraySize();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code PColumn}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.PTableProtos.PColumnOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PColumn_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PColumn_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.class, org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ columnNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ familyNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ dataType_ = "";
+ bitField0_ = (bitField0_ & ~0x00000004);
+ maxLength_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ scale_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ nullable_ = false;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ position_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000040);
+ columnModifier_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000080);
+ arraySize_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000100);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PColumn_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn build() {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn buildPartial() {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn result = new org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.columnNameBytes_ = columnNameBytes_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.familyNameBytes_ = familyNameBytes_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.dataType_ = dataType_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.maxLength_ = maxLength_;
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.scale_ = scale_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000020;
+ }
+ result.nullable_ = nullable_;
+ if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
+ to_bitField0_ |= 0x00000040;
+ }
+ result.position_ = position_;
+ if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+ to_bitField0_ |= 0x00000080;
+ }
+ result.columnModifier_ = columnModifier_;
+ if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
+ to_bitField0_ |= 0x00000100;
+ }
+ result.arraySize_ = arraySize_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn other) {
+ if (other == org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.getDefaultInstance()) return this;
+ if (other.hasColumnNameBytes()) {
+ setColumnNameBytes(other.getColumnNameBytes());
+ }
+ if (other.hasFamilyNameBytes()) {
+ setFamilyNameBytes(other.getFamilyNameBytes());
+ }
+ if (other.hasDataType()) {
+ bitField0_ |= 0x00000004;
+ dataType_ = other.dataType_;
+ onChanged();
+ }
+ if (other.hasMaxLength()) {
+ setMaxLength(other.getMaxLength());
+ }
+ if (other.hasScale()) {
+ setScale(other.getScale());
+ }
+ if (other.hasNullable()) {
+ setNullable(other.getNullable());
+ }
+ if (other.hasPosition()) {
+ setPosition(other.getPosition());
+ }
+ if (other.hasColumnModifier()) {
+ setColumnModifier(other.getColumnModifier());
+ }
+ if (other.hasArraySize()) {
+ setArraySize(other.getArraySize());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasColumnNameBytes()) {
+
+ return false;
+ }
+ if (!hasDataType()) {
+
+ return false;
+ }
+ if (!hasNullable()) {
+
+ return false;
+ }
+ if (!hasPosition()) {
+
+ return false;
+ }
+ if (!hasColumnModifier()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required bytes columnNameBytes = 1;
+ private com.google.protobuf.ByteString columnNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public boolean hasColumnNameBytes() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public com.google.protobuf.ByteString getColumnNameBytes() {
+ return columnNameBytes_;
+ }
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public Builder setColumnNameBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ columnNameBytes_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes columnNameBytes = 1;</code>
+ */
+ public Builder clearColumnNameBytes() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ columnNameBytes_ = getDefaultInstance().getColumnNameBytes();
+ onChanged();
+ return this;
+ }
+
+ // optional bytes familyNameBytes = 2;
+ private com.google.protobuf.ByteString familyNameBytes_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public boolean hasFamilyNameBytes() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public com.google.protobuf.ByteString getFamilyNameBytes() {
+ return familyNameBytes_;
+ }
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public Builder setFamilyNameBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ familyNameBytes_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional bytes familyNameBytes = 2;</code>
+ */
+ public Builder clearFamilyNameBytes() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ familyNameBytes_ = getDefaultInstance().getFamilyNameBytes();
+ onChanged();
+ return this;
+ }
+
+ // required string dataType = 3;
+ private java.lang.Object dataType_ = "";
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public boolean hasDataType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public java.lang.String getDataType() {
+ java.lang.Object ref = dataType_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ dataType_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public com.google.protobuf.ByteString
+ getDataTypeBytes() {
+ java.lang.Object ref = dataType_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ dataType_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public Builder setDataType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ dataType_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public Builder clearDataType() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ dataType_ = getDefaultInstance().getDataType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string dataType = 3;</code>
+ */
+ public Builder setDataTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ dataType_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional int32 maxLength = 4;
+ private int maxLength_ ;
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public boolean hasMaxLength() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public int getMaxLength() {
+ return maxLength_;
+ }
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public Builder setMaxLength(int value) {
+ bitField0_ |= 0x00000008;
+ maxLength_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int32 maxLength = 4;</code>
+ */
+ public Builder clearMaxLength() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ maxLength_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional int32 scale = 5;
+ private int scale_ ;
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public boolean hasScale() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public int getScale() {
+ return scale_;
+ }
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public Builder setScale(int value) {
+ bitField0_ |= 0x00000010;
+ scale_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int32 scale = 5;</code>
+ */
+ public Builder clearScale() {
+ bitField0_ = (bitField0_ & ~0x00000010);
+ scale_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // required bool nullable = 6;
+ private boolean nullable_ ;
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public boolean hasNullable() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public boolean getNullable() {
+ return nullable_;
+ }
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public Builder setNullable(boolean value) {
+ bitField0_ |= 0x00000020;
+ nullable_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bool nullable = 6;</code>
+ */
+ public Builder clearNullable() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ nullable_ = false;
+ onChanged();
+ return this;
+ }
+
+ // required int32 position = 7;
+ private int position_ ;
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public boolean hasPosition() {
+ return ((bitField0_ & 0x00000040) == 0x00000040);
+ }
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public int getPosition() {
+ return position_;
+ }
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public Builder setPosition(int value) {
+ bitField0_ |= 0x00000040;
+ position_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int32 position = 7;</code>
+ */
+ public Builder clearPosition() {
+ bitField0_ = (bitField0_ & ~0x00000040);
+ position_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // required int32 columnModifier = 8;
+ private int columnModifier_ ;
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public boolean hasColumnModifier() {
+ return ((bitField0_ & 0x00000080) == 0x00000080);
+ }
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public int getColumnModifier() {
+ return columnModifier_;
+ }
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public Builder setColumnModifier(int value) {
+ bitField0_ |= 0x00000080;
+ columnModifier_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int32 columnModifier = 8;</code>
+ */
+ public Builder clearColumnModifier() {
+ bitField0_ = (bitField0_ & ~0x00000080);
+ columnModifier_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional int32 arraySize = 9;
+ private int arraySize_ ;
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public boolean hasArraySize() {
+ return ((bitField0_ & 0x00000100) == 0x00000100);
+ }
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public int getArraySize() {
+ return arraySize_;
+ }
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public Builder setArraySize(int value) {
+ bitField0_ |= 0x00000100;
+ arraySize_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int32 arraySize = 9;</code>
+ */
+ public Builder clearArraySize() {
+ bitField0_ = (bitField0_ & ~0x00000100);
+ arraySize_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:PColumn)
+ }
+
+ static {
+ defaultInstance = new PColumn(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:PColumn)
+ }
+
+ public interface PTableStatsOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string key = 1;
+ /**
+ * <code>required string key = 1;</code>
+ */
+ boolean hasKey();
+ /**
+ * <code>required string key = 1;</code>
+ */
+ java.lang.String getKey();
+ /**
+ * <code>required string key = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getKeyBytes();
+
+ // repeated bytes values = 2;
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ java.util.List<com.google.protobuf.ByteString> getValuesList();
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ int getValuesCount();
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ com.google.protobuf.ByteString getValues(int index);
+ }
+ /**
+ * Protobuf type {@code PTableStats}
+ */
+ public static final class PTableStats extends
+ com.google.protobuf.GeneratedMessage
+ implements PTableStatsOrBuilder {
+ // Use PTableStats.newBuilder() to construct.
+ private PTableStats(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PTableStats(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PTableStats defaultInstance;
+ public static PTableStats getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PTableStats getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PTableStats(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ key_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
+ values_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
+ mutable_bitField0_ |= 0x00000002;
+ }
+ values_.add(input.readBytes());
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
+ values_ = java.util.Collections.unmodifiableList(values_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTableStats_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTableStats_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.class, org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PTableStats> PARSER =
+ new com.google.protobuf.AbstractParser<PTableStats>() {
+ public PTableStats parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PTableStats(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PTableStats> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string key = 1;
+ public static final int KEY_FIELD_NUMBER = 1;
+ private java.lang.Object key_;
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public boolean hasKey() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public java.lang.String getKey() {
+ java.lang.Object ref = key_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ key_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getKeyBytes() {
+ java.lang.Object ref = key_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ key_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // repeated bytes values = 2;
+ public static final int VALUES_FIELD_NUMBER = 2;
+ private java.util.List<com.google.protobuf.ByteString> values_;
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public java.util.List<com.google.protobuf.ByteString>
+ getValuesList() {
+ return values_;
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public int getValuesCount() {
+ return values_.size();
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public com.google.protobuf.ByteString getValues(int index) {
+ return values_.get(index);
+ }
+
+ private void initFields() {
+ key_ = "";
+ values_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasKey()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getKeyBytes());
+ }
+ for (int i = 0; i < values_.size(); i++) {
+ output.writeBytes(2, values_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getKeyBytes());
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < values_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(values_.get(i));
+ }
+ size += dataSize;
+ size += 1 * getValuesList().size();
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats other = (org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats) obj;
+
+ boolean result = true;
+ result = result && (hasKey() == other.hasKey());
+ if (hasKey()) {
+ result = result && getKey()
+ .equals(other.getKey());
+ }
+ result = result && getValuesList()
+ .equals(other.getValuesList());
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasKey()) {
+ hash = (37 * hash) + KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getKey().hashCode();
+ }
+ if (getValuesCount() > 0) {
+ hash = (37 * hash) + VALUES_FIELD_NUMBER;
+ hash = (53 * hash) + getValuesList().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code PTableStats}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStatsOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTableStats_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTableStats_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.class, org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ key_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ values_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTableStats_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats build() {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats buildPartial() {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats result = new org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.key_ = key_;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ values_ = java.util.Collections.unmodifiableList(values_);
+ bitField0_ = (bitField0_ & ~0x00000002);
+ }
+ result.values_ = values_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats other) {
+ if (other == org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.getDefaultInstance()) return this;
+ if (other.hasKey()) {
+ bitField0_ |= 0x00000001;
+ key_ = other.key_;
+ onChanged();
+ }
+ if (!other.values_.isEmpty()) {
+ if (values_.isEmpty()) {
+ values_ = other.values_;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ } else {
+ ensureValuesIsMutable();
+ values_.addAll(other.values_);
+ }
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasKey()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string key = 1;
+ private java.lang.Object key_ = "";
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public boolean hasKey() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public java.lang.String getKey() {
+ java.lang.Object ref = key_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ key_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getKeyBytes() {
+ java.lang.Object ref = key_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ key_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public Builder setKey(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ key_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public Builder clearKey() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ key_ = getDefaultInstance().getKey();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string key = 1;</code>
+ */
+ public Builder setKeyBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ key_ = value;
+ onChanged();
+ return this;
+ }
+
+ // repeated bytes values = 2;
+ private java.util.List<com.google.protobuf.ByteString> values_ = java.util.Collections.emptyList();
+ private void ensureValuesIsMutable() {
+ if (!((bitField0_ & 0x00000002) == 0x00000002)) {
+ values_ = new java.util.ArrayList<com.google.protobuf.ByteString>(values_);
+ bitField0_ |= 0x00000002;
+ }
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public java.util.List<com.google.protobuf.ByteString>
+ getValuesList() {
+ return java.util.Collections.unmodifiableList(values_);
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public int getValuesCount() {
+ return values_.size();
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public com.google.protobuf.ByteString getValues(int index) {
+ return values_.get(index);
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public Builder setValues(
+ int index, com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureValuesIsMutable();
+ values_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public Builder addValues(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureValuesIsMutable();
+ values_.add(value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public Builder addAllValues(
+ java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
+ ensureValuesIsMutable();
+ super.addAll(values, values_);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes values = 2;</code>
+ */
+ public Builder clearValues() {
+ values_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000002);
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:PTableStats)
+ }
+
+ static {
+ defaultInstance = new PTableStats(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:PTableStats)
+ }
+
+ public interface PTableOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bytes schemaNameBytes = 1;
+ /**
+ * <code>required bytes schemaNameBytes = 1;</code>
+ */
+ boolean hasSchemaNameBytes();
+ /**
+ * <code>required bytes schemaNameBytes = 1;</code>
+ */
+ com.google.protobuf.ByteString getSchemaNameBytes();
+
+ // required bytes tableNameBytes = 2;
+ /**
+ * <code>required bytes tableNameBytes = 2;</code>
+ */
+ boolean hasTableNameBytes();
+ /**
+ * <code>required bytes tableNameBytes = 2;</code>
+ */
+ com.google.protobuf.ByteString getTableNameBytes();
+
+ // required .PTableType tableType = 3;
+ /**
+ * <code>required .PTableType tableType = 3;</code>
+ */
+ boolean hasTableType();
+ /**
+ * <code>required .PTableType tableType = 3;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableType getTableType();
+
+ // optional string indexState = 4;
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ boolean hasIndexState();
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ java.lang.String getIndexState();
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ com.google.protobuf.ByteString
+ getIndexStateBytes();
+
+ // required int64 sequenceNumber = 5;
+ /**
+ * <code>required int64 sequenceNumber = 5;</code>
+ */
+ boolean hasSequenceNumber();
+ /**
+ * <code>required int64 sequenceNumber = 5;</code>
+ */
+ long getSequenceNumber();
+
+ // required int64 timeStamp = 6;
+ /**
+ * <code>required int64 timeStamp = 6;</code>
+ */
+ boolean hasTimeStamp();
+ /**
+ * <code>required int64 timeStamp = 6;</code>
+ */
+ long getTimeStamp();
+
+ // optional bytes pkNameBytes = 7;
+ /**
+ * <code>optional bytes pkNameBytes = 7;</code>
+ */
+ boolean hasPkNameBytes();
+ /**
+ * <code>optional bytes pkNameBytes = 7;</code>
+ */
+ com.google.protobuf.ByteString getPkNameBytes();
+
+ // required int32 bucketNum = 8;
+ /**
+ * <code>required int32 bucketNum = 8;</code>
+ */
+ boolean hasBucketNum();
+ /**
+ * <code>required int32 bucketNum = 8;</code>
+ */
+ int getBucketNum();
+
+ // repeated .PColumn columns = 9;
+ /**
+ * <code>repeated .PColumn columns = 9;</code>
+ */
+ java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn>
+ getColumnsList();
+ /**
+ * <code>repeated .PColumn columns = 9;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn getColumns(int index);
+ /**
+ * <code>repeated .PColumn columns = 9;</code>
+ */
+ int getColumnsCount();
+ /**
+ * <code>repeated .PColumn columns = 9;</code>
+ */
+ java.util.List<? extends org.apache.phoenix.coprocessor.generated.PTableProtos.PColumnOrBuilder>
+ getColumnsOrBuilderList();
+ /**
+ * <code>repeated .PColumn columns = 9;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumnOrBuilder getColumnsOrBuilder(
+ int index);
+
+ // repeated .PTable indexes = 10;
+ /**
+ * <code>repeated .PTable indexes = 10;</code>
+ */
+ java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.PTable>
+ getIndexesList();
+ /**
+ * <code>repeated .PTable indexes = 10;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable getIndexes(int index);
+ /**
+ * <code>repeated .PTable indexes = 10;</code>
+ */
+ int getIndexesCount();
+ /**
+ * <code>repeated .PTable indexes = 10;</code>
+ */
+ java.util.List<? extends org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder>
+ getIndexesOrBuilderList();
+ /**
+ * <code>repeated .PTable indexes = 10;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder getIndexesOrBuilder(
+ int index);
+
+ // required bool isImmutableRows = 11;
+ /**
+ * <code>required bool isImmutableRows = 11;</code>
+ */
+ boolean hasIsImmutableRows();
+ /**
+ * <code>required bool isImmutableRows = 11;</code>
+ */
+ boolean getIsImmutableRows();
+
+ // repeated .PTableStats guidePosts = 12;
+ /**
+ * <code>repeated .PTableStats guidePosts = 12;</code>
+ */
+ java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats>
+ getGuidePostsList();
+ /**
+ * <code>repeated .PTableStats guidePosts = 12;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats getGuidePosts(int index);
+ /**
+ * <code>repeated .PTableStats guidePosts = 12;</code>
+ */
+ int getGuidePostsCount();
+ /**
+ * <code>repeated .PTableStats guidePosts = 12;</code>
+ */
+ java.util.List<? extends org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStatsOrBuilder>
+ getGuidePostsOrBuilderList();
+ /**
+ * <code>repeated .PTableStats guidePosts = 12;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStatsOrBuilder getGuidePostsOrBuilder(
+ int index);
+
+ // optional bytes dataTableNameBytes = 13;
+ /**
+ * <code>optional bytes dataTableNameBytes = 13;</code>
+ */
+ boolean hasDataTableNameBytes();
+ /**
+ * <code>optional bytes dataTableNameBytes = 13;</code>
+ */
+ com.google.protobuf.ByteString getDataTableNameBytes();
+
+ // optional bytes defaultFamilyName = 14;
+ /**
+ * <code>optional bytes defaultFamilyName = 14;</code>
+ */
+ boolean hasDefaultFamilyName();
+ /**
+ * <code>optional bytes defaultFamilyName = 14;</code>
+ */
+ com.google.protobuf.ByteString getDefaultFamilyName();
+
+ // required bool disableWAL = 15;
+ /**
+ * <code>required bool disableWAL = 15;</code>
+ */
+ boolean hasDisableWAL();
+ /**
+ * <code>required bool disableWAL = 15;</code>
+ */
+ boolean getDisableWAL();
+
+ // required bool multiTenant = 16;
+ /**
+ * <code>required bool multiTenant = 16;</code>
+ */
+ boolean hasMultiTenant();
+ /**
+ * <code>required bool multiTenant = 16;</code>
+ */
+ boolean getMultiTenant();
+
+ // optional bytes viewType = 17;
+ /**
+ * <code>optional bytes viewType = 17;</code>
+ */
+ boolean hasViewType();
+ /**
+ * <code>optional bytes viewType = 17;</code>
+ */
+ com.google.protobuf.ByteString getViewType();
+
+ // optional bytes viewStatement = 18;
+ /**
+ * <code>optional bytes viewStatement = 18;</code>
+ */
+ boolean hasViewStatement();
+ /**
+ * <code>optional bytes viewStatement = 18;</code>
+ */
+ com.google.protobuf.ByteString getViewStatement();
+
+ // repeated bytes physicalNames = 19;
+ /**
+ * <code>repeated bytes physicalNames = 19;</code>
+ */
+ java.util.List<com.google.protobuf.ByteString> getPhysicalNamesList();
+ /**
+ * <code>repeated bytes physicalNames = 19;</code>
+ */
+ int getPhysicalNamesCount();
+ /**
+ * <code>repeated bytes physicalNames = 19;</code>
+ */
+ com.google.protobuf.ByteString getPhysicalNames(int index);
+ }
+ /**
+ * Protobuf type {@code PTable}
+ */
+ public static final class PTable extends
+ com.google.protobuf.GeneratedMessage
+ implements PTableOrBuilder {
+ // Use PTable.newBuilder() to construct.
+ private PTable(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PTable(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PTable defaultInstance;
+ public static PTable getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PTable getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PTable(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ schemaNameBytes_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ tableNameBytes_ = input.readBytes();
+ break;
+ }
+ case 24: {
+ int rawValue = input.readEnum();
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableType value = org.apache.phoenix.coprocessor.generated.PTableProtos.PTableType.valueOf(rawValue);
+ if (value == null) {
+ unknownFields.mergeVarintField(3, rawValue);
+ } else {
+ bitField0_ |= 0x00000004;
+ tableType_ = value;
+ }
+ break;
+ }
+ case 34: {
+ bitField0_ |= 0x00000008;
+ indexState_ = input.readBytes();
+ break;
+ }
+ case 40: {
+ bitField0_ |= 0x00000010;
+ sequenceNumber_ = input.readInt64();
+ break;
+ }
+ case 48: {
+ bitField0_ |= 0x00000020;
+ timeStamp_ = input.readInt64();
+ break;
+ }
+ case 58: {
+ bitField0_ |= 0x00000040;
+ pkNameBytes_ = input.readBytes();
+ break;
+ }
+ case 64: {
+ bitField0_ |= 0x00000080;
+ bucketNum_ = input.readInt32();
+ break;
+ }
+ case 74: {
+ if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
+ columns_ = new java.util.ArrayList<org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn>();
+ mutable_bitField0_ |= 0x00000100;
+ }
+ columns_.add(input.readMessage(org.apache.phoenix.coprocessor.generated.PTableProtos.PColumn.PARSER, extensionRegistry));
+ break;
+ }
+ case 82: {
+ if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) {
+ indexes_ = new java.util.ArrayList<org.apache.phoenix.coprocessor.generated.PTableProtos.PTable>();
+ mutable_bitField0_ |= 0x00000200;
+ }
+ indexes_.add(input.readMessage(org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.PARSER, extensionRegistry));
+ break;
+ }
+ case 88: {
+ bitField0_ |= 0x00000100;
+ isImmutableRows_ = input.readBool();
+ break;
+ }
+ case 98: {
+ if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+ guidePosts_ = new java.util.ArrayList<org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats>();
+ mutable_bitField0_ |= 0x00000800;
+ }
+ guidePosts_.add(input.readMessage(org.apache.phoenix.coprocessor.generated.PTableProtos.PTableStats.PARSER, extensionRegistry));
+ break;
+ }
+ case 106: {
+ bitField0_ |= 0x00000200;
+ dataTableNameBytes_ = input.readBytes();
+ break;
+ }
+ case 114: {
+ bitField0_ |= 0x00000400;
+ defaultFamilyName_ = input.readBytes();
+ break;
+ }
+ case 120: {
+ bitField0_ |= 0x00000800;
+ disableWAL_ = input.readBool();
+ break;
+ }
+ case 128: {
+ bitField0_ |= 0x00001000;
+ multiTenant_ = input.readBool();
+ break;
+ }
+ case 138: {
+ bitField0_ |= 0x00002000;
+ viewType_ = input.readBytes();
+ break;
+ }
+ case 146: {
+ bitField0_ |= 0x00004000;
+ viewStatement_ = input.readBytes();
+ break;
+ }
+ case 154: {
+ if (!((mutable_bitField0_ & 0x00040000) == 0x00040000)) {
+ physicalNames_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
+ mutable_bitField0_ |= 0x00040000;
+ }
+ physicalNames_.add(input.readBytes());
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
+ columns_ = java.util.Collections.unmodifiableList(columns_);
+ }
+ if (((mutable_bitField0_ & 0x00000200) == 0x00000200)) {
+ indexes_ = java.util.Collections.unmodifiableList(indexes_);
+ }
+ if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+ guidePosts_ = java.util.Collections.unmodifiableList(guidePosts_);
+ }
+ if (((mutable_bitField0_ & 0x00040000) == 0x00040000)) {
+ physicalNames_ = java.util.Collections.unmodifiableList(physicalNames_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTable_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_PTable_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.class, org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PTable> PARSER =
+ new com.google.protobuf.AbstractParser<PTable>() {
+ public PTable parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PTable(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PTable> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bytes schemaNameBytes = 1;
+ public static final int SCHEMANAMEBYTES_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString schemaNameBytes_;
+ /**
+ * <code>required bytes schemaNameBytes = 1;</code>
+ */
+ public boolean hasSchemaNameBytes() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes schemaNameBytes = 1;</code>
+ */
+ public com.google.protobuf.ByteString getSchemaNameBytes() {
+ return schemaNameBytes_;
+ }
+
+ // required bytes tableNameBytes = 2;
+ public static final int TABLENAMEBYTES_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString tableNameBytes_;
+ /**
+ * <code>required bytes tableNameBytes = 2;</code>
+ */
+ public boolean hasTableNameBytes() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes tableNameBytes = 2;</code>
+ */
+ public com.google.protobuf.ByteString getTableNameBytes() {
+ return tableNameBytes_;
+ }
+
+ // required .PTableType tableType = 3;
+ public static final int TABLETYPE_FIELD_NUMBER = 3;
+ private org.apache.phoenix.coprocessor.generated.PTableProtos.PTableType tableType_;
+ /**
+ * <code>required .PTableType tableType = 3;</code>
+ */
+ public boolean hasTableType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required .PTableType tableType = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableType getTableType() {
+ return tableType_;
+ }
+
+ // optional string indexState = 4;
+ public static final int INDEXSTATE_FIELD_NUMBER = 4;
+ private java.lang.Object indexState_;
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ public boolean hasIndexState() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ public java.lang.String getIndexState() {
+ java.lang.Object ref = indexState_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ indexState_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string indexState = 4;</code>
+ */
+ public com.google.protobuf.ByteString
+ getIndexStateBytes() {
+ java.lang.Object ref = indexState_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ indexState_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required int64 sequenceNumber = 5;
+ public static final int SEQUENCENUMBER_FIELD_NUMBER = 5;
+ private long sequenceNumber_;
+ /**
+ * <code>required int64 sequenceNumber = 5;</code>
+ */
+ public boolean hasSequenceNumber() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>required int64 sequenceNumber = 5;</code>
+ */
+ public long getSequenceNumber() {
+ return sequenceNumber_;
+ }
+
+ // required int64 timeStamp = 6;
+ public static final int TIMESTAMP_FIELD_NUMBER = 6;
+ private long timeStamp_;
+ /**
+ * <code>required int64 timeStamp = 6;</code>
+ */
+ public boolean hasTimeStamp() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>required int64 timeStamp = 6;</code>
+ */
+ public long getTimeStamp() {
+ return timeStamp_;
+ }
+
+ // optional bytes pkNameBytes = 7;
+ public static final int PKNAMEBYTES_FIELD_NUMBER = 7;
+ private com.google.protobuf.ByteString pkNameBytes_;
+ /**
+ * <code>optional bytes pkNameBytes = 7;</code>
+ */
+ public boolean hasPkNameBytes() {
+
<TRUNCATED>
[10/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodec.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodec.java
index 01d7390..e59afba 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodec.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodec.java
@@ -7,11 +7,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.codec.BaseDecoder;
import org.apache.hadoop.hbase.codec.BaseEncoder;
-import org.apache.hadoop.hbase.codec.Decoder;
-import org.apache.hadoop.hbase.codec.Encoder;
import org.apache.hadoop.hbase.index.wal.IndexedKeyValue;
import org.apache.hadoop.hbase.index.wal.KeyValueCodec;
@@ -24,25 +25,18 @@ import org.apache.hadoop.hbase.index.wal.KeyValueCodec;
* not be installed on a running cluster, but rather one that has been cleanly shutdown and requires
* no WAL replay on startup.
*/
-public class IndexedWALEditCodec extends WALEditCodec {
+public class IndexedWALEditCodec extends WALCellCodec {
// can't have negative values because reading off a stream returns a negative if its the end of
// the stream
private static final int REGULAR_KEY_VALUE_MARKER = 0;
private CompressionContext compression;
+ private Configuration conf;
- /** Required nullary constructor */
- public IndexedWALEditCodec() {
- }
-
- /**
- * Override the parent implementation so we can get access to the current context too
- * @param compression compression to support for the encoder/decoder
- */
- @Override
- public void setCompression(CompressionContext compression) {
- super.setCompression(compression);
- this.compression = compression;
+ public IndexedWALEditCodec(Configuration conf, CompressionContext compression) {
+ super(conf, compression);
+ this.conf = conf;
+ this.compression = compression;
}
@Override
@@ -71,12 +65,12 @@ public class IndexedWALEditCodec extends WALEditCodec {
}
/**
- * Custom {@link Decoder} that can handle a stream of regular and indexed {@link KeyValue}s.
+ * Custom Decoder that can handle a stream of regular and indexed {@link KeyValue}s.
*/
public class IndexKeyValueDecoder extends BaseDecoder {
/**
- * Create a {@link Decoder} on the given input stream with the given {@link Decoder} to parse
+ * Create a Decoder on the given input stream with the given Decoder to parse
* generic {@link KeyValue}s.
* @param is stream to read from
*/
@@ -95,7 +89,7 @@ public class IndexedWALEditCodec extends WALEditCodec {
private Decoder decoder;
/**
- * Create a {@link Decoder} on the given input stream with the given {@link Decoder} to parse
+ * Create a Decoder on the given input stream with the given Decoder to parse
* generic {@link KeyValue}s.
* @param is stream to read from
* @param compressedDecoder decoder for generic {@link KeyValue}s. Should support the expected
@@ -107,7 +101,7 @@ public class IndexedWALEditCodec extends WALEditCodec {
}
@Override
- protected KeyValue parseCell() throws IOException {
+ protected Cell parseCell() throws IOException {
// reader the marker
int marker = this.in.read();
if (marker < 0) {
@@ -143,12 +137,12 @@ public class IndexedWALEditCodec extends WALEditCodec {
}
@Override
- public void write(KeyValue cell) throws IOException {
+ public void write(Cell cell) throws IOException {
// make sure we are open
checkFlushed();
// use the standard encoding mechanism
- KeyValueCodec.write((DataOutput) this.out, cell);
+ KeyValueCodec.write((DataOutput) this.out, KeyValueUtil.ensureKeyValue(cell));
}
}
@@ -172,7 +166,7 @@ public class IndexedWALEditCodec extends WALEditCodec {
}
@Override
- public void write(KeyValue cell) throws IOException {
+ public void write(Cell cell) throws IOException {
//make sure we are open
checkFlushed();
@@ -188,7 +182,7 @@ public class IndexedWALEditCodec extends WALEditCodec {
this.compressedKvEncoder.write(cell);
}
else{
- KeyValueCodec.write((DataOutput) out, cell);
+ KeyValueCodec.write((DataOutput) out, KeyValueUtil.ensureKeyValue(cell));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerCacheClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerCacheClient.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerCacheClient.java
index d24ea38..01a881b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerCacheClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerCacheClient.java
@@ -40,13 +40,29 @@ import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
import org.apache.hadoop.hbase.util.Bytes;
import com.google.common.collect.ImmutableSet;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.HBaseZeroCopyByteString;
+
import org.apache.phoenix.compile.ScanRanges;
import org.apache.phoenix.coprocessor.ServerCachingProtocol;
import org.apache.phoenix.coprocessor.ServerCachingProtocol.ServerCacheFactory;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
+import org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheRequest;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.AddServerCacheResponse;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheRequest;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServerCacheResponse;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ServerCachingService;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.job.JobManager.JobCallable;
import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
@@ -165,8 +181,38 @@ public class ServerCacheClient {
@Override
public Boolean call() throws Exception {
- ServerCachingProtocol protocol = htable.coprocessorProxy(ServerCachingProtocol.class, key);
- return protocol.addServerCache(connection.getTenantId() == null ? null : connection.getTenantId().getBytes(), cacheId, cachePtr, cacheFactory);
+ final Map<byte[], AddServerCacheResponse> results;
+ try {
+ results = htable.coprocessorService(ServerCachingService.class, key, key,
+ new Batch.Call<ServerCachingService, AddServerCacheResponse>() {
+ @Override
+ public AddServerCacheResponse call(ServerCachingService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<AddServerCacheResponse> rpcCallback =
+ new BlockingRpcCallback<AddServerCacheResponse>();
+ AddServerCacheRequest.Builder builder = AddServerCacheRequest.newBuilder();
+ if(connection.getTenantId() != null){
+ builder.setTenantId(HBaseZeroCopyByteString.wrap(connection.getTenantId().getBytes()));
+ }
+ builder.setCacheId(HBaseZeroCopyByteString.wrap(cacheId));
+ builder.setCachePtr(org.apache.phoenix.protobuf.ProtobufUtil.toProto(cachePtr));
+ ServerCacheFactoryProtos.ServerCacheFactory.Builder svrCacheFactoryBuider = ServerCacheFactoryProtos.ServerCacheFactory.newBuilder();
+ svrCacheFactoryBuider.setClassName(cacheFactory.getClass().getName());
+ builder.setCacheFactory(svrCacheFactoryBuider.build());
+ instance.addServerCache(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
+ } catch (Throwable t) {
+ throw new Exception(t);
+ }
+ if(results != null && results.size() == 1){
+ return results.values().iterator().next().getReturn();
+ }
+ return false;
}
/**
@@ -229,7 +275,7 @@ public class ServerCacheClient {
* @throws SQLException
* @throws IllegalStateException if hashed table cannot be removed on any region server on which it was added
*/
- private void removeServerCache(byte[] cacheId, Set<HRegionLocation> servers) throws SQLException {
+ private void removeServerCache(final byte[] cacheId, Set<HRegionLocation> servers) throws SQLException {
ConnectionQueryServices services = connection.getQueryServices();
Throwable lastThrowable = null;
TableRef cacheUsingTableRef = cacheUsingTableRefMap.get(Bytes.mapKey(cacheId));
@@ -247,8 +293,25 @@ public class ServerCacheClient {
if (remainingOnServers.contains(entry)) { // Call once per server
try {
byte[] key = entry.getRegionInfo().getStartKey();
- ServerCachingProtocol protocol = iterateOverTable.coprocessorProxy(ServerCachingProtocol.class, key);
- protocol.removeServerCache(connection.getTenantId() == null ? null : connection.getTenantId().getBytes(), cacheId);
+ iterateOverTable.coprocessorService(ServerCachingService.class, key, key,
+ new Batch.Call<ServerCachingService, RemoveServerCacheResponse>() {
+ @Override
+ public RemoveServerCacheResponse call(ServerCachingService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<RemoveServerCacheResponse> rpcCallback =
+ new BlockingRpcCallback<RemoveServerCacheResponse>();
+ RemoveServerCacheRequest.Builder builder = RemoveServerCacheRequest.newBuilder();
+ if(connection.getTenantId() != null){
+ builder.setTenantId(HBaseZeroCopyByteString.wrap(connection.getTenantId().getBytes()));
+ }
+ builder.setCacheId(HBaseZeroCopyByteString.wrap(cacheId));
+ instance.removeServerCache(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
remainingOnServers.remove(entry);
} catch (Throwable t) {
lastThrowable = t;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
index 41a4e65..57b5313 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
@@ -16,6 +16,7 @@ import java.util.Map;
import java.util.Map.Entry;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
@@ -341,7 +342,7 @@ public class SpillableGroupByCache implements GroupByCache {
}
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
if (!cacheIter.hasNext()) { return false; }
Map.Entry<ImmutableBytesWritable, Aggregator[]> ce = cacheIter.next();
ImmutableBytesWritable key = ce.getKey();
@@ -356,6 +357,11 @@ public class SpillableGroupByCache implements GroupByCache {
SINGLE_COLUMN, AGG_TIMESTAMP, value, 0, value.length));
return cacheIter.hasNext();
}
+
+ @Override
+ public long getMaxResultSize() {
+ return s.getMaxResultSize();
+ }
};
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/client/ClientKeyValue.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/client/ClientKeyValue.java b/phoenix-core/src/main/java/org/apache/phoenix/client/ClientKeyValue.java
index 3288c4d..90e8e0b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/client/ClientKeyValue.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/client/ClientKeyValue.java
@@ -17,8 +17,9 @@
*/
package org.apache.phoenix.client;
-import java.io.DataInput;
+import java.io.ByteArrayOutputStream;
import java.io.DataOutput;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
@@ -52,6 +53,7 @@ public class ClientKeyValue extends KeyValue {
private Type type;
private long ts;
private ImmutableBytesWritable value;
+ private byte[] bytes = null;
/**
* @param row must not be <tt>null</tt>
@@ -153,29 +155,24 @@ public class ClientKeyValue extends KeyValue {
}
@Override
- public int getQualifierLength(int rlength, int flength) {
- return this.getQualifierLength();
- }
-
- @Override
- public int getTotalColumnLength(int rlength, int foffset) {
- return this.getFamilyLength() + this.getQualifierLength();
- }
-
- @Override
- public int getTotalColumnLength() {
- return qualifier.getLength() + family.getLength();
- }
-
- @Override
public byte[] getValue() {
return copyIfNecessary(value);
}
@Override
+ public byte [] getValueArray() {
+ return this.value.get();
+ }
+
+ @Override
public byte[] getRow() {
return copyIfNecessary(row);
}
+
+ @Override
+ public byte[] getRowArray() {
+ return this.row.get();
+ }
@Override
public long getTimestamp() {
@@ -186,11 +183,21 @@ public class ClientKeyValue extends KeyValue {
public byte[] getFamily() {
return copyIfNecessary(family);
}
+
+ @Override
+ public byte[] getFamilyArray() {
+ return this.family.get();
+ }
@Override
public byte[] getQualifier() {
return copyIfNecessary(qualifier);
}
+
+ @Override
+ public byte[] getQualifierArray() {
+ return this.qualifier.get();
+ }
@Override
public byte getType() {
@@ -198,6 +205,11 @@ public class ClientKeyValue extends KeyValue {
}
@Override
+ public byte getTypeByte() {
+ return this.type.getCode();
+ }
+
+ @Override
public boolean matchingFamily(byte[] family) {
if (family == null) {
if (this.family.getLength() == 0) {
@@ -208,7 +220,6 @@ public class ClientKeyValue extends KeyValue {
return matchingFamily(family, 0, family.length);
}
- @Override
public boolean matchingFamily(byte[] family, int offset, int length) {
if (family == null) {
if (this.family.getLength() == 0) {
@@ -219,7 +230,6 @@ public class ClientKeyValue extends KeyValue {
return matches(family, offset, length, this.family);
}
- @Override
public boolean matchingFamily(KeyValue other) {
if(other == null) {
return false;
@@ -228,7 +238,7 @@ public class ClientKeyValue extends KeyValue {
ClientKeyValue kv = (ClientKeyValue)other;
return this.family.compareTo(kv.family) == 0;
}
- return matchingFamily(other.getBuffer(), other.getFamilyOffset(), other.getFamilyLength());
+ return matchingFamily(other.getFamilyArray(), other.getFamilyOffset(), other.getFamilyLength());
}
private boolean matches(byte[] b, int offset, int length, ImmutableBytesWritable bytes) {
@@ -266,7 +276,7 @@ public class ClientKeyValue extends KeyValue {
ClientKeyValue kv = (ClientKeyValue) other;
return this.row.compareTo(kv.row) == 0;
}
- return matchingQualifier(other.getBuffer(), other.getQualifierOffset(),
+ return matchingQualifier(other.getQualifierArray(), other.getQualifierOffset(),
other.getQualifierLength());
}
@@ -288,16 +298,7 @@ public class ClientKeyValue extends KeyValue {
@Override
public boolean matchingRow(KeyValue other) {
- return matchingRow(other.getBuffer(), other.getRowOffset(), other.getRowLength());
- }
-
- @Override
- public boolean matchingColumnNoDelimiter(byte[] column) {
- // match both the family and qualifier
- if (matchingFamily(column, 0, this.family.getLength())) {
- return matchingQualifier(column, family.getLength(), column.length - family.getLength());
- }
- return false;
+ return matchingRow(other.getRowArray(), other.getRowOffset(), other.getRowLength());
}
@Override
@@ -305,18 +306,6 @@ public class ClientKeyValue extends KeyValue {
return this.matchingFamily(family) && matchingQualifier(qualifier);
}
- @Override
- public boolean nonNullRowAndColumn() {
- return (this.row != null && row.getLength() > 0) && !isEmptyColumn();
- }
-
- @Override
- public boolean isEmptyColumn() {
- return this.qualifier != null && this.qualifier.getLength() > 0;
- }
-
-
- @Override
public void write(DataOutput out) throws IOException {
// we need to simulate the keyvalue writing, but actually step through each buffer.
//start with keylength
@@ -359,7 +348,7 @@ public class ClientKeyValue extends KeyValue {
@Override
public String toString() {
- return keyToString() + "/vlen=" + getValueLength() + "/ts=" + getMemstoreTS();
+ return keyToString() + "/vlen=" + getValueLength() + "/ts=" + this.getMvccVersion();
}
private String keyToString() {
@@ -413,44 +402,16 @@ public class ClientKeyValue extends KeyValue {
}
@Override
- public void readFields(int length, DataInput in) throws IOException {
- throw new UnsupportedOperationException(ClientKeyValue.class.getSimpleName()
- + " should not be used for server-side operations");
- }
-
- @Override
- public void readFields(DataInput in) throws IOException {
- throw new UnsupportedOperationException(ClientKeyValue.class.getSimpleName()
- + " should not be used for server-side operations");
- }
-
- @Override
public int getKeyOffset() {
return 0;
}
-
- @Override
- public int getFamilyOffset(int rlength) {
- return 0;
- }
-
- @Override
- public int getQualifierOffset(int foffset) {
- return 0;
- }
-
@Override
public int getTimestampOffset() {
return 0;
}
@Override
- public int getTimestampOffset(int keylength) {
- return 0;
- }
-
- @Override
public int getOffset() {
return 0;
}
@@ -490,14 +451,26 @@ public class ClientKeyValue extends KeyValue {
}
@Override
- public SplitKeyValue split() {
- throw new UnsupportedOperationException(ClientKeyValue.class.getSimpleName()
- + " should not be used for server-side operations");
- }
-
- @Override
public byte[] getBuffer() {
- throw new UnsupportedOperationException(ClientKeyValue.class.getSimpleName()
- + " does not support a single backing buffer.");
- }
+ if(this.bytes != null) return this.bytes;
+ try {
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ DataOutputStream out = new DataOutputStream(byteStream);
+ try {
+ write(out);
+ this.bytes = byteStream.toByteArray();
+ return this.bytes;
+ } finally {
+ if (out != null) {
+ out.close();
+ out = null;
+ }
+ }
+ } catch (IOException ioe) {
+ throw new UnsupportedOperationException(
+ ClientKeyValue.class.getSimpleName()
+ + " can not being serialized to a single backing buffer. Due to " + ioe);
+ }
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
index 9e25c48..74b05d6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
@@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.FilterList;
@@ -343,8 +344,8 @@ public class DeleteCompiler {
Tuple tuple;
long totalRowCount = 0;
while ((tuple=iterator.next()) != null) {// Runs query
- KeyValue kv = tuple.getValue(0);
- totalRowCount += PDataType.LONG.getCodec().decodeLong(kv.getBuffer(), kv.getValueOffset(), null);
+ Cell kv = tuple.getValue(0);
+ totalRowCount += PDataType.LONG.getCodec().decodeLong(kv.getValueArray(), kv.getValueOffset(), null);
}
// Return total number of rows that have been delete. In the case of auto commit being off
// the mutations will all be in the mutation state of the current connection.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index c57466c..d7991c8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
@@ -571,8 +572,8 @@ public class UpsertCompiler {
Tuple tuple;
long totalRowCount = 0;
while ((tuple=iterator.next()) != null) {// Runs query
- KeyValue kv = tuple.getValue(0);
- totalRowCount += PDataType.LONG.getCodec().decodeLong(kv.getBuffer(), kv.getValueOffset(), null);
+ Cell kv = tuple.getValue(0);
+ totalRowCount += PDataType.LONG.getCodec().decodeLong(kv.getValueArray(), kv.getValueOffset(), null);
}
// Return total number of rows that have been updated. In the case of auto commit being off
// the mutations will all be in the mutation state of the current connection.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
index 2e12021..6b02332 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
@@ -22,6 +22,7 @@ package org.apache.phoenix.coprocessor;
import java.io.IOException;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
@@ -34,16 +35,12 @@ public abstract class BaseRegionScanner implements RegionScanner {
}
@Override
- public boolean next(List<KeyValue> results, String metric) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
return next(results);
}
@Override
- public boolean next(List<KeyValue> result, int limit, String metric) throws IOException {
- return next(result);
- }
- @Override
- public boolean next(List<KeyValue> result, int limit) throws IOException {
+ public boolean next(List<Cell> result, int limit) throws IOException {
return next(result);
}
@@ -58,12 +55,12 @@ public abstract class BaseRegionScanner implements RegionScanner {
}
@Override
- public boolean nextRaw(List<KeyValue> result, String metric) throws IOException {
- return next(result, metric);
+ public boolean nextRaw(List<Cell> result) throws IOException {
+ return next(result);
}
@Override
- public boolean nextRaw(List<KeyValue> result, int limit, String metric) throws IOException {
- return next(result, limit, metric);
+ public boolean nextRaw(List<Cell> result, int limit) throws IOException {
+ return next(result, limit);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
index 81291ba..331d278 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GroupedAggregateRegionObserver.java
@@ -38,6 +38,7 @@ import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
@@ -64,6 +65,7 @@ import org.apache.phoenix.expression.aggregator.Aggregator;
import org.apache.phoenix.expression.aggregator.ServerAggregators;
import org.apache.phoenix.join.HashJoinInfo;
import org.apache.phoenix.join.ScanProjector;
+import org.apache.phoenix.memory.GlobalMemoryManager;
import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.tuple.MultiKeyValueTuple;
@@ -296,12 +298,17 @@ public class GroupedAggregateRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
if (index >= aggResults.size()) return false;
results.add(aggResults.get(index));
index++;
return index < aggResults.size();
}
+
+ @Override
+ public long getMaxResultSize() {
+ return s.getMaxResultSize();
+ }
};
}
@@ -368,17 +375,16 @@ public class GroupedAggregateRegionObserver extends BaseScannerRegionObserver {
}
HRegion region = c.getEnvironment().getRegion();
- MultiVersionConsistencyControl.setThreadReadPoint(s.getMvccReadPoint());
region.startRegionOperation();
try {
do {
- List<KeyValue> results = new ArrayList<KeyValue>();
+ List<Cell> results = new ArrayList<Cell>();
// Results are potentially returned even when the return
// value of s.next is false
// since this is an indication of whether or not there are
// more values after the
// ones returned
- hasMore = s.nextRaw(results, null);
+ hasMore = s.nextRaw(results);
if (!results.isEmpty()) {
result.setKeyValues(results);
ImmutableBytesWritable key =
@@ -433,24 +439,23 @@ public class GroupedAggregateRegionObserver extends BaseScannerRegionObserver {
}
@Override
- public boolean next(List<KeyValue> results) throws IOException {
+ public boolean next(List<Cell> results) throws IOException {
boolean hasMore;
boolean aggBoundary = false;
MultiKeyValueTuple result = new MultiKeyValueTuple();
ImmutableBytesWritable key = null;
Aggregator[] rowAggregators = aggregators.getAggregators();
HRegion region = c.getEnvironment().getRegion();
- MultiVersionConsistencyControl.setThreadReadPoint(s.getMvccReadPoint());
region.startRegionOperation();
try {
do {
- List<KeyValue> kvs = new ArrayList<KeyValue>();
+ List<Cell> kvs = new ArrayList<Cell>();
// Results are potentially returned even when the return
// value of s.next is false
// since this is an indication of whether or not there
// are more values after the
// ones returned
- hasMore = s.nextRaw(kvs, null);
+ hasMore = s.nextRaw(kvs);
if (!kvs.isEmpty()) {
result.setKeyValues(kvs);
key = TupleUtil.getConcatenatedValue(result, expressions);
@@ -502,6 +507,11 @@ public class GroupedAggregateRegionObserver extends BaseScannerRegionObserver {
currentKey = null;
return false;
}
+
+ @Override
+ public long getMaxResultSize() {
+ return s.getMaxResultSize();
+ }
};
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
index dfaf553..370e6c9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
@@ -25,15 +25,14 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.cache.GlobalCache;
import org.apache.phoenix.cache.HashCache;
import org.apache.phoenix.cache.TenantCache;
@@ -93,11 +92,11 @@ public class HashJoinRegionScanner implements RegionScanner {
}
}
- private void processResults(List<KeyValue> result, boolean hasLimit) throws IOException {
+ private void processResults(List<Cell> result, boolean hasLimit) throws IOException {
if (result.isEmpty())
return;
- Tuple tuple = new ResultTuple(new Result(result));
+ Tuple tuple = new ResultTuple(Result.create(result));
if (joinInfo == null) {
resultQueue.offer(projector.projectResults(tuple));
return;
@@ -190,7 +189,7 @@ public class HashJoinRegionScanner implements RegionScanner {
return hasMore;
}
- private boolean nextInQueue(List<KeyValue> results) {
+ private boolean nextInQueue(List<Cell> results) {
if (resultQueue.isEmpty())
return false;
@@ -212,14 +211,14 @@ public class HashJoinRegionScanner implements RegionScanner {
}
@Override
- public boolean isFilterDone() {
+ public boolean isFilterDone() throws IOException {
return scanner.isFilterDone() && resultQueue.isEmpty();
}
@Override
- public boolean nextRaw(List<KeyValue> result, String metric) throws IOException {
+ public boolean nextRaw(List<Cell> result) throws IOException {
while (shouldAdvance()) {
- hasMore = scanner.nextRaw(result, metric);
+ hasMore = scanner.nextRaw(result);
processResults(result, false);
result.clear();
}
@@ -228,10 +227,10 @@ public class HashJoinRegionScanner implements RegionScanner {
}
@Override
- public boolean nextRaw(List<KeyValue> result, int limit, String metric)
+ public boolean nextRaw(List<Cell> result, int limit)
throws IOException {
while (shouldAdvance()) {
- hasMore = scanner.nextRaw(result, limit, metric);
+ hasMore = scanner.nextRaw(result, limit);
processResults(result, true);
result.clear();
}
@@ -250,7 +249,7 @@ public class HashJoinRegionScanner implements RegionScanner {
}
@Override
- public boolean next(List<KeyValue> result) throws IOException {
+ public boolean next(List<Cell> result) throws IOException {
while (shouldAdvance()) {
hasMore = scanner.next(result);
processResults(result, false);
@@ -261,18 +260,7 @@ public class HashJoinRegionScanner implements RegionScanner {
}
@Override
- public boolean next(List<KeyValue> result, String metric) throws IOException {
- while (shouldAdvance()) {
- hasMore = scanner.next(result, metric);
- processResults(result, false);
- result.clear();
- }
-
- return nextInQueue(result);
- }
-
- @Override
- public boolean next(List<KeyValue> result, int limit) throws IOException {
+ public boolean next(List<Cell> result, int limit) throws IOException {
while (shouldAdvance()) {
hasMore = scanner.next(result, limit);
processResults(result, true);
@@ -283,15 +271,8 @@ public class HashJoinRegionScanner implements RegionScanner {
}
@Override
- public boolean next(List<KeyValue> result, int limit, String metric)
- throws IOException {
- while (shouldAdvance()) {
- hasMore = scanner.next(result, limit, metric);
- processResults(result, true);
- result.clear();
- }
-
- return nextInQueue(result);
+ public long getMaxResultSize() {
+ return this.scanner.getMaxResultSize();
}
}
[05/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCacheFactoryProtos.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCacheFactoryProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCacheFactoryProtos.java
new file mode 100644
index 0000000..09b39d0
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCacheFactoryProtos.java
@@ -0,0 +1,568 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: ServerCacheFactory.proto
+
+package org.apache.phoenix.coprocessor.generated;
+
+public final class ServerCacheFactoryProtos {
+ private ServerCacheFactoryProtos() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface ServerCacheFactoryOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string className = 1;
+ /**
+ * <code>required string className = 1;</code>
+ */
+ boolean hasClassName();
+ /**
+ * <code>required string className = 1;</code>
+ */
+ java.lang.String getClassName();
+ /**
+ * <code>required string className = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getClassNameBytes();
+ }
+ /**
+ * Protobuf type {@code ServerCacheFactory}
+ */
+ public static final class ServerCacheFactory extends
+ com.google.protobuf.GeneratedMessage
+ implements ServerCacheFactoryOrBuilder {
+ // Use ServerCacheFactory.newBuilder() to construct.
+ private ServerCacheFactory(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private ServerCacheFactory(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final ServerCacheFactory defaultInstance;
+ public static ServerCacheFactory getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public ServerCacheFactory getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private ServerCacheFactory(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ className_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.internal_static_ServerCacheFactory_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.internal_static_ServerCacheFactory_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.class, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<ServerCacheFactory> PARSER =
+ new com.google.protobuf.AbstractParser<ServerCacheFactory>() {
+ public ServerCacheFactory parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new ServerCacheFactory(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<ServerCacheFactory> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string className = 1;
+ public static final int CLASSNAME_FIELD_NUMBER = 1;
+ private java.lang.Object className_;
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public boolean hasClassName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public java.lang.String getClassName() {
+ java.lang.Object ref = className_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ className_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getClassNameBytes() {
+ java.lang.Object ref = className_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ className_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ className_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasClassName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getClassNameBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getClassNameBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory other = (org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory) obj;
+
+ boolean result = true;
+ result = result && (hasClassName() == other.hasClassName());
+ if (hasClassName()) {
+ result = result && getClassName()
+ .equals(other.getClassName());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasClassName()) {
+ hash = (37 * hash) + CLASSNAME_FIELD_NUMBER;
+ hash = (53 * hash) + getClassName().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code ServerCacheFactory}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactoryOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.internal_static_ServerCacheFactory_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.internal_static_ServerCacheFactory_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.class, org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ className_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.internal_static_ServerCacheFactory_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory build() {
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory buildPartial() {
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory result = new org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.className_ = className_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory other) {
+ if (other == org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory.getDefaultInstance()) return this;
+ if (other.hasClassName()) {
+ bitField0_ |= 0x00000001;
+ className_ = other.className_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasClassName()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.ServerCacheFactoryProtos.ServerCacheFactory) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string className = 1;
+ private java.lang.Object className_ = "";
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public boolean hasClassName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public java.lang.String getClassName() {
+ java.lang.Object ref = className_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ className_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getClassNameBytes() {
+ java.lang.Object ref = className_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ className_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public Builder setClassName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ className_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public Builder clearClassName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ className_ = getDefaultInstance().getClassName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string className = 1;</code>
+ */
+ public Builder setClassNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ className_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:ServerCacheFactory)
+ }
+
+ static {
+ defaultInstance = new ServerCacheFactory(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:ServerCacheFactory)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_ServerCacheFactory_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_ServerCacheFactory_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\030ServerCacheFactory.proto\"\'\n\022ServerCach" +
+ "eFactory\022\021\n\tclassName\030\001 \002(\tBL\n(org.apach" +
+ "e.phoenix.coprocessor.generatedB\030ServerC" +
+ "acheFactoryProtosH\001\210\001\001\240\001\001"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_ServerCacheFactory_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_ServerCacheFactory_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_ServerCacheFactory_descriptor,
+ new java.lang.String[] { "ClassName", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
[07/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java
new file mode 100644
index 0000000..7ba56c9
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java
@@ -0,0 +1,7135 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: MetaDataService.proto
+
+package org.apache.phoenix.coprocessor.generated;
+
+public final class MetaDataProtos {
+ private MetaDataProtos() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ /**
+ * Protobuf enum {@code MutationCode}
+ */
+ public enum MutationCode
+ implements com.google.protobuf.ProtocolMessageEnum {
+ /**
+ * <code>TABLE_ALREADY_EXISTS = 0;</code>
+ */
+ TABLE_ALREADY_EXISTS(0, 0),
+ /**
+ * <code>TABLE_NOT_FOUND = 1;</code>
+ */
+ TABLE_NOT_FOUND(1, 1),
+ /**
+ * <code>COLUMN_NOT_FOUND = 2;</code>
+ */
+ COLUMN_NOT_FOUND(2, 2),
+ /**
+ * <code>COLUMN_ALREADY_EXISTS = 3;</code>
+ */
+ COLUMN_ALREADY_EXISTS(3, 3),
+ /**
+ * <code>CONCURRENT_TABLE_MUTATION = 4;</code>
+ */
+ CONCURRENT_TABLE_MUTATION(4, 4),
+ /**
+ * <code>TABLE_NOT_IN_REGION = 5;</code>
+ */
+ TABLE_NOT_IN_REGION(5, 5),
+ /**
+ * <code>NEWER_TABLE_FOUND = 6;</code>
+ */
+ NEWER_TABLE_FOUND(6, 6),
+ /**
+ * <code>UNALLOWED_TABLE_MUTATION = 7;</code>
+ */
+ UNALLOWED_TABLE_MUTATION(7, 7),
+ /**
+ * <code>NO_PK_COLUMNS = 8;</code>
+ */
+ NO_PK_COLUMNS(8, 8),
+ /**
+ * <code>PARENT_TABLE_NOT_FOUND = 9;</code>
+ */
+ PARENT_TABLE_NOT_FOUND(9, 9),
+ ;
+
+ /**
+ * <code>TABLE_ALREADY_EXISTS = 0;</code>
+ */
+ public static final int TABLE_ALREADY_EXISTS_VALUE = 0;
+ /**
+ * <code>TABLE_NOT_FOUND = 1;</code>
+ */
+ public static final int TABLE_NOT_FOUND_VALUE = 1;
+ /**
+ * <code>COLUMN_NOT_FOUND = 2;</code>
+ */
+ public static final int COLUMN_NOT_FOUND_VALUE = 2;
+ /**
+ * <code>COLUMN_ALREADY_EXISTS = 3;</code>
+ */
+ public static final int COLUMN_ALREADY_EXISTS_VALUE = 3;
+ /**
+ * <code>CONCURRENT_TABLE_MUTATION = 4;</code>
+ */
+ public static final int CONCURRENT_TABLE_MUTATION_VALUE = 4;
+ /**
+ * <code>TABLE_NOT_IN_REGION = 5;</code>
+ */
+ public static final int TABLE_NOT_IN_REGION_VALUE = 5;
+ /**
+ * <code>NEWER_TABLE_FOUND = 6;</code>
+ */
+ public static final int NEWER_TABLE_FOUND_VALUE = 6;
+ /**
+ * <code>UNALLOWED_TABLE_MUTATION = 7;</code>
+ */
+ public static final int UNALLOWED_TABLE_MUTATION_VALUE = 7;
+ /**
+ * <code>NO_PK_COLUMNS = 8;</code>
+ */
+ public static final int NO_PK_COLUMNS_VALUE = 8;
+ /**
+ * <code>PARENT_TABLE_NOT_FOUND = 9;</code>
+ */
+ public static final int PARENT_TABLE_NOT_FOUND_VALUE = 9;
+
+
+ public final int getNumber() { return value; }
+
+ public static MutationCode valueOf(int value) {
+ switch (value) {
+ case 0: return TABLE_ALREADY_EXISTS;
+ case 1: return TABLE_NOT_FOUND;
+ case 2: return COLUMN_NOT_FOUND;
+ case 3: return COLUMN_ALREADY_EXISTS;
+ case 4: return CONCURRENT_TABLE_MUTATION;
+ case 5: return TABLE_NOT_IN_REGION;
+ case 6: return NEWER_TABLE_FOUND;
+ case 7: return UNALLOWED_TABLE_MUTATION;
+ case 8: return NO_PK_COLUMNS;
+ case 9: return PARENT_TABLE_NOT_FOUND;
+ default: return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap<MutationCode>
+ internalGetValueMap() {
+ return internalValueMap;
+ }
+ private static com.google.protobuf.Internal.EnumLiteMap<MutationCode>
+ internalValueMap =
+ new com.google.protobuf.Internal.EnumLiteMap<MutationCode>() {
+ public MutationCode findValueByNumber(int number) {
+ return MutationCode.valueOf(number);
+ }
+ };
+
+ public final com.google.protobuf.Descriptors.EnumValueDescriptor
+ getValueDescriptor() {
+ return getDescriptor().getValues().get(index);
+ }
+ public final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptorForType() {
+ return getDescriptor();
+ }
+ public static final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.getDescriptor().getEnumTypes().get(0);
+ }
+
+ private static final MutationCode[] VALUES = values();
+
+ public static MutationCode valueOf(
+ com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+ if (desc.getType() != getDescriptor()) {
+ throw new java.lang.IllegalArgumentException(
+ "EnumValueDescriptor is not for this type.");
+ }
+ return VALUES[desc.getIndex()];
+ }
+
+ private final int index;
+ private final int value;
+
+ private MutationCode(int index, int value) {
+ this.index = index;
+ this.value = value;
+ }
+
+ // @@protoc_insertion_point(enum_scope:MutationCode)
+ }
+
+ public interface MetaDataResponseOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional .MutationCode returnCode = 1;
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ boolean hasReturnCode();
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode getReturnCode();
+
+ // optional int64 mutationTime = 2;
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ boolean hasMutationTime();
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ long getMutationTime();
+
+ // optional .PTable table = 3;
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ boolean hasTable();
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable getTable();
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder getTableOrBuilder();
+
+ // repeated bytes tablesToDelete = 4;
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ java.util.List<com.google.protobuf.ByteString> getTablesToDeleteList();
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ int getTablesToDeleteCount();
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ com.google.protobuf.ByteString getTablesToDelete(int index);
+
+ // optional bytes columnName = 5;
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ boolean hasColumnName();
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ com.google.protobuf.ByteString getColumnName();
+
+ // optional bytes familyName = 6;
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ boolean hasFamilyName();
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ com.google.protobuf.ByteString getFamilyName();
+ }
+ /**
+ * Protobuf type {@code MetaDataResponse}
+ */
+ public static final class MetaDataResponse extends
+ com.google.protobuf.GeneratedMessage
+ implements MetaDataResponseOrBuilder {
+ // Use MetaDataResponse.newBuilder() to construct.
+ private MetaDataResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private MetaDataResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final MetaDataResponse defaultInstance;
+ public static MetaDataResponse getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public MetaDataResponse getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private MetaDataResponse(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ int rawValue = input.readEnum();
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode value = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.valueOf(rawValue);
+ if (value == null) {
+ unknownFields.mergeVarintField(1, rawValue);
+ } else {
+ bitField0_ |= 0x00000001;
+ returnCode_ = value;
+ }
+ break;
+ }
+ case 16: {
+ bitField0_ |= 0x00000002;
+ mutationTime_ = input.readInt64();
+ break;
+ }
+ case 26: {
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = table_.toBuilder();
+ }
+ table_ = input.readMessage(org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(table_);
+ table_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ case 34: {
+ if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ tablesToDelete_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
+ mutable_bitField0_ |= 0x00000008;
+ }
+ tablesToDelete_.add(input.readBytes());
+ break;
+ }
+ case 42: {
+ bitField0_ |= 0x00000008;
+ columnName_ = input.readBytes();
+ break;
+ }
+ case 50: {
+ bitField0_ |= 0x00000010;
+ familyName_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ tablesToDelete_ = java.util.Collections.unmodifiableList(tablesToDelete_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_MetaDataResponse_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_MetaDataResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<MetaDataResponse> PARSER =
+ new com.google.protobuf.AbstractParser<MetaDataResponse>() {
+ public MetaDataResponse parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new MetaDataResponse(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<MetaDataResponse> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional .MutationCode returnCode = 1;
+ public static final int RETURNCODE_FIELD_NUMBER = 1;
+ private org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode returnCode_;
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public boolean hasReturnCode() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode getReturnCode() {
+ return returnCode_;
+ }
+
+ // optional int64 mutationTime = 2;
+ public static final int MUTATIONTIME_FIELD_NUMBER = 2;
+ private long mutationTime_;
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public boolean hasMutationTime() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public long getMutationTime() {
+ return mutationTime_;
+ }
+
+ // optional .PTable table = 3;
+ public static final int TABLE_FIELD_NUMBER = 3;
+ private org.apache.phoenix.coprocessor.generated.PTableProtos.PTable table_;
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public boolean hasTable() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTable getTable() {
+ return table_;
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder getTableOrBuilder() {
+ return table_;
+ }
+
+ // repeated bytes tablesToDelete = 4;
+ public static final int TABLESTODELETE_FIELD_NUMBER = 4;
+ private java.util.List<com.google.protobuf.ByteString> tablesToDelete_;
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public java.util.List<com.google.protobuf.ByteString>
+ getTablesToDeleteList() {
+ return tablesToDelete_;
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public int getTablesToDeleteCount() {
+ return tablesToDelete_.size();
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public com.google.protobuf.ByteString getTablesToDelete(int index) {
+ return tablesToDelete_.get(index);
+ }
+
+ // optional bytes columnName = 5;
+ public static final int COLUMNNAME_FIELD_NUMBER = 5;
+ private com.google.protobuf.ByteString columnName_;
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public boolean hasColumnName() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public com.google.protobuf.ByteString getColumnName() {
+ return columnName_;
+ }
+
+ // optional bytes familyName = 6;
+ public static final int FAMILYNAME_FIELD_NUMBER = 6;
+ private com.google.protobuf.ByteString familyName_;
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public boolean hasFamilyName() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public com.google.protobuf.ByteString getFamilyName() {
+ return familyName_;
+ }
+
+ private void initFields() {
+ returnCode_ = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS;
+ mutationTime_ = 0L;
+ table_ = org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.getDefaultInstance();
+ tablesToDelete_ = java.util.Collections.emptyList();
+ columnName_ = com.google.protobuf.ByteString.EMPTY;
+ familyName_ = com.google.protobuf.ByteString.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (hasTable()) {
+ if (!getTable().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeEnum(1, returnCode_.getNumber());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeInt64(2, mutationTime_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, table_);
+ }
+ for (int i = 0; i < tablesToDelete_.size(); i++) {
+ output.writeBytes(4, tablesToDelete_.get(i));
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeBytes(5, columnName_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeBytes(6, familyName_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeEnumSize(1, returnCode_.getNumber());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(2, mutationTime_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, table_);
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < tablesToDelete_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(tablesToDelete_.get(i));
+ }
+ size += dataSize;
+ size += 1 * getTablesToDeleteList().size();
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(5, columnName_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(6, familyName_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse other = (org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse) obj;
+
+ boolean result = true;
+ result = result && (hasReturnCode() == other.hasReturnCode());
+ if (hasReturnCode()) {
+ result = result &&
+ (getReturnCode() == other.getReturnCode());
+ }
+ result = result && (hasMutationTime() == other.hasMutationTime());
+ if (hasMutationTime()) {
+ result = result && (getMutationTime()
+ == other.getMutationTime());
+ }
+ result = result && (hasTable() == other.hasTable());
+ if (hasTable()) {
+ result = result && getTable()
+ .equals(other.getTable());
+ }
+ result = result && getTablesToDeleteList()
+ .equals(other.getTablesToDeleteList());
+ result = result && (hasColumnName() == other.hasColumnName());
+ if (hasColumnName()) {
+ result = result && getColumnName()
+ .equals(other.getColumnName());
+ }
+ result = result && (hasFamilyName() == other.hasFamilyName());
+ if (hasFamilyName()) {
+ result = result && getFamilyName()
+ .equals(other.getFamilyName());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasReturnCode()) {
+ hash = (37 * hash) + RETURNCODE_FIELD_NUMBER;
+ hash = (53 * hash) + hashEnum(getReturnCode());
+ }
+ if (hasMutationTime()) {
+ hash = (37 * hash) + MUTATIONTIME_FIELD_NUMBER;
+ hash = (53 * hash) + hashLong(getMutationTime());
+ }
+ if (hasTable()) {
+ hash = (37 * hash) + TABLE_FIELD_NUMBER;
+ hash = (53 * hash) + getTable().hashCode();
+ }
+ if (getTablesToDeleteCount() > 0) {
+ hash = (37 * hash) + TABLESTODELETE_FIELD_NUMBER;
+ hash = (53 * hash) + getTablesToDeleteList().hashCode();
+ }
+ if (hasColumnName()) {
+ hash = (37 * hash) + COLUMNNAME_FIELD_NUMBER;
+ hash = (53 * hash) + getColumnName().hashCode();
+ }
+ if (hasFamilyName()) {
+ hash = (37 * hash) + FAMILYNAME_FIELD_NUMBER;
+ hash = (53 * hash) + getFamilyName().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code MetaDataResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponseOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_MetaDataResponse_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_MetaDataResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getTableFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ returnCode_ = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ mutationTime_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (tableBuilder_ == null) {
+ table_ = org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.getDefaultInstance();
+ } else {
+ tableBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ tablesToDelete_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ columnName_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ familyName_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_MetaDataResponse_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse build() {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse buildPartial() {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse result = new org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.returnCode_ = returnCode_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.mutationTime_ = mutationTime_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (tableBuilder_ == null) {
+ result.table_ = table_;
+ } else {
+ result.table_ = tableBuilder_.build();
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ tablesToDelete_ = java.util.Collections.unmodifiableList(tablesToDelete_);
+ bitField0_ = (bitField0_ & ~0x00000008);
+ }
+ result.tablesToDelete_ = tablesToDelete_;
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.columnName_ = columnName_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.familyName_ = familyName_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse other) {
+ if (other == org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse.getDefaultInstance()) return this;
+ if (other.hasReturnCode()) {
+ setReturnCode(other.getReturnCode());
+ }
+ if (other.hasMutationTime()) {
+ setMutationTime(other.getMutationTime());
+ }
+ if (other.hasTable()) {
+ mergeTable(other.getTable());
+ }
+ if (!other.tablesToDelete_.isEmpty()) {
+ if (tablesToDelete_.isEmpty()) {
+ tablesToDelete_ = other.tablesToDelete_;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ } else {
+ ensureTablesToDeleteIsMutable();
+ tablesToDelete_.addAll(other.tablesToDelete_);
+ }
+ onChanged();
+ }
+ if (other.hasColumnName()) {
+ setColumnName(other.getColumnName());
+ }
+ if (other.hasFamilyName()) {
+ setFamilyName(other.getFamilyName());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (hasTable()) {
+ if (!getTable().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional .MutationCode returnCode = 1;
+ private org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode returnCode_ = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS;
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public boolean hasReturnCode() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode getReturnCode() {
+ return returnCode_;
+ }
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public Builder setReturnCode(org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ returnCode_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional .MutationCode returnCode = 1;</code>
+ */
+ public Builder clearReturnCode() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ returnCode_ = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 mutationTime = 2;
+ private long mutationTime_ ;
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public boolean hasMutationTime() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public long getMutationTime() {
+ return mutationTime_;
+ }
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public Builder setMutationTime(long value) {
+ bitField0_ |= 0x00000002;
+ mutationTime_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 mutationTime = 2;</code>
+ */
+ public Builder clearMutationTime() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ mutationTime_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional .PTable table = 3;
+ private org.apache.phoenix.coprocessor.generated.PTableProtos.PTable table_ = org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable, org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder, org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder> tableBuilder_;
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public boolean hasTable() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTable getTable() {
+ if (tableBuilder_ == null) {
+ return table_;
+ } else {
+ return tableBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public Builder setTable(org.apache.phoenix.coprocessor.generated.PTableProtos.PTable value) {
+ if (tableBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ table_ = value;
+ onChanged();
+ } else {
+ tableBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public Builder setTable(
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder builderForValue) {
+ if (tableBuilder_ == null) {
+ table_ = builderForValue.build();
+ onChanged();
+ } else {
+ tableBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public Builder mergeTable(org.apache.phoenix.coprocessor.generated.PTableProtos.PTable value) {
+ if (tableBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ table_ != org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.getDefaultInstance()) {
+ table_ =
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.newBuilder(table_).mergeFrom(value).buildPartial();
+ } else {
+ table_ = value;
+ }
+ onChanged();
+ } else {
+ tableBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public Builder clearTable() {
+ if (tableBuilder_ == null) {
+ table_ = org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.getDefaultInstance();
+ onChanged();
+ } else {
+ tableBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder getTableBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getTableFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder getTableOrBuilder() {
+ if (tableBuilder_ != null) {
+ return tableBuilder_.getMessageOrBuilder();
+ } else {
+ return table_;
+ }
+ }
+ /**
+ * <code>optional .PTable table = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable, org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder, org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder>
+ getTableFieldBuilder() {
+ if (tableBuilder_ == null) {
+ tableBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.apache.phoenix.coprocessor.generated.PTableProtos.PTable, org.apache.phoenix.coprocessor.generated.PTableProtos.PTable.Builder, org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder>(
+ table_,
+ getParentForChildren(),
+ isClean());
+ table_ = null;
+ }
+ return tableBuilder_;
+ }
+
+ // repeated bytes tablesToDelete = 4;
+ private java.util.List<com.google.protobuf.ByteString> tablesToDelete_ = java.util.Collections.emptyList();
+ private void ensureTablesToDeleteIsMutable() {
+ if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+ tablesToDelete_ = new java.util.ArrayList<com.google.protobuf.ByteString>(tablesToDelete_);
+ bitField0_ |= 0x00000008;
+ }
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public java.util.List<com.google.protobuf.ByteString>
+ getTablesToDeleteList() {
+ return java.util.Collections.unmodifiableList(tablesToDelete_);
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public int getTablesToDeleteCount() {
+ return tablesToDelete_.size();
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public com.google.protobuf.ByteString getTablesToDelete(int index) {
+ return tablesToDelete_.get(index);
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public Builder setTablesToDelete(
+ int index, com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureTablesToDeleteIsMutable();
+ tablesToDelete_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public Builder addTablesToDelete(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureTablesToDeleteIsMutable();
+ tablesToDelete_.add(value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public Builder addAllTablesToDelete(
+ java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
+ ensureTablesToDeleteIsMutable();
+ super.addAll(values, tablesToDelete_);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated bytes tablesToDelete = 4;</code>
+ */
+ public Builder clearTablesToDelete() {
+ tablesToDelete_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ onChanged();
+ return this;
+ }
+
+ // optional bytes columnName = 5;
+ private com.google.protobuf.ByteString columnName_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public boolean hasColumnName() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public com.google.protobuf.ByteString getColumnName() {
+ return columnName_;
+ }
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public Builder setColumnName(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000010;
+ columnName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional bytes columnName = 5;</code>
+ */
+ public Builder clearColumnName() {
+ bitField0_ = (bitField0_ & ~0x00000010);
+ columnName_ = getDefaultInstance().getColumnName();
+ onChanged();
+ return this;
+ }
+
+ // optional bytes familyName = 6;
+ private com.google.protobuf.ByteString familyName_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public boolean hasFamilyName() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public com.google.protobuf.ByteString getFamilyName() {
+ return familyName_;
+ }
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public Builder setFamilyName(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000020;
+ familyName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional bytes familyName = 6;</code>
+ */
+ public Builder clearFamilyName() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ familyName_ = getDefaultInstance().getFamilyName();
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:MetaDataResponse)
+ }
+
+ static {
+ defaultInstance = new MetaDataResponse(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:MetaDataResponse)
+ }
+
+ public interface GetTableRequestOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bytes tenantId = 1;
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ boolean hasTenantId();
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ com.google.protobuf.ByteString getTenantId();
+
+ // required bytes schemaName = 2;
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ boolean hasSchemaName();
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ com.google.protobuf.ByteString getSchemaName();
+
+ // required bytes tableName = 3;
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ boolean hasTableName();
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ com.google.protobuf.ByteString getTableName();
+
+ // required int64 tableTimestamp = 4;
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ boolean hasTableTimestamp();
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ long getTableTimestamp();
+
+ // required int64 clientTimestamp = 5;
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ boolean hasClientTimestamp();
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ long getClientTimestamp();
+ }
+ /**
+ * Protobuf type {@code GetTableRequest}
+ */
+ public static final class GetTableRequest extends
+ com.google.protobuf.GeneratedMessage
+ implements GetTableRequestOrBuilder {
+ // Use GetTableRequest.newBuilder() to construct.
+ private GetTableRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private GetTableRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final GetTableRequest defaultInstance;
+ public static GetTableRequest getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public GetTableRequest getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private GetTableRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ tenantId_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ schemaName_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ bitField0_ |= 0x00000004;
+ tableName_ = input.readBytes();
+ break;
+ }
+ case 32: {
+ bitField0_ |= 0x00000008;
+ tableTimestamp_ = input.readInt64();
+ break;
+ }
+ case 40: {
+ bitField0_ |= 0x00000010;
+ clientTimestamp_ = input.readInt64();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_GetTableRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_GetTableRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<GetTableRequest> PARSER =
+ new com.google.protobuf.AbstractParser<GetTableRequest>() {
+ public GetTableRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new GetTableRequest(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<GetTableRequest> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bytes tenantId = 1;
+ public static final int TENANTID_FIELD_NUMBER = 1;
+ private com.google.protobuf.ByteString tenantId_;
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public boolean hasTenantId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTenantId() {
+ return tenantId_;
+ }
+
+ // required bytes schemaName = 2;
+ public static final int SCHEMANAME_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString schemaName_;
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public boolean hasSchemaName() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public com.google.protobuf.ByteString getSchemaName() {
+ return schemaName_;
+ }
+
+ // required bytes tableName = 3;
+ public static final int TABLENAME_FIELD_NUMBER = 3;
+ private com.google.protobuf.ByteString tableName_;
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public boolean hasTableName() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public com.google.protobuf.ByteString getTableName() {
+ return tableName_;
+ }
+
+ // required int64 tableTimestamp = 4;
+ public static final int TABLETIMESTAMP_FIELD_NUMBER = 4;
+ private long tableTimestamp_;
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public boolean hasTableTimestamp() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public long getTableTimestamp() {
+ return tableTimestamp_;
+ }
+
+ // required int64 clientTimestamp = 5;
+ public static final int CLIENTTIMESTAMP_FIELD_NUMBER = 5;
+ private long clientTimestamp_;
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public boolean hasClientTimestamp() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public long getClientTimestamp() {
+ return clientTimestamp_;
+ }
+
+ private void initFields() {
+ tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ schemaName_ = com.google.protobuf.ByteString.EMPTY;
+ tableName_ = com.google.protobuf.ByteString.EMPTY;
+ tableTimestamp_ = 0L;
+ clientTimestamp_ = 0L;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasTenantId()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasSchemaName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasTableName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasTableTimestamp()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasClientTimestamp()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, schemaName_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeBytes(3, tableName_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeInt64(4, tableTimestamp_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeInt64(5, clientTimestamp_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, tenantId_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, schemaName_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(3, tableName_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(4, tableTimestamp_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(5, clientTimestamp_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest other = (org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest) obj;
+
+ boolean result = true;
+ result = result && (hasTenantId() == other.hasTenantId());
+ if (hasTenantId()) {
+ result = result && getTenantId()
+ .equals(other.getTenantId());
+ }
+ result = result && (hasSchemaName() == other.hasSchemaName());
+ if (hasSchemaName()) {
+ result = result && getSchemaName()
+ .equals(other.getSchemaName());
+ }
+ result = result && (hasTableName() == other.hasTableName());
+ if (hasTableName()) {
+ result = result && getTableName()
+ .equals(other.getTableName());
+ }
+ result = result && (hasTableTimestamp() == other.hasTableTimestamp());
+ if (hasTableTimestamp()) {
+ result = result && (getTableTimestamp()
+ == other.getTableTimestamp());
+ }
+ result = result && (hasClientTimestamp() == other.hasClientTimestamp());
+ if (hasClientTimestamp()) {
+ result = result && (getClientTimestamp()
+ == other.getClientTimestamp());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasTenantId()) {
+ hash = (37 * hash) + TENANTID_FIELD_NUMBER;
+ hash = (53 * hash) + getTenantId().hashCode();
+ }
+ if (hasSchemaName()) {
+ hash = (37 * hash) + SCHEMANAME_FIELD_NUMBER;
+ hash = (53 * hash) + getSchemaName().hashCode();
+ }
+ if (hasTableName()) {
+ hash = (37 * hash) + TABLENAME_FIELD_NUMBER;
+ hash = (53 * hash) + getTableName().hashCode();
+ }
+ if (hasTableTimestamp()) {
+ hash = (37 * hash) + TABLETIMESTAMP_FIELD_NUMBER;
+ hash = (53 * hash) + hashLong(getTableTimestamp());
+ }
+ if (hasClientTimestamp()) {
+ hash = (37 * hash) + CLIENTTIMESTAMP_FIELD_NUMBER;
+ hash = (53 * hash) + hashLong(getClientTimestamp());
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code GetTableRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_GetTableRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_GetTableRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ schemaName_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ tableName_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ tableTimestamp_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ clientTimestamp_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_GetTableRequest_descriptor;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest getDefaultInstanceForType() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.getDefaultInstance();
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest build() {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest buildPartial() {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest result = new org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.tenantId_ = tenantId_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.schemaName_ = schemaName_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.tableName_ = tableName_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.tableTimestamp_ = tableTimestamp_;
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.clientTimestamp_ = clientTimestamp_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest) {
+ return mergeFrom((org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest other) {
+ if (other == org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest.getDefaultInstance()) return this;
+ if (other.hasTenantId()) {
+ setTenantId(other.getTenantId());
+ }
+ if (other.hasSchemaName()) {
+ setSchemaName(other.getSchemaName());
+ }
+ if (other.hasTableName()) {
+ setTableName(other.getTableName());
+ }
+ if (other.hasTableTimestamp()) {
+ setTableTimestamp(other.getTableTimestamp());
+ }
+ if (other.hasClientTimestamp()) {
+ setClientTimestamp(other.getClientTimestamp());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasTenantId()) {
+
+ return false;
+ }
+ if (!hasSchemaName()) {
+
+ return false;
+ }
+ if (!hasTableName()) {
+
+ return false;
+ }
+ if (!hasTableTimestamp()) {
+
+ return false;
+ }
+ if (!hasClientTimestamp()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required bytes tenantId = 1;
+ private com.google.protobuf.ByteString tenantId_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public boolean hasTenantId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTenantId() {
+ return tenantId_;
+ }
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public Builder setTenantId(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ tenantId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes tenantId = 1;</code>
+ */
+ public Builder clearTenantId() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ tenantId_ = getDefaultInstance().getTenantId();
+ onChanged();
+ return this;
+ }
+
+ // required bytes schemaName = 2;
+ private com.google.protobuf.ByteString schemaName_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public boolean hasSchemaName() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public com.google.protobuf.ByteString getSchemaName() {
+ return schemaName_;
+ }
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public Builder setSchemaName(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ schemaName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes schemaName = 2;</code>
+ */
+ public Builder clearSchemaName() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ schemaName_ = getDefaultInstance().getSchemaName();
+ onChanged();
+ return this;
+ }
+
+ // required bytes tableName = 3;
+ private com.google.protobuf.ByteString tableName_ = com.google.protobuf.ByteString.EMPTY;
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public boolean hasTableName() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public com.google.protobuf.ByteString getTableName() {
+ return tableName_;
+ }
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public Builder setTableName(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ tableName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bytes tableName = 3;</code>
+ */
+ public Builder clearTableName() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ tableName_ = getDefaultInstance().getTableName();
+ onChanged();
+ return this;
+ }
+
+ // required int64 tableTimestamp = 4;
+ private long tableTimestamp_ ;
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public boolean hasTableTimestamp() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public long getTableTimestamp() {
+ return tableTimestamp_;
+ }
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public Builder setTableTimestamp(long value) {
+ bitField0_ |= 0x00000008;
+ tableTimestamp_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int64 tableTimestamp = 4;</code>
+ */
+ public Builder clearTableTimestamp() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ tableTimestamp_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // required int64 clientTimestamp = 5;
+ private long clientTimestamp_ ;
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public boolean hasClientTimestamp() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public long getClientTimestamp() {
+ return clientTimestamp_;
+ }
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public Builder setClientTimestamp(long value) {
+ bitField0_ |= 0x00000010;
+ clientTimestamp_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int64 clientTimestamp = 5;</code>
+ */
+ public Builder clearClientTimestamp() {
+ bitField0_ = (bitField0_ & ~0x00000010);
+ clientTimestamp_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:GetTableRequest)
+ }
+
+ static {
+ defaultInstance = new GetTableRequest(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:GetTableRequest)
+ }
+
+ public interface CreateTableRequestOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // repeated bytes tableMetadataMutations = 1;
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ java.util.List<com.google.protobuf.ByteString> getTableMetadataMutationsList();
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ int getTableMetadataMutationsCount();
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ com.google.protobuf.ByteString getTableMetadataMutations(int index);
+ }
+ /**
+ * Protobuf type {@code CreateTableRequest}
+ *
+ * <pre>
+ * each byte array represents a MutationProto instance
+ * </pre>
+ */
+ public static final class CreateTableRequest extends
+ com.google.protobuf.GeneratedMessage
+ implements CreateTableRequestOrBuilder {
+ // Use CreateTableRequest.newBuilder() to construct.
+ private CreateTableRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CreateTableRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CreateTableRequest defaultInstance;
+ public static CreateTableRequest getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CreateTableRequest getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CreateTableRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ tableMetadataMutations_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ tableMetadataMutations_.add(input.readBytes());
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ tableMetadataMutations_ = java.util.Collections.unmodifiableList(tableMetadataMutations_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_CreateTableRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_CreateTableRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CreateTableRequest> PARSER =
+ new com.google.protobuf.AbstractParser<CreateTableRequest>() {
+ public CreateTableRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CreateTableRequest(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CreateTableRequest> getParserForType() {
+ return PARSER;
+ }
+
+ // repeated bytes tableMetadataMutations = 1;
+ public static final int TABLEMETADATAMUTATIONS_FIELD_NUMBER = 1;
+ private java.util.List<com.google.protobuf.ByteString> tableMetadataMutations_;
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ public java.util.List<com.google.protobuf.ByteString>
+ getTableMetadataMutationsList() {
+ return tableMetadataMutations_;
+ }
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ public int getTableMetadataMutationsCount() {
+ return tableMetadataMutations_.size();
+ }
+ /**
+ * <code>repeated bytes tableMetadataMutations = 1;</code>
+ */
+ public com.google.protobuf.ByteString getTableMetadataMutations(int index) {
+ return tableMetadataMutations_.get(index);
+ }
+
+ private void initFields() {
+ tableMetadataMutations_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < tableMetadataMutations_.size(); i++) {
+ output.writeBytes(1, tableMetadataMutations_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ {
+ int dataSize = 0;
+ for (int i = 0; i < tableMetadataMutations_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(tableMetadataMutations_.get(i));
+ }
+ size += dataSize;
+ size += 1 * getTableMetadataMutationsList().size();
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest other = (org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest) obj;
+
+ boolean result = true;
+ result = result && getTableMetadataMutationsList()
+ .equals(other.getTableMetadataMutationsList());
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ private int memoizedHashCode = 0;
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (getTableMetadataMutationsCount() > 0) {
+ hash = (37 * hash) + TABLEMETADATAMUTATIONS_FIELD_NUMBER;
+ hash = (53 * hash) + getTableMetadataMutationsList().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code CreateTableRequest}
+ *
+ * <pre>
+ * each byte array represents a MutationProto instance
+ * </pre>
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_CreateTableRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.phoenix.coprocessor.generated.MetaDataProtos.internal_static_CreateTableRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest.class, org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest.Builder.class);
+ }
+
+ // Construct using org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest.newBuilder()
+ private Builder()
<TRUNCATED>
[11/11] git commit: Port Phoenix to Hbase0.98
Posted by je...@apache.org.
Port Phoenix to Hbase0.98
Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/53f7d3ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/53f7d3ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/53f7d3ce
Branch: refs/heads/4.0.0
Commit: 53f7d3ce880f79b18a5a728be13f965e84c52e56
Parents: 214ad9e
Author: Jeffrey Zhong <jz...@JZhongs-MacBook-Pro.local>
Authored: Fri Feb 7 23:41:57 2014 -0800
Committer: Jeffrey Zhong <jz...@JZhongs-MacBook-Pro.local>
Committed: Fri Feb 7 23:43:34 2014 -0800
----------------------------------------------------------------------
phoenix-core/pom.xml | 121 +-
.../hbase/index/IndexLogRollSynchronizer.java | 14 +-
.../org/apache/hadoop/hbase/index/Indexer.java | 95 +-
.../hbase/index/builder/BaseIndexBuilder.java | 4 +-
.../hbase/index/builder/IndexBuildManager.java | 6 +-
.../hbase/index/builder/IndexBuilder.java | 4 +-
.../covered/CoveredColumnsIndexBuilder.java | 21 +-
.../hbase/index/covered/LocalTableState.java | 15 +-
.../hbase/index/covered/data/IndexMemStore.java | 18 +-
.../hbase/index/covered/data/LocalTable.java | 5 +-
.../example/CoveredColumnIndexCodec.java | 1 -
.../covered/example/CoveredColumnIndexer.java | 11 +-
.../filter/ApplyAndFilterDeletesFilter.java | 36 +-
...olumnTrackingNextLargestTimestampFilter.java | 16 +-
.../index/covered/filter/FamilyOnlyFilter.java | 8 +-
.../covered/filter/MaxTimestampFilter.java | 22 +-
.../covered/filter/NewerTimestampFilter.java | 12 +-
.../covered/update/IndexUpdateManager.java | 11 +-
.../hbase/index/parallel/ThreadPoolManager.java | 1 -
.../index/scanner/FilteredKeyValueScanner.java | 2 -
.../index/table/CoprocessorHTableFactory.java | 3 +-
.../hbase/index/util/IndexManagementUtil.java | 7 +-
.../hadoop/hbase/index/wal/IndexedKeyValue.java | 73 +-
.../hadoop/hbase/index/wal/KeyValueCodec.java | 11 +-
.../regionserver/wal/IndexedHLogReader.java | 119 +-
.../hbase/regionserver/wal/IndexedWALEdit.java | 91 -
.../regionserver/wal/IndexedWALEditCodec.java | 40 +-
.../apache/phoenix/cache/ServerCacheClient.java | 73 +-
.../cache/aggcache/SpillableGroupByCache.java | 8 +-
.../apache/phoenix/client/ClientKeyValue.java | 133 +-
.../apache/phoenix/compile/DeleteCompiler.java | 5 +-
.../apache/phoenix/compile/UpsertCompiler.java | 5 +-
.../phoenix/coprocessor/BaseRegionScanner.java | 17 +-
.../GroupedAggregateRegionObserver.java | 26 +-
.../coprocessor/HashJoinRegionScanner.java | 47 +-
.../coprocessor/MetaDataEndpointImpl.java | 1352 ++--
.../phoenix/coprocessor/MetaDataProtocol.java | 167 +-
.../phoenix/coprocessor/ScanRegionObserver.java | 47 +-
.../coprocessor/SequenceRegionObserver.java | 86 +-
.../coprocessor/ServerCachingEndpointImpl.java | 98 +-
.../coprocessor/ServerCachingProtocol.java | 3 +-
.../UngroupedAggregateRegionObserver.java | 95 +-
.../coprocessor/generated/MetaDataProtos.java | 7135 ++++++++++++++++++
.../coprocessor/generated/PTableProtos.java | 5315 +++++++++++++
.../generated/ServerCacheFactoryProtos.java | 568 ++
.../generated/ServerCachingProtos.java | 3447 +++++++++
.../apache/phoenix/execute/MutationState.java | 10 +-
.../expression/KeyValueColumnExpression.java | 1 -
.../DistinctValueWithCountServerAggregator.java | 4 +-
.../phoenix/filter/BooleanExpressionFilter.java | 11 +-
.../MultiCFCQKeyValueComparisonFilter.java | 11 +
.../filter/MultiCQKeyValueComparisonFilter.java | 12 +
.../filter/MultiKeyValueComparisonFilter.java | 8 +-
.../phoenix/filter/RowKeyComparisonFilter.java | 15 +-
.../SingleCFCQKeyValueComparisonFilter.java | 13 +-
.../SingleCQKeyValueComparisonFilter.java | 11 +
.../filter/SingleKeyValueComparisonFilter.java | 11 +-
.../apache/phoenix/filter/SkipScanFilter.java | 25 +-
.../apache/phoenix/index/IndexMaintainer.java | 41 +-
.../phoenix/index/PhoenixIndexBuilder.java | 10 +-
.../index/PhoenixIndexFailurePolicy.java | 44 +-
.../iterate/MappedByteBufferSortedQueue.java | 5 +-
.../iterate/RegionScannerResultIterator.java | 6 +-
.../phoenix/iterate/SpoolingResultIterator.java | 4 +-
.../java/org/apache/phoenix/job/JobManager.java | 10 +-
.../apache/phoenix/join/HashCacheFactory.java | 2 +-
.../org/apache/phoenix/join/ScanProjector.java | 5 +-
.../phoenix/map/reduce/CSVBulkLoader.java | 3 -
.../apache/phoenix/optimize/QueryOptimizer.java | 2 +-
.../apache/phoenix/protobuf/ProtobufUtil.java | 133 +
.../query/ConnectionQueryServicesImpl.java | 260 +-
.../query/ConnectionlessQueryServicesImpl.java | 12 +-
.../phoenix/query/HConnectionFactory.java | 7 +-
.../phoenix/query/QueryServicesOptions.java | 4 +-
.../apache/phoenix/schema/DelegateColumn.java | 10 -
.../apache/phoenix/schema/MetaDataClient.java | 4 +-
.../java/org/apache/phoenix/schema/PColumn.java | 4 +-
.../org/apache/phoenix/schema/PColumnImpl.java | 98 +-
.../java/org/apache/phoenix/schema/PTable.java | 2 +-
.../org/apache/phoenix/schema/PTableImpl.java | 286 +-
.../org/apache/phoenix/schema/Sequence.java | 73 +-
.../apache/phoenix/schema/stat/PTableStats.java | 3 +-
.../phoenix/schema/stat/PTableStatsImpl.java | 20 +-
.../schema/tuple/MultiKeyValueTuple.java | 19 +-
.../org/apache/phoenix/schema/tuple/Tuple.java | 6 +-
.../java/org/apache/phoenix/util/CSVLoader.java | 1 -
.../java/org/apache/phoenix/util/IndexUtil.java | 22 +-
.../org/apache/phoenix/util/KeyValueUtil.java | 39 +-
.../org/apache/phoenix/util/MetaDataUtil.java | 23 +-
.../org/apache/phoenix/util/PhoenixRuntime.java | 7 +-
.../org/apache/phoenix/util/ResultUtil.java | 29 +-
.../org/apache/phoenix/util/SchemaUtil.java | 2 -
.../org/apache/phoenix/util/ServerUtil.java | 16 +-
.../java/org/apache/phoenix/util/TupleUtil.java | 13 +-
.../hadoop/hbase/index/IndexTestingUtils.java | 4 +-
.../TestFailForUnsupportedHBaseVersions.java | 2 +
.../TestEndToEndCoveredColumnsIndexBuilder.java | 26 +-
.../index/covered/TestLocalTableState.java | 13 +-
.../index/covered/data/TestIndexMemStore.java | 4 +-
.../example/TestCoveredColumnIndexCodec.java | 16 +-
.../example/TestEndToEndCoveredIndexing.java | 2 +
.../TestEndtoEndIndexingWithCompression.java | 7 +-
.../covered/example/TestFailWithoutRetries.java | 2 +
.../filter/TestApplyAndFilterDeletesFilter.java | 8 +-
.../index/util/TestIndexManagementUtil.java | 6 +-
.../index/write/TestWALRecoveryCaching.java | 7 +-
.../recovery/TestPerRegionIndexWriteCache.java | 87 +-
.../wal/TestReadWriteKeyValuesWithCodec.java | 48 +-
...ALReplayWithIndexWritesAndCompressedWAL.java | 28 +-
...exWritesAndUncompressedWALInHBase_094_9.java | 2 +
.../phoenix/client/TestClientKeyValueLocal.java | 5 +-
.../apache/phoenix/end2end/AlterTableTest.java | 4 -
.../phoenix/end2end/NativeHBaseTypesTest.java | 2 +-
.../phoenix/end2end/index/IndexTestUtil.java | 14 +-
.../phoenix/filter/SkipScanFilterTest.java | 11 +-
.../iterate/AggregateResultScannerTest.java | 7 -
.../java/org/apache/phoenix/query/BaseTest.java | 2 +
.../java/org/apache/phoenix/util/TestUtil.java | 36 +-
phoenix-flume/pom.xml | 47 +-
phoenix-protocol/README.txt | 10 +
phoenix-protocol/src/main/MetaDataService.proto | 118 +
phoenix-protocol/src/main/PTable.proto | 72 +
.../src/main/ServerCacheFactory.proto | 29 +
.../src/main/ServerCachingService.proto | 61 +
phoenix-protocol/src/main/build-proto.sh | 37 +
pom.xml | 111 +-
126 files changed, 19574 insertions(+), 2005 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 0e2b8e5..5cc7804 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -213,23 +213,11 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- </dependency>
<!-- Findbugs Annotation -->
<dependency>
<groupId>net.sourceforge.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- <type>test-jar</type>
- </dependency>
- <!-- Needed by HBase to run the minicluster -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
@@ -249,12 +237,37 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf-java.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>${jruby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
</dependencies>
<profiles>
@@ -268,14 +281,60 @@
</property>
</activation>
<dependencies>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-test</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-core</artifactId>
+ <version>${hadoop-one.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.sf.kosmosfs</groupId>
+ <artifactId>kfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-test</artifactId>
+ <version>${hadoop-one.version}</version>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</profile>
@@ -290,6 +349,26 @@
</activation>
<dependencies>
<dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-protocol</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/IndexLogRollSynchronizer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/IndexLogRollSynchronizer.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/IndexLogRollSynchronizer.java
index ca61221..904612f 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/IndexLogRollSynchronizer.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/IndexLogRollSynchronizer.java
@@ -71,6 +71,7 @@ public class IndexLogRollSynchronizer implements WALActionsListener {
private static final Log LOG = LogFactory.getLog(IndexLogRollSynchronizer.class);
private WriteLock logArchiveLock;
+ private boolean lockAcquired = false;
public IndexLogRollSynchronizer(WriteLock logWriteLock){
this.logArchiveLock = logWriteLock;
@@ -81,12 +82,21 @@ public class IndexLogRollSynchronizer implements WALActionsListener {
public void preLogArchive(Path oldPath, Path newPath) throws IOException {
//take a write lock on the index - any pending index updates will complete before we finish
LOG.debug("Taking INDEX_UPDATE writelock");
- logArchiveLock.lock();
- LOG.debug("Got the INDEX_UPDATE writelock");
+ try {
+ logArchiveLock.lockInterruptibly();
+ lockAcquired = true;
+ } catch (InterruptedException e) {
+ LOG.info("Acquiring lock got interrupted!");
+ Thread.currentThread().interrupt();
+ }
+ if (lockAcquired) {
+ LOG.debug("Got the INDEX_UPDATE writelock");
+ }
}
@Override
public void postLogArchive(Path oldPath, Path newPath) throws IOException {
+ if (!lockAcquired) return;
// done archiving the logs, any WAL updates will be replayed on failure
LOG.debug("Releasing INDEX_UPDATE writelock");
logArchiveLock.unlock();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/Indexer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/Indexer.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/Indexer.java
index fe2852b..aa9df58 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/Indexer.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/Indexer.java
@@ -36,6 +36,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HConstants;
@@ -167,7 +168,7 @@ public class Indexer extends BaseRegionObserver {
this.builder = new IndexBuildManager(env);
// get a reference to the WAL
- log = env.getRegionServerServices().getWAL();
+ log = env.getRegionServerServices().getWAL(null);
// add a synchronizer so we don't archive a WAL that we need
log.registerWALActionsListener(new IndexLogRollSynchronizer(INDEX_READ_WRITE_LOCK.writeLock()));
@@ -218,9 +219,9 @@ public class Indexer extends BaseRegionObserver {
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> c, final Put put,
- final WALEdit edit, final boolean writeToWAL) throws IOException {
+ final WALEdit edit, final Durability durability) throws IOException {
if (this.disabled) {
- super.prePut(c, put, edit, writeToWAL);
+ super.prePut(c, put, edit, durability);
return;
}
// just have to add a batch marker to the WALEdit so we get the edit again in the batch
@@ -230,13 +231,13 @@ public class Indexer extends BaseRegionObserver {
@Override
public void preDelete(ObserverContext<RegionCoprocessorEnvironment> e, Delete delete,
- WALEdit edit, boolean writeToWAL) throws IOException {
+ WALEdit edit, final Durability durability) throws IOException {
if (this.disabled) {
- super.preDelete(e, delete, edit, writeToWAL);
+ super.preDelete(e, delete, edit, durability);
return;
}
try {
- preDeleteWithExceptions(e, delete, edit, writeToWAL);
+ preDeleteWithExceptions(e, delete, edit, durability);
return;
} catch (Throwable t) {
rethrowIndexingException(t);
@@ -246,7 +247,7 @@ public class Indexer extends BaseRegionObserver {
}
public void preDeleteWithExceptions(ObserverContext<RegionCoprocessorEnvironment> e,
- Delete delete, WALEdit edit, boolean writeToWAL) throws Exception {
+ Delete delete, WALEdit edit, final Durability durability) throws Exception {
// if we are making the update as part of a batch, we need to add in a batch marker so the WAL
// is retained
if (this.builder.getBatchId(delete) != null) {
@@ -257,14 +258,14 @@ public class Indexer extends BaseRegionObserver {
// get the mapping for index column -> target index table
Collection<Pair<Mutation, byte[]>> indexUpdates = this.builder.getIndexUpdate(delete);
- if (doPre(indexUpdates, edit, writeToWAL)) {
+ if (doPre(indexUpdates, edit, durability)) {
takeUpdateLock("delete");
}
}
@Override
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
- MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
+ MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
if (this.disabled) {
super.preBatchMutate(c, miniBatchOp);
return;
@@ -281,12 +282,13 @@ public class Indexer extends BaseRegionObserver {
@SuppressWarnings("deprecation")
public void preBatchMutateWithExceptions(ObserverContext<RegionCoprocessorEnvironment> c,
- MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws Throwable {
+ MiniBatchOperationInProgress<Mutation> miniBatchOp) throws Throwable {
// first group all the updates for a single row into a single update to be processed
Map<ImmutableBytesPtr, MultiMutation> mutations =
new HashMap<ImmutableBytesPtr, MultiMutation>();
- boolean durable = false;
+
+ Durability durability = Durability.SKIP_WAL;
for (int i = 0; i < miniBatchOp.size(); i++) {
// remove the batch keyvalue marker - its added for all puts
WALEdit edit = miniBatchOp.getWalEdit(i);
@@ -294,11 +296,13 @@ public class Indexer extends BaseRegionObserver {
// we could check is indexing is enable for the mutation in prePut and then just skip this
// after checking here, but this saves us the checking again.
if (edit != null) {
- KeyValue kv = edit.getKeyValues().remove(0);
- assert kv == BATCH_MARKER : "Expected batch marker from the WALEdit, but got: " + kv;
+ KeyValue kv = edit.getKeyValues().get(0);
+ if (kv == BATCH_MARKER) {
+ // remove batch marker from the WALEdit
+ edit.getKeyValues().remove(0);
+ }
}
- Pair<Mutation, Integer> op = miniBatchOp.getOperation(i);
- Mutation m = op.getFirst();
+ Mutation m = miniBatchOp.getOperation(i);
// skip this mutation if we aren't enabling indexing
// unfortunately, we really should ask if the raw mutation (rather than the combined mutation)
// should be indexed, which means we need to expose another method on the builder. Such is the
@@ -308,8 +312,8 @@ public class Indexer extends BaseRegionObserver {
}
// figure out if this is batch is durable or not
- if(!durable){
- durable = m.getDurability() != Durability.SKIP_WAL;
+ if (m.getDurability().ordinal() > durability.ordinal()) {
+ durability = m.getDurability();
}
// add the mutation to the batch set
@@ -317,7 +321,7 @@ public class Indexer extends BaseRegionObserver {
MultiMutation stored = mutations.get(row);
// we haven't seen this row before, so add it
if (stored == null) {
- stored = new MultiMutation(row, m.getWriteToWAL());
+ stored = new MultiMutation(row);
mutations.put(row, stored);
}
stored.addAll(m);
@@ -336,7 +340,7 @@ public class Indexer extends BaseRegionObserver {
Collection<Pair<Mutation, byte[]>> indexUpdates =
this.builder.getIndexUpdate(miniBatchOp, mutations.values());
// write them
- if (doPre(indexUpdates, edit, durable)) {
+ if (doPre(indexUpdates, edit, durability)) {
takeUpdateLock("batch mutation");
}
}
@@ -372,9 +376,8 @@ public class Indexer extends BaseRegionObserver {
private ImmutableBytesPtr rowKey;
- public MultiMutation(ImmutableBytesPtr rowkey, boolean writeToWal) {
+ public MultiMutation(ImmutableBytesPtr rowkey) {
this.rowKey = rowkey;
- this.writeToWAL = writeToWal;
}
/**
@@ -383,9 +386,9 @@ public class Indexer extends BaseRegionObserver {
@SuppressWarnings("deprecation")
public void addAll(Mutation stored) {
// add all the kvs
- for (Entry<byte[], List<KeyValue>> kvs : stored.getFamilyMap().entrySet()) {
+ for (Entry<byte[], List<Cell>> kvs : stored.getFamilyCellMap().entrySet()) {
byte[] family = kvs.getKey();
- List<KeyValue> list = getKeyValueList(family, kvs.getValue().size());
+ List<Cell> list = getKeyValueList(family, kvs.getValue().size());
list.addAll(kvs.getValue());
familyMap.put(family, list);
}
@@ -396,15 +399,12 @@ public class Indexer extends BaseRegionObserver {
this.setAttribute(attrib.getKey(), attrib.getValue());
}
}
- if (stored.getWriteToWAL()) {
- this.writeToWAL = true;
- }
}
- private List<KeyValue> getKeyValueList(byte[] family, int hint) {
- List<KeyValue> list = familyMap.get(family);
+ private List<Cell> getKeyValueList(byte[] family, int hint) {
+ List<Cell> list = familyMap.get(family);
if (list == null) {
- list = new ArrayList<KeyValue>(hint);
+ list = new ArrayList<Cell>(hint);
}
return list;
}
@@ -423,16 +423,6 @@ public class Indexer extends BaseRegionObserver {
public boolean equals(Object o) {
return o == null ? false : o.hashCode() == this.hashCode();
}
-
- @Override
- public void readFields(DataInput arg0) throws IOException {
- throw new UnsupportedOperationException("MultiMutations cannot be read/written");
- }
-
- @Override
- public void write(DataOutput arg0) throws IOException {
- throw new UnsupportedOperationException("MultiMutations cannot be read/written");
- }
}
/**
@@ -441,7 +431,7 @@ public class Indexer extends BaseRegionObserver {
* @throws IOException
*/
private boolean doPre(Collection<Pair<Mutation, byte[]>> indexUpdates, final WALEdit edit,
- final boolean writeToWAL) throws IOException {
+ final Durability durability) throws IOException {
// no index updates, so we are done
if (indexUpdates == null || indexUpdates.size() == 0) {
return false;
@@ -449,7 +439,7 @@ public class Indexer extends BaseRegionObserver {
// if writing to wal is disabled, we never see the WALEdit updates down the way, so do the index
// update right away
- if (!writeToWAL) {
+ if (durability == Durability.SKIP_WAL) {
try {
this.writer.write(indexUpdates);
return false;
@@ -469,27 +459,27 @@ public class Indexer extends BaseRegionObserver {
@Override
public void postPut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit,
- boolean writeToWAL) throws IOException {
+ final Durability durability) throws IOException {
if (this.disabled) {
- super.postPut(e, put, edit, writeToWAL);
+ super.postPut(e, put, edit, durability);
return;
}
- doPost(edit, put, writeToWAL);
+ doPost(edit, put, durability);
}
@Override
public void postDelete(ObserverContext<RegionCoprocessorEnvironment> e, Delete delete,
- WALEdit edit, boolean writeToWAL) throws IOException {
+ WALEdit edit, final Durability durability) throws IOException {
if (this.disabled) {
- super.postDelete(e, delete, edit, writeToWAL);
+ super.postDelete(e, delete, edit, durability);
return;
}
- doPost(edit,delete, writeToWAL);
+ doPost(edit, delete, durability);
}
@Override
public void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
- MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
+ MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
if (this.disabled) {
super.postBatchMutate(c, miniBatchOp);
return;
@@ -498,9 +488,9 @@ public class Indexer extends BaseRegionObserver {
// noop for the rest of the indexer - its handled by the first call to put/delete
}
- private void doPost(WALEdit edit, Mutation m, boolean writeToWAL) throws IOException {
+ private void doPost(WALEdit edit, Mutation m, final Durability durability) throws IOException {
try {
- doPostWithExceptions(edit, m, writeToWAL);
+ doPostWithExceptions(edit, m, durability);
return;
} catch (Throwable e) {
rethrowIndexingException(e);
@@ -509,9 +499,10 @@ public class Indexer extends BaseRegionObserver {
"Somehow didn't complete the index update, but didn't return succesfully either!");
}
- private void doPostWithExceptions(WALEdit edit, Mutation m, boolean writeToWAL) throws Exception {
+ private void doPostWithExceptions(WALEdit edit, Mutation m, final Durability durability)
+ throws Exception {
//short circuit, if we don't need to do any work
- if (!writeToWAL || !this.builder.isEnabled(m)) {
+ if (durability == Durability.SKIP_WAL || !this.builder.isEnabled(m)) {
// already did the index update in prePut, so we are done
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/BaseIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/BaseIndexBuilder.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/BaseIndexBuilder.java
index bbeae31..8c9a777 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/BaseIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/BaseIndexBuilder.java
@@ -54,12 +54,12 @@ public abstract class BaseIndexBuilder implements IndexBuilder {
}
@Override
- public void batchStarted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
+ public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
// noop
}
@Override
- public void batchCompleted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) {
+ public void batchCompleted(MiniBatchOperationInProgress<Mutation> miniBatchOp) {
// noop
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuildManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuildManager.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuildManager.java
index 833f142..61fc90d 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuildManager.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuildManager.java
@@ -116,7 +116,7 @@ public class IndexBuildManager implements Stoppable {
public Collection<Pair<Mutation, byte[]>> getIndexUpdate(
- MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp,
+ MiniBatchOperationInProgress<Mutation> miniBatchOp,
Collection<? extends Mutation> mutations) throws Throwable {
// notify the delegate that we have started processing a batch
this.delegate.batchStarted(miniBatchOp);
@@ -178,11 +178,11 @@ public class IndexBuildManager implements Stoppable {
return delegate.getIndexUpdateForFilteredRows(filtered);
}
- public void batchCompleted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) {
+ public void batchCompleted(MiniBatchOperationInProgress<Mutation> miniBatchOp) {
delegate.batchCompleted(miniBatchOp);
}
- public void batchStarted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp)
+ public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp)
throws IOException {
delegate.batchStarted(miniBatchOp);
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuilder.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuilder.java
index e23ea3f..e92edab 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/builder/IndexBuilder.java
@@ -107,7 +107,7 @@ public interface IndexBuilder extends Stoppable {
* Notification that a batch of updates has successfully been written.
* @param miniBatchOp the full batch operation that was written
*/
- public void batchCompleted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp);
+ public void batchCompleted(MiniBatchOperationInProgress<Mutation> miniBatchOp);
/**
* Notification that a batch has been started.
@@ -118,7 +118,7 @@ public interface IndexBuilder extends Stoppable {
* @param miniBatchOp the full batch operation to be written
* @throws IOException
*/
- public void batchStarted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException;
+ public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException;
/**
* This allows the codec to dynamically change whether or not indexing should take place for a
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/CoveredColumnsIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/CoveredColumnsIndexBuilder.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/CoveredColumnsIndexBuilder.java
index 422a9ec..ce5efc5 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/CoveredColumnsIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/CoveredColumnsIndexBuilder.java
@@ -33,23 +33,25 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.hadoop.hbase.util.Pair;
-
-import com.google.common.collect.Lists;
-import com.google.common.primitives.Longs;
import org.apache.hadoop.hbase.index.builder.BaseIndexBuilder;
import org.apache.hadoop.hbase.index.covered.data.LocalHBaseState;
import org.apache.hadoop.hbase.index.covered.data.LocalTable;
import org.apache.hadoop.hbase.index.covered.update.ColumnTracker;
import org.apache.hadoop.hbase.index.covered.update.IndexUpdateManager;
import org.apache.hadoop.hbase.index.covered.update.IndexedColumnGroup;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.Pair;
+
+import com.google.common.collect.Lists;
+import com.google.common.primitives.Longs;
/**
* Build covered indexes for phoenix updates.
@@ -148,8 +150,9 @@ public class CoveredColumnsIndexBuilder extends BaseIndexBuilder {
*/
protected Collection<Batch> createTimestampBatchesFromMutation(Mutation m) {
Map<Long, Batch> batches = new HashMap<Long, Batch>();
- for (List<KeyValue> family : m.getFamilyMap().values()) {
- createTimestampBatchesFromKeyValues(family, batches);
+ for (List<Cell> family : m.getFamilyCellMap().values()) {
+ List<KeyValue> familyKVs = KeyValueUtil.ensureKeyValues(family);
+ createTimestampBatchesFromKeyValues(familyKVs, batches);
}
// sort the batches
List<Batch> sorted = new ArrayList<Batch>(batches.values());
@@ -420,7 +423,7 @@ public class CoveredColumnsIndexBuilder extends BaseIndexBuilder {
// We have to figure out which kind of delete it is, since we need to do different things if its
// a general (row) delete, versus a delete of just a single column or family
- Map<byte[], List<KeyValue>> families = d.getFamilyMap();
+ Map<byte[], List<Cell>> families = d.getFamilyCellMap();
/*
* Option 1: its a row delete marker, so we just need to delete the most recent state for each
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/LocalTableState.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/LocalTableState.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/LocalTableState.java
index f6419f2..ce21135 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/LocalTableState.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/LocalTableState.java
@@ -28,13 +28,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
-import org.apache.hadoop.hbase.util.Pair;
-
import org.apache.hadoop.hbase.index.covered.data.IndexMemStore;
import org.apache.hadoop.hbase.index.covered.data.LocalHBaseState;
import org.apache.hadoop.hbase.index.covered.update.ColumnReference;
@@ -42,6 +41,8 @@ import org.apache.hadoop.hbase.index.covered.update.ColumnTracker;
import org.apache.hadoop.hbase.index.covered.update.IndexedColumnGroup;
import org.apache.hadoop.hbase.index.scanner.Scanner;
import org.apache.hadoop.hbase.index.scanner.ScannerBuilder;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.util.Pair;
/**
* Manage the state of the HRegion's view of the table, for the single row.
@@ -175,7 +176,7 @@ public class LocalTableState implements TableState {
public Result getCurrentRowState() {
KeyValueScanner scanner = this.memstore.getScanner();
- List<KeyValue> kvs = new ArrayList<KeyValue>();
+ List<Cell> kvs = new ArrayList<Cell>();
while (scanner.peek() != null) {
try {
kvs.add(scanner.next());
@@ -184,7 +185,7 @@ public class LocalTableState implements TableState {
throw new RuntimeException("Local MemStore threw IOException!");
}
}
- return new Result(kvs);
+ return Result.create(kvs);
}
/**
@@ -192,8 +193,8 @@ public class LocalTableState implements TableState {
* @param pendingUpdate update to apply
*/
public void addUpdateForTesting(Mutation pendingUpdate) {
- for (Map.Entry<byte[], List<KeyValue>> e : pendingUpdate.getFamilyMap().entrySet()) {
- List<KeyValue> edits = e.getValue();
+ for (Map.Entry<byte[], List<Cell>> e : pendingUpdate.getFamilyCellMap().entrySet()) {
+ List<KeyValue> edits = KeyValueUtil.ensureKeyValues(e.getValue());
addUpdate(edits);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/IndexMemStore.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/IndexMemStore.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/IndexMemStore.java
index e2cac10..5cee11a 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/IndexMemStore.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/IndexMemStore.java
@@ -19,6 +19,7 @@
*/
package org.apache.hadoop.hbase.index.covered.data;
+import java.io.IOException;
import java.util.Comparator;
import java.util.Iterator;
import java.util.SortedSet;
@@ -26,7 +27,7 @@ import java.util.SortedSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValue.KeyComparator;
+import org.apache.hadoop.hbase.KeyValue.KVComparator;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.regionserver.IndexKeyValueSkipListSet;
import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
@@ -87,12 +88,12 @@ public class IndexMemStore implements KeyValueStore {
*/
public static final Comparator<KeyValue> COMPARATOR = new Comparator<KeyValue>() {
- private final KeyComparator rawcomparator = new KeyComparator();
+ private final KVComparator rawcomparator = new KVComparator();
@Override
public int compare(final KeyValue left, final KeyValue right) {
- return rawcomparator.compare(left.getBuffer(), left.getOffset() + KeyValue.ROW_OFFSET,
- left.getKeyLength(), right.getBuffer(), right.getOffset() + KeyValue.ROW_OFFSET,
+ return rawcomparator.compareFlatKey(left.getRowArray(), left.getOffset() + KeyValue.ROW_OFFSET,
+ left.getKeyLength(), right.getRowArray(), right.getOffset() + KeyValue.ROW_OFFSET,
right.getKeyLength());
}
};
@@ -140,7 +141,8 @@ public class IndexMemStore implements KeyValueStore {
}
private String toString(KeyValue kv) {
- return kv.toString() + "/value=" + Bytes.toString(kv.getValue());
+ return kv.toString() + "/value=" +
+ Bytes.toString(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength());
}
@Override
@@ -159,7 +161,7 @@ public class IndexMemStore implements KeyValueStore {
public KeyValueScanner getScanner() {
return new MemStoreScanner();
}
-
+
/*
* MemStoreScanner implements the KeyValueScanner. It lets the caller scan the contents of a
* memstore -- both current map and snapshot. This behaves as if it were a real scanner but does
@@ -306,14 +308,13 @@ public class IndexMemStore implements KeyValueStore {
public long getSequenceID() {
return Long.MAX_VALUE;
}
-
+
@Override
public boolean shouldUseScanner(Scan scan, SortedSet<byte[]> columns, long oldestUnexpiredTS) {
throw new UnsupportedOperationException(this.getClass().getName()
+ " doesn't support checking to see if it should use a scanner!");
}
- /*
@Override
public boolean backwardSeek(KeyValue arg0) throws IOException {
throw new UnsupportedOperationException();
@@ -328,6 +329,5 @@ public class IndexMemStore implements KeyValueStore {
public boolean seekToPreviousRow(KeyValue arg0) throws IOException {
throw new UnsupportedOperationException();
}
- */
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/LocalTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/LocalTable.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/LocalTable.java
index 52aa851..d2d99e6 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/LocalTable.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/data/LocalTable.java
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Result;
@@ -63,11 +64,11 @@ public class LocalTable implements LocalHBaseState {
s.setStopRow(row);
HRegion region = this.env.getRegion();
RegionScanner scanner = region.getScanner(s);
- List<KeyValue> kvs = new ArrayList<KeyValue>(1);
+ List<Cell> kvs = new ArrayList<Cell>(1);
boolean more = scanner.next(kvs);
assert !more : "Got more than one result when scanning" + " a single row in the primary table!";
- Result r = new Result(kvs);
+ Result r = Result.create(kvs);
scanner.close();
return r;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexCodec.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexCodec.java
index 8f0ee99..c588e95 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexCodec.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexCodec.java
@@ -244,7 +244,6 @@ public class CoveredColumnIndexCodec extends BaseIndexCodec {
* @param pk primary key of the original row
* @param length total number of bytes of all the values that should be added
* @param values to use when building the key
- * @return
*/
static byte[] composeRowKey(byte[] pk, int length, List<ColumnEntry> values) {
// now build up expected row key, each of the values, in order, followed by the PK and then some
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexer.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexer.java
index c7019c4..0ec3f96 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexer.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/example/CoveredColumnIndexer.java
@@ -14,13 +14,12 @@ import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Pair;
-
import org.apache.hadoop.hbase.index.covered.Batch;
import org.apache.hadoop.hbase.index.covered.CoveredColumnsIndexBuilder;
import org.apache.hadoop.hbase.index.covered.LocalTableState;
import org.apache.hadoop.hbase.index.covered.update.IndexUpdateManager;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Pair;
/**
* Index maintainer that maintains multiple indexes based on '{@link ColumnGroup}s'. Each group is a
@@ -108,10 +107,11 @@ public class CoveredColumnIndexer extends CoveredColumnsIndexBuilder {
Collection<Batch> batches = batchByRow(filtered);
for (Batch batch : batches) {
- Put p = new Put(batch.getKvs().iterator().next().getRow());
+ KeyValue curKV = batch.getKvs().iterator().next();
+ Put p = new Put(curKV.getRowArray(), curKV.getRowOffset(), curKV.getRowLength());
for (KeyValue kv : batch.getKvs()) {
// we only need to cleanup Put entries
- byte type = kv.getType();
+ byte type = kv.getTypeByte();
Type t = KeyValue.Type.codeToType(type);
if (!t.equals(Type.Put)) {
continue;
@@ -136,7 +136,6 @@ public class CoveredColumnIndexer extends CoveredColumnsIndexBuilder {
/**
* @param filtered
- * @return
*/
private Collection<Batch> batchByRow(Collection<KeyValue> filtered) {
Map<Long, Batch> batches = new HashMap<Long, Batch>();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
index ebd2abe..658e981 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java
@@ -27,9 +27,12 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.filter.FilterBase;
@@ -105,13 +108,14 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
}
@Override
- public ReturnCode filterKeyValue(KeyValue next) {
+ public ReturnCode filterKeyValue(Cell next) {
// we marked ourselves done, but the END_ROW_KEY didn't manage to seek to the very last key
if (this.done) {
return ReturnCode.SKIP;
}
- switch (KeyValue.Type.codeToType(next.getType())) {
+ KeyValue nextKV = KeyValueUtil.ensureKeyValue(next);
+ switch (KeyValue.Type.codeToType(next.getTypeByte())) {
/*
* DeleteFamily will always sort first because those KVs (we assume) don't have qualifiers (or
* rather are null). Therefore, we have to keep a hold of all the delete families until we get
@@ -123,20 +127,20 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
// one. In fact, it means that all the previous deletes can be ignored because the family must
// not match anymore.
this.coveringDelete.reset();
- this.coveringDelete.deleteFamily = next;
+ this.coveringDelete.deleteFamily = nextKV;
return ReturnCode.SKIP;
case DeleteColumn:
// similar to deleteFamily, all the newer deletes/puts would have been seen at this point, so
// we can safely replace the more recent delete column with the more recent one
this.coveringDelete.pointDelete = null;
- this.coveringDelete.deleteColumn = next;
+ this.coveringDelete.deleteColumn = nextKV;
return ReturnCode.SKIP;
case Delete:
// we are just deleting the single column value at this point.
// therefore we just skip this entry and go onto the next one. The only caveat is that
// we should still cover the next entry if this delete applies to the next entry, so we
// have to keep around a reference to the KV to compare against the next valid entry
- this.coveringDelete.pointDelete = next;
+ this.coveringDelete.pointDelete = nextKV;
return ReturnCode.SKIP;
default:
// no covering deletes
@@ -144,18 +148,18 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
return ReturnCode.INCLUDE;
}
- if (coveringDelete.matchesFamily(next)) {
+ if (coveringDelete.matchesFamily(nextKV)) {
this.currentHint = familyHint;
return ReturnCode.SEEK_NEXT_USING_HINT;
}
- if (coveringDelete.matchesColumn(next)) {
+ if (coveringDelete.matchesColumn(nextKV)) {
// hint to the next column
this.currentHint = columnHint;
return ReturnCode.SEEK_NEXT_USING_HINT;
}
- if (coveringDelete.matchesPoint(next)) {
+ if (coveringDelete.matchesPoint(nextKV)) {
return ReturnCode.SKIP;
}
@@ -165,16 +169,6 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
return ReturnCode.INCLUDE;
}
- @Override
- public void write(DataOutput out) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be serialized!");
- }
-
- @Override
- public void readFields(DataInput in) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be deserialized!");
- }
-
/**
* Get the next hint for a given peeked keyvalue
*/
@@ -247,7 +241,7 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
if (deleteFamily == null) {
return false;
}
- if (deleteFamily.matchingFamily(next)) {
+ if (CellUtil.matchingFamily(deleteFamily, next)) {
// falls within the timestamp range
if (deleteFamily.getTimestamp() >= next.getTimestamp()) {
return true;
@@ -269,7 +263,7 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
if (deleteColumn == null) {
return false;
}
- if (deleteColumn.matchingFamily(next) && deleteColumn.matchingQualifier(next)) {
+ if (CellUtil.matchingFamily(deleteColumn, next) && deleteColumn.matchingQualifier(next)) {
// falls within the timestamp range
if (deleteColumn.getTimestamp() >= next.getTimestamp()) {
return true;
@@ -289,7 +283,7 @@ public class ApplyAndFilterDeletesFilter extends FilterBase {
// that the timestamp matches exactly. Because we sort by timestamp first, either the next
// keyvalue has the exact timestamp or is an older (smaller) timestamp, and we can allow that
// one.
- if (pointDelete != null && pointDelete.matchingFamily(next)
+ if (pointDelete != null && CellUtil.matchingFamily(pointDelete, next)
&& pointDelete.matchingQualifier(next)) {
if (pointDelete.getTimestamp() == next.getTimestamp()) {
return true;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ColumnTrackingNextLargestTimestampFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ColumnTrackingNextLargestTimestampFilter.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ColumnTrackingNextLargestTimestampFilter.java
index 72a10e1..494bf66 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ColumnTrackingNextLargestTimestampFilter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/ColumnTrackingNextLargestTimestampFilter.java
@@ -19,10 +19,7 @@
*/
package org.apache.hadoop.hbase.index.covered.filter;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.filter.FilterBase;
@@ -53,7 +50,7 @@ public class ColumnTrackingNextLargestTimestampFilter extends FilterBase {
}
@Override
- public ReturnCode filterKeyValue(KeyValue v) {
+ public ReturnCode filterKeyValue(Cell v) {
long timestamp = v.getTimestamp();
if (timestamp > ts) {
this.column.setTs(timestamp);
@@ -62,13 +59,4 @@ public class ColumnTrackingNextLargestTimestampFilter extends FilterBase {
return ReturnCode.INCLUDE;
}
- @Override
- public void write(DataOutput out) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be serialized!");
- }
-
- @Override
- public void readFields(DataInput in) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be deserialized!");
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/FamilyOnlyFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/FamilyOnlyFilter.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/FamilyOnlyFilter.java
index 8591f88..7c35786 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/FamilyOnlyFilter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/FamilyOnlyFilter.java
@@ -17,10 +17,10 @@
*/
package org.apache.hadoop.hbase.index.covered.filter;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.filter.BinaryComparator;
+import org.apache.hadoop.hbase.filter.ByteArrayComparable;
import org.apache.hadoop.hbase.filter.FamilyFilter;
-import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
/**
* Similar to the {@link FamilyFilter} but stops when the end of the family is reached and only
@@ -39,7 +39,7 @@ public class FamilyOnlyFilter extends FamilyFilter {
this(new BinaryComparator(family));
}
- public FamilyOnlyFilter(final WritableByteArrayComparable familyComparator) {
+ public FamilyOnlyFilter(final ByteArrayComparable familyComparator) {
super(CompareOp.EQUAL, familyComparator);
}
@@ -56,7 +56,7 @@ public class FamilyOnlyFilter extends FamilyFilter {
}
@Override
- public ReturnCode filterKeyValue(KeyValue v) {
+ public ReturnCode filterKeyValue(Cell v) {
if (done) {
return ReturnCode.SKIP;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/MaxTimestampFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/MaxTimestampFilter.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/MaxTimestampFilter.java
index 846ec88..92e9daf 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/MaxTimestampFilter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/MaxTimestampFilter.java
@@ -23,6 +23,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.util.Bytes;
@@ -44,7 +45,13 @@ public class MaxTimestampFilter extends FilterBase {
public KeyValue getNextKeyHint(KeyValue currentKV) {
// this might be a little excessive right now - better safe than sorry though, so we don't mess
// with other filters too much.
- KeyValue kv = currentKV.deepCopy();
+ KeyValue kv = null;
+ try {
+ kv = currentKV.clone();
+ } catch (CloneNotSupportedException e) {
+ // the exception should not happen at all
+ throw new IllegalArgumentException(e);
+ }
int offset =kv.getTimestampOffset();
//set the timestamp in the buffer
byte[] buffer = kv.getBuffer();
@@ -55,22 +62,11 @@ public class MaxTimestampFilter extends FilterBase {
}
@Override
- public ReturnCode filterKeyValue(KeyValue v) {
+ public ReturnCode filterKeyValue(Cell v) {
long timestamp = v.getTimestamp();
if (timestamp > ts) {
return ReturnCode.SEEK_NEXT_USING_HINT;
}
return ReturnCode.INCLUDE;
}
-
- @Override
- public void write(DataOutput out) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be serialized!");
-
- }
-
- @Override
- public void readFields(DataInput in) throws IOException {
- throw new UnsupportedOperationException("Server-side only filter, cannot be deserialized!");
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/NewerTimestampFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/NewerTimestampFilter.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/NewerTimestampFilter.java
index 560cdd8..8e0f617 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/NewerTimestampFilter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/filter/NewerTimestampFilter.java
@@ -4,6 +4,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.filter.FilterBase;
@@ -11,7 +12,6 @@ import org.apache.hadoop.hbase.filter.FilterBase;
* Server-side only class used in the indexer to filter out keyvalues newer than a given timestamp
* (so allows anything <code><=</code> timestamp through).
* <p>
- * Note,<tt>this</tt> doesn't support {@link #write(DataOutput)} or {@link #readFields(DataInput)}.
*/
public class NewerTimestampFilter extends FilterBase {
@@ -22,16 +22,8 @@ public class NewerTimestampFilter extends FilterBase {
}
@Override
- public ReturnCode filterKeyValue(KeyValue ignored) {
+ public ReturnCode filterKeyValue(Cell ignored) {
return ignored.getTimestamp() > timestamp ? ReturnCode.SKIP : ReturnCode.INCLUDE;
}
- @Override
- public void write(DataOutput out) throws IOException {
- throw new UnsupportedOperationException("TimestampFilter is server-side only!");
- }
- @Override
- public void readFields(DataInput in) throws IOException {
- throw new UnsupportedOperationException("TimestampFilter is server-side only!");
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/update/IndexUpdateManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/update/IndexUpdateManager.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/update/IndexUpdateManager.java
index 7ace79d..77b6e85 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/update/IndexUpdateManager.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/covered/update/IndexUpdateManager.java
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
@@ -224,12 +224,13 @@ public class IndexUpdateManager {
+ ((m instanceof Put) ? m.getTimeStamp() + " " : ""));
sb.append(" row=" + Bytes.toString(m.getRow()));
sb.append("\n");
- if (m.getFamilyMap().isEmpty()) {
+ if (m.getFamilyCellMap().isEmpty()) {
sb.append("\t\t=== EMPTY ===\n");
}
- for (List<KeyValue> kvs : m.getFamilyMap().values()) {
- for (KeyValue kv : kvs) {
- sb.append("\t\t" + kv.toString() + "/value=" + Bytes.toStringBinary(kv.getValue()));
+ for (List<Cell> kvs : m.getFamilyCellMap().values()) {
+ for (Cell kv : kvs) {
+ sb.append("\t\t" + kv.toString() + "/value=" + Bytes.toStringBinary(kv.getValueArray(),
+ kv.getValueOffset(), kv.getValueLength()));
sb.append("\n");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/parallel/ThreadPoolManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/parallel/ThreadPoolManager.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/parallel/ThreadPoolManager.java
index c8afb04..2a343f0 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/parallel/ThreadPoolManager.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/parallel/ThreadPoolManager.java
@@ -74,7 +74,6 @@ public class ThreadPoolManager {
/**
* @param conf
- * @return
*/
private static ShutdownOnUnusedThreadPoolExecutor getDefaultExecutor(ThreadPoolBuilder builder) {
int maxThreads = builder.getMaxThreads();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/scanner/FilteredKeyValueScanner.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/scanner/FilteredKeyValueScanner.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/scanner/FilteredKeyValueScanner.java
index 0f7fed3..f3deb6a 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/scanner/FilteredKeyValueScanner.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/scanner/FilteredKeyValueScanner.java
@@ -125,7 +125,6 @@ public class FilteredKeyValueScanner implements KeyValueScanner {
this.delegate.close();
}
- /*
@Override
public boolean backwardSeek(KeyValue arg0) throws IOException {
return this.delegate.backwardSeek(arg0);
@@ -140,5 +139,4 @@ public class FilteredKeyValueScanner implements KeyValueScanner {
public boolean seekToPreviousRow(KeyValue arg0) throws IOException {
return this.delegate.seekToPreviousRow(arg0);
}
- */
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/table/CoprocessorHTableFactory.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/table/CoprocessorHTableFactory.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/table/CoprocessorHTableFactory.java
index 5ded879..2af2c7d 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/table/CoprocessorHTableFactory.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/table/CoprocessorHTableFactory.java
@@ -7,6 +7,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.util.Bytes;
@@ -40,7 +41,7 @@ public class CoprocessorHTableFactory implements HTableFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating new HTable: " + Bytes.toString(tablename.copyBytesIfNecessary()));
}
- return this.e.getTable(tablename.copyBytesIfNecessary());
+ return this.e.getTable(TableName.valueOf(tablename.copyBytesIfNecessary()));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/util/IndexManagementUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/util/IndexManagementUtil.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/util/IndexManagementUtil.java
index 9ee81a9..16b3584 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/util/IndexManagementUtil.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/util/IndexManagementUtil.java
@@ -30,6 +30,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import com.google.common.collect.Maps;
import org.apache.hadoop.hbase.index.ValueGetter;
@@ -65,7 +66,8 @@ public class IndexManagementUtil {
} catch (Throwable t) {
return false;
}
- if (INDEX_WAL_EDIT_CODEC_CLASS_NAME.equals(conf.get(WAL_EDIT_CODEC_CLASS_KEY, null))) {
+ if (INDEX_WAL_EDIT_CODEC_CLASS_NAME.equals(conf
+ .get(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, null))) {
// its installed, and it can handle compression and non-compression cases
return true;
}
@@ -91,7 +93,8 @@ public class IndexManagementUtil {
if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) {
if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException(
"WAL Compression is only supported with " + codecClass
- + ". You can install in hbase-site.xml, under " + WAL_EDIT_CODEC_CLASS_KEY); }
+ + ". You can install in hbase-site.xml, under " + WALCellCodec.WAL_CELL_CODEC_CLASS_KEY);
+ }
} else {
throw new IllegalStateException(codecClass + " is not installed, but "
+ indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/IndexedKeyValue.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/IndexedKeyValue.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/IndexedKeyValue.java
index a7f4e82..5b2c6b4 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/IndexedKeyValue.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/IndexedKeyValue.java
@@ -8,8 +8,13 @@ import java.io.IOException;
import java.util.Arrays;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType;
import org.apache.hadoop.hbase.regionserver.wal.HLog;
+import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
@@ -46,12 +51,20 @@ public class IndexedKeyValue extends KeyValue {
}
/**
- * This is a KeyValue that shouldn't actually be replayed, so we always mark it as an {@link HLog#METAFAMILY} so it
+ * This is a KeyValue that shouldn't actually be replayed, so we always mark it as an {@link WALEdit#METAFAMILY} so it
* isn't replayed via the normal replay mechanism
*/
@Override
public boolean matchingFamily(final byte[] family) {
- return Bytes.equals(family, HLog.METAFAMILY);
+ return Bytes.equals(family, WALEdit.METAFAMILY);
+ }
+
+ /**
+ * Not a real KeyValue
+ */
+ @Override
+ public boolean matchingRow(final byte [] row) {
+ return false;
}
@Override
@@ -77,22 +90,11 @@ public class IndexedKeyValue extends KeyValue {
}
private byte[] getMutationBytes() {
- ByteArrayOutputStream bos = null;
try {
- bos = new ByteArrayOutputStream();
- this.mutation.write(new DataOutputStream(bos));
- bos.flush();
- return bos.toByteArray();
+ MutationProto m = toMutationProto(this.mutation);
+ return m.toByteArray();
} catch (IOException e) {
throw new IllegalArgumentException("Failed to get bytes for mutation!", e);
- } finally {
- if (bos != null) {
- try {
- bos.close();
- } catch (IOException e) {
- throw new IllegalArgumentException("Failed to get bytes for mutation!", e);
- }
- }
}
}
@@ -101,11 +103,6 @@ public class IndexedKeyValue extends KeyValue {
return hashCode;
}
- @Override
- public void write(DataOutput out) throws IOException {
- KeyValueCodec.write(out, this);
- }
-
/**
* Internal write the underlying data for the entry - this does not do any special prefixing. Writing should be done
* via {@link KeyValueCodec#write(DataOutput, KeyValue)} to ensure consistent reading/writing of
@@ -118,8 +115,8 @@ public class IndexedKeyValue extends KeyValue {
*/
void writeData(DataOutput out) throws IOException {
Bytes.writeByteArray(out, this.indexTableName.get());
- out.writeUTF(this.mutation.getClass().getName());
- this.mutation.write(out);
+ MutationProto m = toMutationProto(this.mutation);
+ Bytes.writeByteArray(out, m.toByteArray());
}
/**
@@ -127,22 +124,12 @@ public class IndexedKeyValue extends KeyValue {
* complement to {@link #writeData(DataOutput)}.
*/
@SuppressWarnings("javadoc")
- @Override
public void readFields(DataInput in) throws IOException {
this.indexTableName = new ImmutableBytesPtr(Bytes.readByteArray(in));
- Class<? extends Mutation> clazz;
- try {
- clazz = Class.forName(in.readUTF()).asSubclass(Mutation.class);
- this.mutation = clazz.newInstance();
- this.mutation.readFields(in);
- this.hashCode = calcHashCode(indexTableName, mutation);
- } catch (ClassNotFoundException e) {
- throw new IOException(e);
- } catch (InstantiationException e) {
- throw new IOException(e);
- } catch (IllegalAccessException e) {
- throw new IOException(e);
- }
+ byte[] mutationData = Bytes.readByteArray(in);
+ MutationProto mProto = MutationProto.parseFrom(mutationData);
+ this.mutation = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(mProto);
+ this.hashCode = calcHashCode(indexTableName, mutation);
}
public boolean getBatchFinished() {
@@ -152,4 +139,18 @@ public class IndexedKeyValue extends KeyValue {
public void markBatchFinished() {
this.batchFinished = true;
}
+
+ protected MutationProto toMutationProto(Mutation mutation) throws IOException {
+ MutationProto m = null;
+ if(mutation instanceof Put){
+ m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.PUT,
+ mutation);
+ } else if(mutation instanceof Delete) {
+ m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.DELETE,
+ mutation);
+ } else {
+ throw new IOException("Put/Delete mutations only supported");
+ }
+ return m;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/KeyValueCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/KeyValueCodec.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/KeyValueCodec.java
index 0abdf8d..3340edc 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/KeyValueCodec.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/index/wal/KeyValueCodec.java
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
@@ -49,16 +50,14 @@ public class KeyValueCodec {
*/
public static KeyValue readKeyValue(DataInput in) throws IOException {
int length = in.readInt();
- KeyValue kv;
// its a special IndexedKeyValue
if (length == INDEX_TYPE_LENGTH_MARKER) {
- kv = new IndexedKeyValue();
+ IndexedKeyValue kv = new IndexedKeyValue();
kv.readFields(in);
+ return kv;
} else {
- kv = new KeyValue();
- kv.readFields(length, in);
+ return KeyValue.create(length, in);
}
- return kv;
}
/**
@@ -73,7 +72,7 @@ public class KeyValueCodec {
out.writeInt(INDEX_TYPE_LENGTH_MARKER);
((IndexedKeyValue) kv).writeData(out);
} else {
- kv.write(out);
+ KeyValue.write(kv, out);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedHLogReader.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedHLogReader.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedHLogReader.java
index bad82c4..dcef90a 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedHLogReader.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedHLogReader.java
@@ -8,6 +8,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.regionserver.wal.HLog.Entry;
import org.apache.hadoop.hbase.regionserver.wal.HLog.Reader;
import org.apache.hadoop.io.Writable;
@@ -31,122 +32,12 @@ import org.apache.hadoop.io.Writable;
* we need to track which of the regions were on the server when it crashed only only split those
* edits out into their respective regions.
*/
-public class IndexedHLogReader implements Reader {
+public class IndexedHLogReader extends ProtobufLogReader {
private static final Log LOG = LogFactory.getLog(IndexedHLogReader.class);
- private SequenceFileLogReader delegate;
-
-
- private static class IndexedWALReader extends SequenceFileLogReader.WALReader {
-
- /**
- * @param fs
- * @param p
- * @param c
- * @throws IOException
- */
- IndexedWALReader(FileSystem fs, Path p, Configuration c) throws IOException {
- super(fs, p, c);
- }
-
- /**
- * we basically have to reproduce what the SequenceFile.Reader is doing in next(), but without
- * the check on the value class, since we have a special value class that doesn't directly match
- * what was specified in the file header
- */
- @Override
- public synchronized boolean next(Writable key, Writable val) throws IOException {
- boolean more = next(key);
-
- if (more) {
- getCurrentValue(val);
- }
-
- return more;
- }
-
- }
-
- public IndexedHLogReader() {
- this.delegate = new SequenceFileLogReader();
- }
-
- @Override
- public void init(final FileSystem fs, final Path path, Configuration conf) throws IOException {
- this.delegate.init(fs, path, conf);
- // close the old reader and replace with our own, custom one
- this.delegate.reader.close();
- this.delegate.reader = new IndexedWALReader(fs, path, conf);
- Exception e = new Exception();
- LOG.info("Instantiated indexed log reader." + Arrays.toString(e.getStackTrace()));
- LOG.info("Got conf: " + conf);
- }
-
- @Override
- public void close() throws IOException {
- this.delegate.close();
- }
-
- @Override
- public Entry next() throws IOException {
- return next(null);
- }
-
- @Override
- public Entry next(Entry reuse) throws IOException {
- delegate.entryStart = delegate.reader.getPosition();
- HLog.Entry e = reuse;
- if (e == null) {
- HLogKey key;
- if (delegate.keyClass == null) {
- key = HLog.newKey(delegate.conf);
- } else {
- try {
- key = delegate.keyClass.newInstance();
- } catch (InstantiationException ie) {
- throw new IOException(ie);
- } catch (IllegalAccessException iae) {
- throw new IOException(iae);
- }
- }
- WALEdit val = new WALEdit();
- e = new HLog.Entry(key, val);
- }
-
- // now read in the HLog.Entry from the WAL
- boolean nextPairValid = false;
- try {
- if (delegate.compressionContext != null) {
- throw new UnsupportedOperationException(
- "Reading compression isn't supported with the IndexedHLogReader! Compresed WALEdits "
- + "are only support for HBase 0.94.9+ and with the IndexedWALEditCodec!");
- }
- // this is the special bit - we use our custom entry to read in the key-values that have index
- // information, but otherwise it looks just like a regular WALEdit
- IndexedWALEdit edit = new IndexedWALEdit(e.getEdit());
- nextPairValid = delegate.reader.next(e.getKey(), edit);
- } catch (IOException ioe) {
- throw delegate.addFileInfoToException(ioe);
- }
- delegate.edit++;
- if (delegate.compressionContext != null && delegate.emptyCompressionContext) {
- delegate.emptyCompressionContext = false;
- }
- return nextPairValid ? e : null;
- }
-
- @Override
- public void seek(long pos) throws IOException {
- this.delegate.seek(pos);
- }
-
- @Override
- public long getPosition() throws IOException {
- return this.delegate.getPosition();
- }
-
@Override
- public void reset() throws IOException {
- this.delegate.reset();
+ protected void initAfterCompression() throws IOException {
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
+ super.initAfterCompression();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEdit.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEdit.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEdit.java
deleted file mode 100644
index 6749cc9..0000000
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEdit.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.hadoop.hbase.regionserver.wal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.List;
-import java.util.NavigableMap;
-import java.util.TreeMap;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.index.wal.KeyValueCodec;
-
-/**
- * Read in data for a delegate {@link WALEdit}. This should only be used in concert with an IndexedHLogReader
- * <p>
- * This class should only be used with HBase < 0.94.9. Newer installations of HBase should
- * instead use the IndexedWALEditCodec along with the correct configuration options.
- */
-public class IndexedWALEdit extends WALEdit {
- //reproduced here so we don't need to modify the HBase source.
- private static final int VERSION_2 = -1;
- private WALEdit delegate;
-
- /**
- * Copy-constructor. Only does a surface copy of the delegates fields - no actual data is copied, only referenced.
- * @param delegate to copy
- */
- @SuppressWarnings("deprecation")
- public IndexedWALEdit(WALEdit delegate) {
- this.delegate = delegate;
- // reset the delegate's fields
- this.delegate.getKeyValues().clear();
- if (this.delegate.getScopes() != null) {
- this.delegate.getScopes().clear();
- }
- }
-
- public IndexedWALEdit() {
-
- }
-
- @Override
-public void setCompressionContext(CompressionContext context) {
- throw new UnsupportedOperationException(
- "Compression not supported for IndexedWALEdit! If you are using HBase 0.94.9+, use IndexedWALEditCodec instead.");
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void readFields(DataInput in) throws IOException {
- delegate.getKeyValues().clear();
- if (delegate.getScopes() != null) {
- delegate.getScopes().clear();
- }
- // ----------------------------------------------------------------------------------------
- // no compression, so we do pretty much what the usual WALEdit does, plus a little magic to
- // capture the index updates
- // -----------------------------------------------------------------------------------------
- int versionOrLength = in.readInt();
- if (versionOrLength != VERSION_2) {
- throw new IOException("You must update your cluster to the lastest version of HBase and"
- + " clean out all logs (cleanly start and then shutdown) before enabling indexing!");
- }
- // this is new style HLog entry containing multiple KeyValues.
- List<KeyValue> kvs = KeyValueCodec.readKeyValues(in);
- delegate.getKeyValues().addAll(kvs);
-
- // then read in the rest of the WALEdit
- int numFamilies = in.readInt();
- NavigableMap<byte[], Integer> scopes = delegate.getScopes();
- if (numFamilies > 0) {
- if (scopes == null) {
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
- }
- for (int i = 0; i < numFamilies; i++) {
- byte[] fam = Bytes.readByteArray(in);
- int scope = in.readInt();
- scopes.put(fam, scope);
- }
- delegate.setScopes(scopes);
- }
- }
-
- @Override
- public void write(DataOutput out) throws IOException {
- throw new IOException(
- "Indexed WALEdits aren't written directly out - use IndexedKeyValues instead");
- }
-}
\ No newline at end of file
[03/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index eab4ca1..28def4e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -26,6 +26,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.HTableInterface;
@@ -310,11 +312,11 @@ public class MutationState implements SQLCloseable {
long byteSize = 0;
int keyValueCount = 0;
for (Mutation mutation : mutations) {
- if (mutation.getFamilyMap() != null) { // Not a Delete of the row
- for (Entry<byte[], List<KeyValue>> entry : mutation.getFamilyMap().entrySet()) {
+ if (mutation.getFamilyCellMap() != null) { // Not a Delete of the row
+ for (Entry<byte[], List<Cell>> entry : mutation.getFamilyCellMap().entrySet()) {
if (entry.getValue() != null) {
- for (KeyValue kv : entry.getValue()) {
- byteSize += kv.getBuffer().length;
+ for (Cell kv : entry.getValue()) {
+ byteSize += CellUtil.estimatedSizeOf(kv);
keyValueCount++;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
index 287c3fe..4933d58 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
@@ -26,7 +26,6 @@ import java.util.Arrays;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
-
import org.apache.phoenix.expression.visitor.ExpressionVisitor;
import org.apache.phoenix.schema.PColumn;
import org.apache.phoenix.schema.tuple.Tuple;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/expression/aggregator/DistinctValueWithCountServerAggregator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/aggregator/DistinctValueWithCountServerAggregator.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/aggregator/DistinctValueWithCountServerAggregator.java
index 3c03b29..fd72f2c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/aggregator/DistinctValueWithCountServerAggregator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/aggregator/DistinctValueWithCountServerAggregator.java
@@ -27,8 +27,8 @@ import java.util.Map.Entry;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.io.hfile.Compression;
-import org.apache.hadoop.hbase.io.hfile.Compression.Algorithm;
+import org.apache.hadoop.hbase.io.compress.Compression;
+import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/BooleanExpressionFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/BooleanExpressionFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/BooleanExpressionFilter.java
index 2e16716..86976dc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/BooleanExpressionFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/BooleanExpressionFilter.java
@@ -25,6 +25,8 @@ import java.io.IOException;
import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Writables;
+import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
import org.apache.phoenix.expression.Expression;
import org.apache.phoenix.expression.ExpressionType;
@@ -40,7 +42,7 @@ import org.apache.phoenix.util.ServerUtil;
*
* @since 0.1
*/
-abstract public class BooleanExpressionFilter extends FilterBase {
+abstract public class BooleanExpressionFilter extends FilterBase implements Writable {
protected Expression expression;
protected boolean evaluateOnCompletion;
@@ -117,7 +119,12 @@ abstract public class BooleanExpressionFilter extends FilterBase {
ServerUtil.throwIOException("BooleanExpressionFilter failed during writing", t);
}
}
-
+
+ @Override
+ public byte[] toByteArray() throws IOException {
+ return Writables.getBytes(this);
+ }
+
@Override
public void reset() {
expression.reset();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCFCQKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCFCQKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCFCQKeyValueComparisonFilter.java
index a0b19a4..7451823 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCFCQKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCFCQKeyValueComparisonFilter.java
@@ -19,9 +19,12 @@
*/
package org.apache.phoenix.filter;
+import java.io.IOException;
import java.util.TreeSet;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.phoenix.expression.Expression;
@@ -131,4 +134,12 @@ public class MultiCFCQKeyValueComparisonFilter extends MultiKeyValueComparisonFi
// The others are for columns projected in the select expression.
return cfSet.contains(name);
}
+
+ public static MultiCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (MultiCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCFCQKeyValueComparisonFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCQKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCQKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCQKeyValueComparisonFilter.java
index 579076b..76ce187 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCQKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiCQKeyValueComparisonFilter.java
@@ -19,7 +19,11 @@
*/
package org.apache.phoenix.filter;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.expression.Expression;
@@ -67,4 +71,12 @@ public class MultiCQKeyValueComparisonFilter extends MultiKeyValueComparisonFilt
public boolean isFamilyEssential(byte[] name) {
return Bytes.compareTo(cf, name) == 0;
}
+
+ public static MultiCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (MultiCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCQKeyValueComparisonFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiKeyValueComparisonFilter.java
index 16680ad..a6d74d3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/MultiKeyValueComparisonFilter.java
@@ -24,9 +24,13 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.phoenix.expression.Expression;
import org.apache.phoenix.expression.KeyValueColumnExpression;
@@ -193,7 +197,7 @@ public abstract class MultiKeyValueComparisonFilter extends BooleanExpressionFil
}
@Override
- public ReturnCode filterKeyValue(KeyValue keyValue) {
+ public ReturnCode filterKeyValue(Cell keyValue) {
if (Boolean.TRUE.equals(this.matchedColumn)) {
// We already found and matched the single column, all keys now pass
return ReturnCode.INCLUDE;
@@ -203,7 +207,7 @@ public abstract class MultiKeyValueComparisonFilter extends BooleanExpressionFil
return ReturnCode.NEXT_ROW;
}
// This is a key value we're not interested in (TODO: why INCLUDE here instead of NEXT_COL?)
- ReturnCode code = inputTuple.resolveColumn(keyValue);
+ ReturnCode code = inputTuple.resolveColumn(KeyValueUtil.ensureKeyValue(keyValue));
if (code != null) {
return code;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
index 2984d7b..dea7ec0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
@@ -23,9 +23,12 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.io.WritableUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,9 +72,9 @@ public class RowKeyComparisonFilter extends BooleanExpressionFilter {
* to be called with deleted or partial row keys.
*/
@Override
- public ReturnCode filterKeyValue(KeyValue v) {
+ public ReturnCode filterKeyValue(Cell v) {
if (evaluate) {
- inputTuple.setKey(v.getBuffer(), v.getRowOffset(), v.getRowLength());
+ inputTuple.setKey(v.getRowArray(), v.getRowOffset(), v.getRowLength());
this.keepRow = Boolean.TRUE.equals(evaluate(inputTuple));
if (logger.isDebugEnabled()) {
logger.debug("RowKeyComparisonFilter: " + (this.keepRow ? "KEEP" : "FILTER") + " row " + inputTuple);
@@ -153,4 +156,12 @@ public class RowKeyComparisonFilter extends BooleanExpressionFilter {
super.write(output);
WritableUtils.writeCompressedByteArray(output, this.essentialCF);
}
+
+ public static RowKeyComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (RowKeyComparisonFilter)Writables.getWritable(pbBytes, new RowKeyComparisonFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCFCQKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCFCQKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCFCQKeyValueComparisonFilter.java
index 718cd37..ab43662 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCFCQKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCFCQKeyValueComparisonFilter.java
@@ -19,7 +19,11 @@
*/
package org.apache.phoenix.filter;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.phoenix.expression.Expression;
@@ -47,5 +51,12 @@ public class SingleCFCQKeyValueComparisonFilter extends SingleKeyValueComparison
if (c != 0) return c;
return Bytes.compareTo(cq, 0, cq.length, cqBuf, cqOffset, cqLength);
}
-
+
+ public static SingleCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (SingleCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCFCQKeyValueComparisonFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCQKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCQKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCQKeyValueComparisonFilter.java
index 75e8919..5c25600 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCQKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleCQKeyValueComparisonFilter.java
@@ -19,7 +19,11 @@
*/
package org.apache.phoenix.filter;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
import org.apache.phoenix.expression.Expression;
@@ -46,4 +50,11 @@ public class SingleCQKeyValueComparisonFilter extends SingleKeyValueComparisonFi
return Bytes.compareTo(cq, 0, cq.length, cqBuf, cqOffset, cqLength);
}
+ public static SingleCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (SingleCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCQKeyValueComparisonFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleKeyValueComparisonFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleKeyValueComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleKeyValueComparisonFilter.java
index 09f5faa..e17f677 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleKeyValueComparisonFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SingleKeyValueComparisonFilter.java
@@ -22,7 +22,10 @@ package org.apache.phoenix.filter;
import java.io.DataInput;
import java.io.IOException;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.expression.Expression;
@@ -74,7 +77,7 @@ public abstract class SingleKeyValueComparisonFilter extends BooleanExpressionFi
}
@Override
- public ReturnCode filterKeyValue(KeyValue keyValue) {
+ public ReturnCode filterKeyValue(Cell keyValue) {
if (this.matchedColumn) {
// We already found and matched the single column, all keys now pass
// TODO: why won't this cause earlier versions of a kv to be included?
@@ -84,16 +87,16 @@ public abstract class SingleKeyValueComparisonFilter extends BooleanExpressionFi
// We found all the columns, but did not match the expression, so skip to next row
return ReturnCode.NEXT_ROW;
}
- byte[] buf = keyValue.getBuffer();
+ byte[] buf = keyValue.getValueArray();
if (compare(buf, keyValue.getFamilyOffset(), keyValue.getFamilyLength(), buf, keyValue.getQualifierOffset(), keyValue.getQualifierLength()) != 0) {
// Remember the key in case this is the only key value we see.
// We'll need it if we have row key columns too.
- inputTuple.setKey(keyValue);
+ inputTuple.setKey(KeyValueUtil.ensureKeyValue(keyValue));
// This is a key value we're not interested in
// TODO: use NEXT_COL when bug fix comes through that includes the row still
return ReturnCode.INCLUDE;
}
- inputTuple.setKeyValue(keyValue);
+ inputTuple.setKeyValue(KeyValueUtil.ensureKeyValue(keyValue));
// We have the columns, so evaluate here
if (!Boolean.TRUE.equals(evaluate(inputTuple))) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index 8acce1c..3214c12 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -25,12 +25,16 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Writables;
+import org.apache.hadoop.io.Writable;
import org.apache.phoenix.query.KeyRange;
import org.apache.phoenix.query.KeyRange.Bound;
import org.apache.phoenix.query.QueryConstants;
@@ -55,7 +59,7 @@ import com.google.common.hash.Hashing;
*
* @since 0.1
*/
-public class SkipScanFilter extends FilterBase {
+public class SkipScanFilter extends FilterBase implements Writable {
private enum Terminate {AT, AFTER};
// Conjunctive normal form of or-ed ranges or point lookups
private List<List<KeyRange>> slots;
@@ -110,8 +114,8 @@ public class SkipScanFilter extends FilterBase {
}
@Override
- public ReturnCode filterKeyValue(KeyValue kv) {
- return navigate(kv.getBuffer(), kv.getRowOffset(),kv.getRowLength(),Terminate.AFTER);
+ public ReturnCode filterKeyValue(Cell kv) {
+ return navigate(kv.getRowArray(), kv.getRowOffset(),kv.getRowLength(),Terminate.AFTER);
}
@Override
@@ -429,7 +433,6 @@ public class SkipScanFilter extends FilterBase {
return targetKey;
}
- @Override
public void readFields(DataInput in) throws IOException {
RowKeySchema schema = new RowKeySchema();
schema.readFields(in);
@@ -448,7 +451,6 @@ public class SkipScanFilter extends FilterBase {
this.init(slots, schema);
}
- @Override
public void write(DataOutput out) throws IOException {
schema.write(out);
out.writeInt(slots.size());
@@ -459,6 +461,19 @@ public class SkipScanFilter extends FilterBase {
}
}
}
+
+ @Override
+ public byte[] toByteArray() throws IOException {
+ return Writables.getBytes(this);
+ }
+
+ public static SkipScanFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
+ try {
+ return (SkipScanFilter)Writables.getWritable(pbBytes, new SkipScanFilter());
+ } catch (IOException e) {
+ throw new DeserializationException(e);
+ }
+ }
@Override
public int hashCode() {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index 67af918..69611a2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -33,23 +33,19 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.index.ValueGetter;
+import org.apache.hadoop.hbase.index.covered.update.ColumnReference;
+import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.index.ValueGetter;
-import org.apache.hadoop.hbase.index.covered.update.ColumnReference;
-import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.client.KeyValueBuilder;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.ColumnModifier;
@@ -69,6 +65,12 @@ import org.apache.phoenix.util.IndexUtil;
import org.apache.phoenix.util.SchemaUtil;
import org.apache.phoenix.util.TrustedByteArrayOutputStream;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
/**
*
* Class that builds index row key from data row key and current state of
@@ -362,7 +364,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
put.add(this.kvBuilder.buildPut(new ImmutableBytesPtr(indexRowKey),
this.getEmptyKeyValueFamily(), QueryConstants.EMPTY_COLUMN_BYTES_PTR, ts,
ByteUtil.EMPTY_BYTE_ARRAY_PTR));
- put.setWriteToWAL(!indexWALDisabled);
+ put.setDurability(!indexWALDisabled ? Durability.USE_DEFAULT : Durability.SKIP_WAL);
}
int i = 0;
for (ColumnReference ref : this.getCoverededColumns()) {
@@ -373,7 +375,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
if (value != null) {
if (put == null) {
put = new Put(indexRowKey);
- put.setWriteToWAL(!indexWALDisabled);
+ put.setDurability(!indexWALDisabled ? Durability.USE_DEFAULT : Durability.SKIP_WAL);
}
//this is a little bit of extra work for installations that are running <0.94.14, but that should be rare and is a short-term set of wrappers - it shouldn't kill GC
put.add(this.kvBuilder.buildPut(rowKey, ref.getFamilyWritable(), cq, ts, value));
@@ -393,9 +395,10 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
public boolean isRowDeleted(Collection<KeyValue> pendingUpdates) {
int nDeleteCF = 0;
for (KeyValue kv : pendingUpdates) {
- if (kv.getType() == KeyValue.Type.DeleteFamily.getCode()) {
+ if (kv.getTypeByte() == KeyValue.Type.DeleteFamily.getCode()) {
nDeleteCF++;
- boolean isEmptyCF = Bytes.compareTo(kv.getFamily(), dataEmptyKeyValueCF) == 0;
+ boolean isEmptyCF = Bytes.compareTo(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(),
+ dataEmptyKeyValueCF, 0, dataEmptyKeyValueCF.length) == 0;
// This is what a delete looks like on the client side for immutable indexing...
if (isEmptyCF) {
return true;
@@ -412,7 +415,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
}
Map<ColumnReference,KeyValue> newState = Maps.newHashMapWithExpectedSize(pendingUpdates.size());
for (KeyValue kv : pendingUpdates) {
- newState.put(new ColumnReference(kv.getFamily(), kv.getQualifier()), kv);
+ newState.put(new ColumnReference(CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv)), kv);
}
for (ColumnReference ref : indexedColumns) {
KeyValue newValue = newState.get(ref);
@@ -421,7 +424,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
// If there was no old value or the old value is different than the new value, the index row needs to be deleted
if (oldValue == null ||
Bytes.compareTo(oldValue.get(), oldValue.getOffset(), oldValue.getLength(),
- newValue.getBuffer(), newValue.getValueOffset(), newValue.getValueLength()) != 0){
+ newValue.getValueArray(), newValue.getValueOffset(), newValue.getValueLength()) != 0){
return true;
}
}
@@ -442,19 +445,19 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
byte[] indexRowKey = this.buildRowKey(oldState, dataRowKeyPtr);
// Delete the entire row if any of the indexed columns changed
if (oldState == null || isRowDeleted(pendingUpdates) || hasIndexedColumnChanged(oldState, pendingUpdates)) { // Deleting the entire row
- Delete delete = new Delete(indexRowKey, ts, null);
- delete.setWriteToWAL(!indexWALDisabled);
+ Delete delete = new Delete(indexRowKey, ts);
+ delete.setDurability(!indexWALDisabled ? Durability.USE_DEFAULT : Durability.SKIP_WAL);
return delete;
}
Delete delete = null;
// Delete columns for missing key values
for (KeyValue kv : pendingUpdates) {
- if (kv.getType() != KeyValue.Type.Put.getCode()) {
+ if (kv.getTypeByte() != KeyValue.Type.Put.getCode()) {
ColumnReference ref = new ColumnReference(kv.getFamily(), kv.getQualifier());
if (coveredColumns.contains(ref)) {
if (delete == null) {
delete = new Delete(indexRowKey);
- delete.setWriteToWAL(!indexWALDisabled);
+ delete.setDurability(!indexWALDisabled ? Durability.USE_DEFAULT : Durability.SKIP_WAL);
}
delete.deleteColumns(ref.getFamily(), IndexUtil.getIndexColumnName(ref.getFamily(), ref.getQualifier()), ts);
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
index 66b2e48..1a08e78 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Scan;
@@ -47,14 +48,14 @@ import org.apache.phoenix.util.SchemaUtil;
public class PhoenixIndexBuilder extends CoveredColumnsIndexBuilder {
@Override
- public void batchStarted(MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
+ public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
// The entire purpose of this method impl is to get the existing rows for the
// table rows being indexed into the block cache, as the index maintenance code
// does a point scan per row
List<KeyRange> keys = Lists.newArrayListWithExpectedSize(miniBatchOp.size());
List<IndexMaintainer> maintainers = new ArrayList<IndexMaintainer>();
for (int i = 0; i < miniBatchOp.size(); i++) {
- Mutation m = miniBatchOp.getOperation(i).getFirst();
+ Mutation m = miniBatchOp.getOperation(i);
keys.add(PDataType.VARBINARY.getKeyRange(m.getRow()));
maintainers.addAll(getCodec().getIndexMaintainers(m.getAttributesMap()));
}
@@ -65,16 +66,15 @@ public class PhoenixIndexBuilder extends CoveredColumnsIndexBuilder {
HRegion region = this.env.getRegion();
RegionScanner scanner = region.getScanner(scan);
// Run through the scanner using internal nextRaw method
- MultiVersionConsistencyControl.setThreadReadPoint(scanner.getMvccReadPoint());
region.startRegionOperation();
try {
boolean hasMore;
do {
- List<KeyValue> results = Lists.newArrayList();
+ List<Cell> results = Lists.newArrayList();
// Results are potentially returned even when the return value of s.next is false
// since this is an indication of whether or not there are more values after the
// ones returned
- hasMore = scanner.nextRaw(results, null);
+ hasMore = scanner.nextRaw(results);
} while (hasMore);
} finally {
try {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index 65afb58..197bc06 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -22,16 +22,22 @@ package org.apache.phoenix.index;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.Stoppable;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto;
import com.google.common.collect.Multimap;
import org.apache.hadoop.hbase.index.table.HTableInterfaceReference;
@@ -39,7 +45,12 @@ import org.apache.hadoop.hbase.index.write.KillServerOnFailurePolicy;
import org.apache.phoenix.coprocessor.MetaDataProtocol;
import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
import org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.DropColumnRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.UpdateIndexStateRequest;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.protobuf.ProtobufUtil;
import org.apache.phoenix.schema.PIndexState;
import org.apache.phoenix.util.SchemaUtil;
@@ -76,13 +87,38 @@ public class PhoenixIndexFailurePolicy extends KillServerOnFailurePolicy {
// Disable the index by using the updateIndexState method of MetaDataProtocol end point coprocessor.
String indexTableName = ref.getTableName();
byte[] indexTableKey = SchemaUtil.getTableKeyFromFullName(indexTableName);
- HTableInterface systemTable = env.getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
- MetaDataProtocol mdProxy = systemTable.coprocessorProxy(MetaDataProtocol.class, indexTableKey);
+ HTableInterface systemTable = env.getTable(TableName.valueOf(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES));
// Mimic the Put that gets generated by the client on an update of the index state
Put put = new Put(indexTableKey);
put.add(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.INDEX_STATE_BYTES, PIndexState.DISABLE.getSerializedBytes());
- List<Mutation> tableMetadata = Collections.<Mutation>singletonList(put);
- MetaDataMutationResult result = mdProxy.updateIndexState(tableMetadata);
+ final List<Mutation> tableMetadata = Collections.<Mutation>singletonList(put);
+
+ final Map<byte[], MetaDataResponse> results =
+ systemTable.coprocessorService(MetaDataService.class, indexTableKey, indexTableKey,
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
+ @Override
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ UpdateIndexStateRequest.Builder builder = UpdateIndexStateRequest.newBuilder();
+ for (Mutation m : tableMetadata) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+ instance.updateIndexState(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
+ if(results.isEmpty()){
+ throw new IOException("Didn't get expected result size");
+ }
+ MetaDataResponse tmpResponse = results.values().iterator().next();
+ MetaDataMutationResult result = MetaDataMutationResult.constructFromProto(tmpResponse);
+
if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) {
LOG.warn("Attempt to disable index " + indexTableName + " failed with code = " + result.getMutationCode() + ". Will use default failure policy instead.");
super.handleFailure(attempted, cause);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
index 2f70f1a..34e63ba 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferSortedQueue.java
@@ -41,6 +41,7 @@ import com.google.common.collect.MinMaxPriorityQueue;
import org.apache.phoenix.iterate.OrderedResultIterator.ResultEntry;
import org.apache.phoenix.schema.tuple.ResultTuple;
import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.util.ResultUtil;
public class MappedByteBufferSortedQueue extends AbstractQueue<ResultEntry> {
private Comparator<ResultEntry> comparator;
@@ -224,7 +225,7 @@ public class MappedByteBufferSortedQueue extends AbstractQueue<ResultEntry> {
int size = result.size();
List<KeyValue> kvs = new ArrayList<KeyValue>(size);
for (int i = 0; i < size; i++) {
- kvs.add(result.getValue(i));
+ kvs.add(org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(result.getValue(i)));
}
return kvs;
}
@@ -335,7 +336,7 @@ public class MappedByteBufferSortedQueue extends AbstractQueue<ResultEntry> {
byte[] rb = new byte[length];
readBuffer.get(rb);
- Result result = new Result(new ImmutableBytesWritable(rb));
+ Result result = ResultUtil.toResult(new ImmutableBytesWritable(rb));
ResultTuple rt = new ResultTuple(result);
int sortKeySize = readBuffer.getInt();
ImmutableBytesWritable[] sortKeys = new ImmutableBytesWritable[sortKeySize];
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
index 649b9cd..b5d785a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
@@ -24,6 +24,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.regionserver.MultiVersionConsistencyControl;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
@@ -38,18 +39,17 @@ public class RegionScannerResultIterator extends BaseResultIterator {
public RegionScannerResultIterator(RegionScanner scanner) {
this.scanner = scanner;
- MultiVersionConsistencyControl.setThreadReadPoint(scanner.getMvccReadPoint());
}
@Override
public Tuple next() throws SQLException {
try {
// TODO: size
- List<KeyValue> results = new ArrayList<KeyValue>();
+ List<Cell> results = new ArrayList<Cell>();
// Results are potentially returned even when the return value of s.next is false
// since this is an indication of whether or not there are more values after the
// ones returned
- boolean hasMore = scanner.nextRaw(results, null);
+ boolean hasMore = scanner.nextRaw(results);
if (!hasMore && results.isEmpty()) {
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index cbe7aa2..7635b6e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -178,7 +178,7 @@ public class SpoolingResultIterator implements PeekingResultIterator {
offset += WritableUtils.getVIntSize(resultSize);
ImmutableBytesWritable value = new ImmutableBytesWritable(bytes,offset,resultSize);
offset += resultSize;
- Tuple result = new ResultTuple(new Result(value));
+ Tuple result = new ResultTuple(ResultUtil.toResult(value));
return next = result;
}
@@ -272,7 +272,7 @@ public class SpoolingResultIterator implements PeekingResultIterator {
offset += bytesRead;
totalBytesRead += bytesRead;
}
- next = new ResultTuple(new Result(new ImmutableBytesWritable(buffer,0,length)));
+ next = new ResultTuple(ResultUtil.toResult(new ImmutableBytesWritable(buffer,0,length)));
return next;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/job/JobManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/job/JobManager.java b/phoenix-core/src/main/java/org/apache/phoenix/job/JobManager.java
index d967d99..016d7de 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/job/JobManager.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/job/JobManager.java
@@ -69,7 +69,7 @@ public class JobManager<T> extends AbstractRoundRobinQueue<T> {
@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
- return new JobFutureTask<T>((JobRunnable)runnable, value);
+ return new JobFutureTask<T>(runnable, value);
}
};
@@ -84,9 +84,13 @@ public class JobManager<T> extends AbstractRoundRobinQueue<T> {
static class JobFutureTask<T> extends FutureTask<T> {
private final Object jobId;
- public JobFutureTask(JobRunnable r, T t) {
+ public JobFutureTask(Runnable r, T t) {
super(r, t);
- this.jobId = r.getJobId();
+ if(r instanceof JobRunnable){
+ this.jobId = ((JobRunnable)r).getJobId();
+ } else {
+ this.jobId = this;
+ }
}
public JobFutureTask(Callable<T> c) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
index 2cb8f78..1f2e656 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
@@ -98,7 +98,7 @@ public class HashCacheFactory implements ServerCacheFactory {
int resultSize = (int)Bytes.readVLong(hashCacheByteArray, offset);
offset += WritableUtils.decodeVIntSize(hashCacheByteArray[offset]);
ImmutableBytesWritable value = new ImmutableBytesWritable(hashCacheByteArray,offset,resultSize);
- Tuple result = new ResultTuple(new Result(value));
+ Tuple result = new ResultTuple(ResultUtil.toResult(value));
ImmutableBytesPtr key = TupleUtil.getConcatenatedValue(result, onExpressions);
List<Tuple> tuples = hashCacheMap.get(key);
if (tuples == null) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/join/ScanProjector.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/join/ScanProjector.java b/phoenix-core/src/main/java/org/apache/phoenix/join/ScanProjector.java
index 37f39e1..4f7c4e4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/ScanProjector.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/ScanProjector.java
@@ -26,6 +26,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -205,8 +206,8 @@ public class ScanProjector {
public ProjectedValueTuple projectResults(Tuple tuple) {
byte[] bytesValue = schema.toBytes(tuple, expressions, valueSet, ptr);
- KeyValue base = tuple.getValue(0);
- return new ProjectedValueTuple(base.getBuffer(), base.getRowOffset(), base.getRowLength(), base.getTimestamp(), bytesValue, valueSet.getEstimatedLength());
+ Cell base = tuple.getValue(0);
+ return new ProjectedValueTuple(base.getRowArray(), base.getRowOffset(), base.getRowLength(), base.getTimestamp(), bytesValue, valueSet.getEstimatedLength());
}
public static void decodeProjectedValue(Tuple tuple, ImmutableBytesWritable ptr) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/map/reduce/CSVBulkLoader.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/map/reduce/CSVBulkLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/map/reduce/CSVBulkLoader.java
index 8426c52..efc89de 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/map/reduce/CSVBulkLoader.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/map/reduce/CSVBulkLoader.java
@@ -45,7 +45,6 @@ import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.HFileOutputFormat;
import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles;
-import org.apache.hadoop.hbase.regionserver.metrics.SchemaMetrics;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
@@ -236,8 +235,6 @@ public class CSVBulkLoader {
job.setMapperClass(MapReduceJob.PhoenixMapper.class);
job.setMapOutputKeyClass(ImmutableBytesWritable.class);
job.setMapOutputValueClass(KeyValue.class);
-
- SchemaMetrics.configureGlobally(conf);
HTable hDataTable = new HTable(conf, dataTable);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
index 2aa45d7..f82dc59 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
@@ -180,7 +180,7 @@ public class QueryOptimizer {
* b) the plan that preserves ordering for a group by.
* c) the data table plan
* @param plans the list of candidate plans
- * @return
+ * @return QueryPlan
*/
private QueryPlan chooseBestPlan(SelectStatement select, List<QueryPlan> plans) {
QueryPlan firstPlan = plans.get(0);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/protobuf/ProtobufUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/protobuf/ProtobufUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/protobuf/ProtobufUtil.java
new file mode 100644
index 0000000..c12c64d
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/protobuf/ProtobufUtil.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.protobuf;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType;
+import org.apache.hadoop.util.StringUtils;
+
+import com.google.protobuf.ByteString;
+import com.google.protobuf.HBaseZeroCopyByteString;
+import com.google.protobuf.RpcController;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
+import org.apache.phoenix.coprocessor.generated.ServerCachingProtos;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
+import org.apache.phoenix.schema.PTableType;
+
+public class ProtobufUtil {
+
+ /**
+ * Stores an exception encountered during RPC invocation so it can be passed back through to the
+ * client.
+ * @param controller the controller instance provided by the client when calling the service
+ * @param ioe the exception encountered
+ */
+ public static void setControllerException(RpcController controller, IOException ioe) {
+ if (controller != null) {
+ if (controller instanceof ServerRpcController) {
+ ((ServerRpcController) controller).setFailedOn(ioe);
+ } else {
+ controller.setFailed(StringUtils.stringifyException(ioe));
+ }
+ }
+ }
+
+ public static PTableProtos.PTableType toPTableTypeProto(PTableType type) {
+ return PTableProtos.PTableType.values()[type.ordinal()];
+ }
+
+ public static PTableType toPTableType(PTableProtos.PTableType type) {
+ return PTableType.values()[type.ordinal()];
+ }
+
+ public static List<Mutation> getMutations(MetaDataProtos.CreateTableRequest request)
+ throws IOException {
+ return getMutations(request.getTableMetadataMutationsList());
+ }
+
+ public static List<Mutation> getMutations(MetaDataProtos.DropTableRequest request)
+ throws IOException {
+ return getMutations(request.getTableMetadataMutationsList());
+ }
+
+ public static List<Mutation> getMutations(MetaDataProtos.AddColumnRequest request)
+ throws IOException {
+ return getMutations(request.getTableMetadataMutationsList());
+ }
+
+ public static List<Mutation> getMutations(MetaDataProtos.DropColumnRequest request)
+ throws IOException {
+ return getMutations(request.getTableMetadataMutationsList());
+ }
+
+ public static List<Mutation> getMutations(MetaDataProtos.UpdateIndexStateRequest request)
+ throws IOException {
+ return getMutations(request.getTableMetadataMutationsList());
+ }
+
+ /**
+ * Each ByteString entry is a byte array serialized from MutationProto instance
+ * @param mutations
+ * @throws IOException
+ */
+ private static List<Mutation> getMutations(List<ByteString> mutations)
+ throws IOException {
+ List<Mutation> result = new ArrayList<Mutation>();
+ for (ByteString mutation : mutations) {
+ MutationProto mProto = MutationProto.parseFrom(mutation);
+ result.add(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(mProto));
+ }
+ return result;
+ }
+
+ public static MutationProto toProto(Mutation mutation) throws IOException {
+ MutationType type;
+ if (mutation instanceof Put) {
+ type = MutationType.PUT;
+ } else if (mutation instanceof Delete) {
+ type = MutationType.DELETE;
+ } else {
+ throw new IllegalArgumentException("Only Put and Delete are supported");
+ }
+ return org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(type, mutation);
+ }
+
+ public static ServerCachingProtos.ImmutableBytesWritable toProto(ImmutableBytesWritable w) {
+ ServerCachingProtos.ImmutableBytesWritable.Builder builder =
+ ServerCachingProtos.ImmutableBytesWritable.newBuilder();
+ builder.setByteArray(HBaseZeroCopyByteString.wrap(w.get()));
+ builder.setOffset(w.getOffset());
+ builder.setLength(w.getLength());
+ return builder.build();
+ }
+
+ public static ImmutableBytesWritable toImmutableBytesWritable(ServerCachingProtos.ImmutableBytesWritable proto) {
+ return new ImmutableBytesWritable(proto.getByteArray().toByteArray(), proto.getOffset(), proto.getLength());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index fe81857..cfc4960 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -41,10 +41,11 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableExistsException;
-import org.apache.hadoop.hbase.ZooKeeperConnectionException;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HConnection;
+import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Mutation;
@@ -53,6 +54,9 @@ import org.apache.hadoop.hbase.client.coprocessor.Batch;
import org.apache.hadoop.hbase.index.Indexer;
import org.apache.hadoop.hbase.index.covered.CoveredColumnsIndexBuilder;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.VersionInfo;
@@ -69,6 +73,19 @@ import org.apache.phoenix.coprocessor.ScanRegionObserver;
import org.apache.phoenix.coprocessor.SequenceRegionObserver;
import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl;
import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.AddColumnRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.CreateTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.DropColumnRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.DropTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetTableRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetVersionRequest;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetVersionResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
+import org.apache.phoenix.coprocessor.generated.MetaDataProtos.UpdateIndexStateRequest;
import org.apache.phoenix.exception.PhoenixIOException;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -78,6 +95,7 @@ import org.apache.phoenix.index.PhoenixIndexCodec;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
+import org.apache.phoenix.protobuf.ProtobufUtil;
import org.apache.phoenix.schema.EmptySequenceCacheException;
import org.apache.phoenix.schema.MetaDataSplitPolicy;
import org.apache.phoenix.schema.NewerTableAlreadyExistsException;
@@ -103,6 +121,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import com.google.protobuf.HBaseZeroCopyByteString;
public class ConnectionQueryServicesImpl extends DelegateQueryServices implements ConnectionQueryServices {
private static final Logger logger = LoggerFactory.getLogger(ConnectionQueryServicesImpl.class);
@@ -112,7 +131,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
// Copy of config.getProps(), but read-only to prevent synchronization that we
// don't need.
private final ReadOnlyProps props;
- private final HConnection connection;
+ private HConnection connection;
private final StatsManager statsManager;
private final ConcurrentHashMap<ImmutableBytesWritable,ConnectionQueryServices> childServices;
// Cache the latest meta data here for future connections
@@ -145,23 +164,21 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
// Without making a copy of the configuration we cons up, we lose some of our properties
// on the server side during testing.
this.config = HBaseConfiguration.create(config);
- this.props = new ReadOnlyProps(this.config.iterator());
- try {
- this.connection = HBaseFactoryProvider.getHConnectionFactory().createConnection(this.config);
- } catch (ZooKeeperConnectionException e) {
- throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION)
- .setRootCause(e).build().buildException();
- }
- if (this.connection.isClosed()) { // TODO: why the heck doesn't this throw above?
- throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION).build().buildException();
- }
+ // set default value for hbase.master.logcleaner.plugin if not set yet
+ if(this.config.get(HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS) == null){
+ this.config.set(HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS,
+ "org.apache.hadoop.hbase.master.cleaner.TimeToLiveLogCleaner");
+ }
+ // disable replication for Phoenix component
+ this.config.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
+ this.props = new ReadOnlyProps(this.config.iterator());
// TODO: should we track connection wide memory usage or just org-wide usage?
// If connection-wide, create a MemoryManager here, otherwise just use the one from the delegate
this.childServices = new ConcurrentHashMap<ImmutableBytesWritable,ConnectionQueryServices>(INITIAL_CHILD_SERVICES_CAPACITY);
int statsUpdateFrequencyMs = this.getProps().getInt(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, QueryServicesOptions.DEFAULT_STATS_UPDATE_FREQ_MS);
int maxStatsAgeMs = this.getProps().getInt(QueryServices.MAX_STATS_AGE_MS_ATTRIB, QueryServicesOptions.DEFAULT_MAX_STATS_AGE_MS);
this.statsManager = new StatsManagerImpl(this, statsUpdateFrequencyMs, maxStatsAgeMs);
-
+
// find the HBase version and use that to determine the KeyValueBuilder that should be used
String hbaseVersion = VersionInfo.getVersion();
this.kvBuilder = KeyValueBuilder.get(hbaseVersion);
@@ -253,7 +270,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
@Override
public void clearTableRegionCache(byte[] tableName) throws SQLException {
- connection.clearRegionCache(tableName);
+ connection.clearRegionCache(TableName.valueOf(tableName));
}
@Override
@@ -272,7 +289,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
List<HRegionLocation> locations = Lists.newArrayList();
byte[] currentKey = HConstants.EMPTY_START_ROW;
do {
- HRegionLocation regionLocation = connection.getRegionLocation(tableName, currentKey, reload);
+ HRegionLocation regionLocation = connection.getRegionLocation(
+ TableName.valueOf(tableName), currentKey, reload);
locations.add(regionLocation);
currentKey = regionLocation.getRegionInfo().getEndKey();
} while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW));
@@ -429,7 +447,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
private HTableDescriptor generateTableDescriptor(byte[] tableName, HTableDescriptor existingDesc, PTableType tableType, Map<String,Object> tableProps, List<Pair<byte[],Map<String,Object>>> families, byte[][] splits) throws SQLException {
- HTableDescriptor descriptor = (existingDesc != null) ? new HTableDescriptor(existingDesc) : new HTableDescriptor(tableName);
+ HTableDescriptor descriptor = (existingDesc != null) ? new HTableDescriptor(existingDesc) :
+ new HTableDescriptor(TableName.valueOf(tableName));
for (Entry<String,Object> entry : tableProps.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
@@ -712,18 +731,21 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
serverMap.add(entry);
}
}
- final TreeMap<byte[],Long> results = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
- connection.processExecs(MetaDataProtocol.class, regionKeys,
- PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES, this.getDelegate().getExecutor(), new Batch.Call<MetaDataProtocol,Long>() {
+ HTableInterface ht = this.getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
+ final Map<byte[], Long> results =
+ ht.coprocessorService(MetaDataService.class, null, null, new Batch.Call<MetaDataService,Long>() {
@Override
- public Long call(MetaDataProtocol instance) throws IOException {
- return instance.getVersion();
- }
- },
- new Batch.Callback<Long>(){
- @Override
- public void update(byte[] region, byte[] row, Long value) {
- results.put(region, value);
+ public Long call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<GetVersionResponse> rpcCallback =
+ new BlockingRpcCallback<GetVersionResponse>();
+ GetVersionRequest.Builder builder = GetVersionRequest.newBuilder();
+
+ instance.getVersion(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get().getVersion();
}
});
for (Map.Entry<byte[],Long> result : results.entrySet()) {
@@ -756,29 +778,29 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
* Invoke meta data coprocessor with one retry if the key was found to not be in the regions
* (due to a table split)
*/
- private MetaDataMutationResult metaDataCoprocessorExec(byte[] tableKey, Batch.Call<MetaDataProtocol, MetaDataMutationResult> callable) throws SQLException {
+ private MetaDataMutationResult metaDataCoprocessorExec(byte[] tableKey,
+ Batch.Call<MetaDataService, MetaDataResponse> callable) throws SQLException {
try {
boolean retried = false;
while (true) {
- HRegionLocation regionLocation = retried ? connection.relocateRegion(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES, tableKey) : connection.locateRegion(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES, tableKey);
- List<byte[]> regionKeys = Collections.singletonList(regionLocation.getRegionInfo().getStartKey());
- final Map<byte[],MetaDataMutationResult> results = Maps.newHashMapWithExpectedSize(1);
- connection.processExecs(MetaDataProtocol.class, regionKeys,
- PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES, this.getDelegate().getExecutor(), callable,
- new Batch.Callback<MetaDataMutationResult>(){
- @Override
- public void update(byte[] region, byte[] row, MetaDataMutationResult value) {
- results.put(region, value);
- }
- });
+ if (retried) {
+ connection.relocateRegion(
+ TableName.valueOf(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES),
+ tableKey);
+ }
+
+ HTableInterface ht = this.getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
+ final Map<byte[], MetaDataResponse> results =
+ ht.coprocessorService(MetaDataService.class, tableKey, tableKey, callable);
+
assert(results.size() == 1);
- MetaDataMutationResult result = results.values().iterator().next();
- if (result.getMutationCode() == MutationCode.TABLE_NOT_IN_REGION) {
- if (retried) return result;
+ MetaDataResponse result = results.values().iterator().next();
+ if (result.getReturnCode() == MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
+ if (retried) return MetaDataMutationResult.constructFromProto(result);
retried = true;
continue;
}
- return result;
+ return MetaDataMutationResult.constructFromProto(result);
}
} catch (IOException e) {
throw ServerUtil.parseServerException(e);
@@ -807,12 +829,24 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
byte[] tableKey = SchemaUtil.getTableKey(tenantIdBytes, schemaBytes, tableBytes);
MetaDataMutationResult result = metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
- @Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.createTable(tableMetaData);
- }
- });
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
+ @Override
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
+ for (Mutation m : tableMetaData) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+ instance.createTable(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
return result;
}
@@ -822,12 +856,26 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
final byte[] nonNullTenantId = tenantId == null ? ByteUtil.EMPTY_BYTE_ARRAY : tenantId;
byte[] tableKey = SchemaUtil.getTableKey(nonNullTenantId, schemaBytes, tableBytes);
return metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
- @Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.getTable(nonNullTenantId, schemaBytes, tableBytes, tableTimestamp, clientTimestamp);
- }
- });
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
+ @Override
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ GetTableRequest.Builder builder = GetTableRequest.newBuilder();
+ builder.setTenantId(HBaseZeroCopyByteString.wrap(nonNullTenantId));
+ builder.setSchemaName(HBaseZeroCopyByteString.wrap(schemaBytes));
+ builder.setTableName(HBaseZeroCopyByteString.wrap(tableBytes));
+ builder.setTableTimestamp(tableTimestamp);
+ builder.setClientTimestamp(clientTimestamp);
+
+ instance.getTable(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
+ }
+ });
}
@Override
@@ -839,10 +887,24 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
byte[] tableBytes = rowKeyMetadata[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
byte[] tableKey = SchemaUtil.getTableKey(tenantIdBytes == null ? ByteUtil.EMPTY_BYTE_ARRAY : tenantIdBytes, schemaBytes, tableBytes);
final MetaDataMutationResult result = metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
@Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.dropTable(tableMetaData, tableType.getSerializedValue());
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ DropTableRequest.Builder builder = DropTableRequest.newBuilder();
+ for (Mutation m : tableMetaData) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+ builder.setTableType(tableType.getSerializedValue());
+
+ instance.dropTable(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
}
});
@@ -921,10 +983,23 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
return null;
}
MetaDataMutationResult result = metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
@Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.addColumn(tableMetaData);
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ AddColumnRequest.Builder builder = AddColumnRequest.newBuilder();
+ for (Mutation m : tableMetaData) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+
+ instance.addColumn(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
}
});
return result;
@@ -939,10 +1014,22 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
byte[] tableBytes = rowKeyMetadata[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
byte[] tableKey = SchemaUtil.getTableKey(tenantIdBytes, schemaBytes, tableBytes);
MetaDataMutationResult result = metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
@Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.dropColumn(tableMetaData);
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ DropColumnRequest.Builder builder = DropColumnRequest.newBuilder();
+ for (Mutation m : tableMetaData) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+ instance.dropColumn(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
}
});
final MutationCode code = result.getMutationCode();
@@ -991,6 +1078,16 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
@Override
public void init(String url, Properties props) throws SQLException {
+ try {
+ this.connection = HConnectionManager.createConnection(this.config);
+ } catch (IOException ioe) {
+ throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION)
+ .setRootCause(ioe).build().buildException();
+ }
+ if (this.connection.isClosed()) { // TODO: why the heck doesn't this throw above?
+ throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION).build().buildException();
+ }
+
props = new Properties(props);
props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP));
PhoenixConnection metaConnection = new PhoenixConnection(this, url, props, PMetaDataImpl.EMPTY_META_DATA);
@@ -1050,12 +1147,19 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
SQLException sqlE = null;
HTableInterface htable = this.getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
try {
- htable.coprocessorExec(MetaDataProtocol.class, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataProtocol, Void>() {
+ htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, ClearCacheResponse>() {
@Override
- public Void call(MetaDataProtocol instance) throws IOException {
- instance.clearCache();
- return null;
+ public ClearCacheResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<ClearCacheResponse> rpcCallback =
+ new BlockingRpcCallback<ClearCacheResponse>();
+ ClearCacheRequest.Builder builder = ClearCacheRequest.newBuilder();
+ instance.clearCache(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
}
});
} catch (IOException e) {
@@ -1097,10 +1201,22 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
SchemaUtil.getVarChars(tableMetaData.get(0).getRow(), rowKeyMetadata);
byte[] tableKey = SchemaUtil.getTableKey(ByteUtil.EMPTY_BYTE_ARRAY, rowKeyMetadata[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX], rowKeyMetadata[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]);
return metaDataCoprocessorExec(tableKey,
- new Batch.Call<MetaDataProtocol, MetaDataMutationResult>() {
+ new Batch.Call<MetaDataService, MetaDataResponse>() {
@Override
- public MetaDataMutationResult call(MetaDataProtocol instance) throws IOException {
- return instance.updateIndexState(tableMetaData);
+ public MetaDataResponse call(MetaDataService instance) throws IOException {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<MetaDataResponse> rpcCallback =
+ new BlockingRpcCallback<MetaDataResponse>();
+ UpdateIndexStateRequest.Builder builder = UpdateIndexStateRequest.newBuilder();
+ for (Mutation m : tableMetaData) {
+ MutationProto mp = ProtobufUtil.toProto(m);
+ builder.addTableMetadataMutations(mp.toByteString());
+ }
+ instance.updateIndexState(controller, builder.build(), rpcCallback);
+ if(controller.getFailedOn() != null) {
+ throw controller.getFailedOn();
+ }
+ return rpcCallback.get();
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 947960c..c514cb2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@ -27,11 +27,13 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Mutation;
@@ -122,7 +124,9 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices imple
@Override
public List<HRegionLocation> getAllTableRegions(byte[] tableName) throws SQLException {
- return Collections.singletonList(new HRegionLocation(new HRegionInfo(tableName, HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW),"localhost",-1));
+ return Collections.singletonList(new HRegionLocation(
+ new HRegionInfo(TableName.valueOf(tableName), HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW),
+ ServerName.valueOf("localhost", HConstants.DEFAULT_REGIONSERVER_PORT,0), -1));
}
@Override
@@ -243,8 +247,8 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices imple
public MetaDataMutationResult updateIndexState(List<Mutation> tableMetadata, String parentTableName) throws SQLException {
byte[][] rowKeyMetadata = new byte[3][];
SchemaUtil.getVarChars(tableMetadata.get(0).getRow(), rowKeyMetadata);
- KeyValue newKV = tableMetadata.get(0).getFamilyMap().get(TABLE_FAMILY_BYTES).get(0);
- PIndexState newState = PIndexState.fromSerializedValue(newKV.getBuffer()[newKV.getValueOffset()]);
+ Cell newKV = tableMetadata.get(0).getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0);
+ PIndexState newState = PIndexState.fromSerializedValue(newKV.getValueArray()[newKV.getValueOffset()]);
String schemaName = Bytes.toString(rowKeyMetadata[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX]);
String indexName = Bytes.toString(rowKeyMetadata[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]);
String indexTableName = SchemaUtil.getTableName(schemaName, indexName);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/query/HConnectionFactory.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/HConnectionFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/query/HConnectionFactory.java
index 6630986..ef29fe5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/HConnectionFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/HConnectionFactory.java
@@ -19,8 +19,9 @@
*/
package org.apache.phoenix.query;
+import java.io.IOException;
+
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;
@@ -37,14 +38,14 @@ public interface HConnectionFactory {
* @param configuration object
* @return A HConnection instance
*/
- HConnection createConnection(Configuration conf) throws ZooKeeperConnectionException;
+ HConnection createConnection(Configuration conf) throws IOException;
/**
* Default implementation. Uses standard HBase HConnections.
*/
static class HConnectionFactoryImpl implements HConnectionFactory {
@Override
- public HConnection createConnection(Configuration conf) throws ZooKeeperConnectionException {
+ public HConnection createConnection(Configuration conf) throws IOException {
return HConnectionManager.createConnection(conf);
}
}
[02/11] Port Phoenix to Hbase0.98
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index 7b07e7c..4f4998f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -58,7 +58,7 @@ import java.util.Map.Entry;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.regionserver.wal.WALEditCodec;
+import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import org.apache.phoenix.util.DateUtil;
import org.apache.phoenix.util.ReadOnlyProps;
@@ -404,7 +404,7 @@ public class QueryServicesOptions {
}
public QueryServicesOptions setWALEditCodec(String walEditCodec) {
- return set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, walEditCodec);
+ return set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, walEditCodec);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateColumn.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateColumn.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateColumn.java
index d4577c3..f623c28 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateColumn.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateColumn.java
@@ -50,16 +50,6 @@ public class DelegateColumn extends DelegateDatum implements PColumn {
}
@Override
- public void readFields(DataInput input) throws IOException {
- getDelegate().readFields(input);
- }
-
- @Override
- public void write(DataOutput output) throws IOException {
- getDelegate().write(output);
- }
-
- @Override
public int getPosition() {
return getDelegate().getPosition();
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 46e0f78..45745d6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -1097,12 +1097,12 @@ public class MetaDataClient {
long clientTimeStamp = scn == null ? HConstants.LATEST_TIMESTAMP : scn;
List<Mutation> tableMetaData = Lists.newArrayListWithExpectedSize(2);
@SuppressWarnings("deprecation") // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
- Delete tableDelete = new Delete(key, clientTimeStamp, null);
+ Delete tableDelete = new Delete(key, clientTimeStamp);
tableMetaData.add(tableDelete);
if (parentTableName != null) {
byte[] linkKey = MetaDataUtil.getParentLinkKey(tenantId, schemaName, parentTableName, tableName);
@SuppressWarnings("deprecation") // FIXME: Remove when unintentionally deprecated method is fixed (HBASE-7870).
- Delete linkDelete = new Delete(linkKey, clientTimeStamp, null);
+ Delete linkDelete = new Delete(linkKey, clientTimeStamp);
tableMetaData.add(linkDelete);
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumn.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumn.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumn.java
index 7f58495..cfc81be 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumn.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumn.java
@@ -19,15 +19,13 @@
*/
package org.apache.phoenix.schema;
-import org.apache.hadoop.io.Writable;
-
/**
* Definition of a Phoenix column
*
*
* @since 0.1
*/
-public interface PColumn extends PDatum, Writable {
+public interface PColumn extends PDatum {
/**
* @return the name of the column qualifier
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
index 03e78f8..a16c188 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
@@ -19,22 +19,12 @@
*/
package org.apache.phoenix.schema;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.WritableUtils;
+import com.google.protobuf.HBaseZeroCopyByteString;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
import org.apache.phoenix.query.QueryConstants;
-import org.apache.phoenix.util.ByteUtil;
-
import com.google.common.base.Preconditions;
-
public class PColumnImpl implements PColumn {
- private static final Integer NO_MAXLENGTH = Integer.MIN_VALUE;
- private static final Integer NO_SCALE = Integer.MIN_VALUE;
-
private PName name;
private PName familyName;
private PDataType dataType;
@@ -144,37 +134,6 @@ public class PColumnImpl implements PColumn {
public String toString() {
return (familyName == null ? "" : familyName.toString() + QueryConstants.NAME_SEPARATOR) + name.toString();
}
-
- @Override
- public void readFields(DataInput input) throws IOException {
- byte[] columnNameBytes = Bytes.readByteArray(input);
- PName columnName = PNameFactory.newName(columnNameBytes);
- byte[] familyNameBytes = Bytes.readByteArray(input);
- PName familyName = familyNameBytes.length == 0 ? null : PNameFactory.newName(familyNameBytes);
- // TODO: optimize the reading/writing of this b/c it could likely all fit in a single byte or two
- PDataType dataType = PDataType.values()[WritableUtils.readVInt(input)];
- int maxLength = WritableUtils.readVInt(input);
- int scale = WritableUtils.readVInt(input);
- boolean nullable = input.readBoolean();
- int position = WritableUtils.readVInt(input);
- ColumnModifier columnModifier = ColumnModifier.fromSystemValue(WritableUtils.readVInt(input));
- int arrSize = WritableUtils.readVInt(input);
- init(columnName, familyName, dataType, maxLength == NO_MAXLENGTH ? null : maxLength,
- scale == NO_SCALE ? null : scale, nullable, position, columnModifier, arrSize == -1 ? null : arrSize);
- }
-
- @Override
- public void write(DataOutput output) throws IOException {
- Bytes.writeByteArray(output, name.getBytes());
- Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName.getBytes());
- WritableUtils.writeVInt(output, dataType.ordinal());
- WritableUtils.writeVInt(output, maxLength == null ? NO_MAXLENGTH : maxLength);
- WritableUtils.writeVInt(output, scale == null ? NO_SCALE : scale);
- output.writeBoolean(nullable);
- WritableUtils.writeVInt(output, position);
- WritableUtils.writeVInt(output, ColumnModifier.toSystemValue(columnModifier));
- WritableUtils.writeVInt(output, arraySize == null ? -1 : arraySize);
- }
@Override
public int hashCode() {
@@ -204,4 +163,57 @@ public class PColumnImpl implements PColumn {
public Integer getArraySize() {
return arraySize;
}
+
+ /**
+ * Create a PColumn instance from PBed PColumn instance
+ * @param column
+ */
+ public static PColumn createFromProto(PTableProtos.PColumn column) {
+ byte[] columnNameBytes = column.getColumnNameBytes().toByteArray();
+ PName columnName = PNameFactory.newName(columnNameBytes);
+ PName familyName = null;
+ if (column.hasFamilyNameBytes()) {
+ familyName = PNameFactory.newName(column.getFamilyNameBytes().toByteArray());
+ }
+ PDataType dataType = PDataType.fromSqlTypeName(column.getDataType());
+ Integer maxLength = null;
+ if (column.hasMaxLength()) {
+ maxLength = column.getMaxLength();
+ }
+ Integer scale = null;
+ if (column.hasScale()) {
+ scale = column.getScale();
+ }
+ boolean nullable = column.getNullable();
+ int position = column.getPosition();
+ ColumnModifier columnModifier = ColumnModifier.fromSystemValue(column.getColumnModifier());
+ Integer arraySize = null;
+ if(column.hasArraySize()){
+ arraySize = column.getArraySize();
+ }
+ return new PColumnImpl(columnName, familyName, dataType, maxLength, scale, nullable, position,
+ columnModifier, arraySize);
+ }
+
+ public static PTableProtos.PColumn toProto(PColumn column) {
+ PTableProtos.PColumn.Builder builder = PTableProtos.PColumn.newBuilder();
+ builder.setColumnNameBytes(HBaseZeroCopyByteString.wrap(column.getName().getBytes()));
+ if (column.getFamilyName() != null) {
+ builder.setFamilyNameBytes(HBaseZeroCopyByteString.wrap(column.getFamilyName().getBytes()));
+ }
+ builder.setDataType(column.getDataType().getSqlTypeName());
+ if (column.getMaxLength() != null) {
+ builder.setMaxLength(column.getMaxLength());
+ }
+ if (column.getScale() != null) {
+ builder.setScale(column.getScale());
+ }
+ builder.setNullable(column.isNullable());
+ builder.setPosition(column.getPosition());
+ builder.setColumnModifier(ColumnModifier.toSystemValue(column.getColumnModifier()));
+ if(column.getArraySize() != null){
+ builder.setArraySize(column.getArraySize());
+ }
+ return builder.build();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
index eeffc4c..3e0e1cb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
@@ -35,7 +35,7 @@ import org.apache.phoenix.schema.stat.PTableStats;
*
* @since 0.1
*/
-public interface PTable extends Writable {
+public interface PTable {
public static final long INITIAL_SEQ_NUM = 0;
public static final String IS_IMMUTABLE_ROWS_PROP_NAME = "IMMUTABLE_ROWS";
public static final boolean DEFAULT_DISABLE_WAL = false;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index f2a3e76..3827c6b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -24,8 +24,6 @@ import static org.apache.phoenix.client.KeyValueBuilder.deleteQuietly;
import static org.apache.phoenix.query.QueryConstants.SEPARATOR_BYTE;
import static org.apache.phoenix.schema.SaltingUtil.SALTING_COLUMN;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -34,18 +32,21 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.WritableUtils;
import org.apache.phoenix.client.KeyValueBuilder;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
import org.apache.phoenix.index.IndexMaintainer;
+import org.apache.phoenix.protobuf.ProtobufUtil;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.RowKeySchema.RowKeySchemaBuilder;
import org.apache.phoenix.schema.stat.PTableStats;
@@ -63,7 +64,7 @@ import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-
+import com.google.protobuf.HBaseZeroCopyByteString;
/**
*
@@ -543,13 +544,14 @@ public class PTableImpl implements PTable {
}
private void removeIfPresent(Mutation m, byte[] family, byte[] qualifier) {
- Map<byte[],List<KeyValue>> familyMap = m.getFamilyMap();
- List<KeyValue> kvs = familyMap.get(family);
+ Map<byte[],List<Cell>> familyMap = m.getFamilyCellMap();
+ List<Cell> kvs = familyMap.get(family);
if (kvs != null) {
- Iterator<KeyValue> iterator = kvs.iterator();
+ Iterator<Cell> iterator = kvs.iterator();
while (iterator.hasNext()) {
- KeyValue kv = iterator.next();
- if (Bytes.compareTo(kv.getQualifier(), qualifier) == 0) {
+ Cell kv = iterator.next();
+ if (Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(),
+ qualifier, 0, qualifier.length) == 0) {
iterator.remove();
}
}
@@ -591,16 +593,18 @@ public class PTableImpl implements PTable {
}
}
- @SuppressWarnings("deprecation")
@Override
public void delete() {
newMutations();
// FIXME: the version of the Delete constructor without the lock args was introduced
// in 0.94.4, thus if we try to use it here we can no longer use the 0.94.2 version
// of the client.
- Delete delete = new Delete(key,ts,null);
+ Delete delete = new Delete(key,ts);
deleteRow = delete;
- deleteRow.setWriteToWAL(!isWALDisabled());
+ // No need to write to the WAL for indexes
+ if (PTableImpl.this.getType() == PTableType.INDEX) {
+ deleteRow.setDurability(Durability.SKIP_WAL);
+ }
}
}
@@ -644,126 +648,6 @@ public class PTableImpl implements PTable {
}
@Override
- public void readFields(DataInput input) throws IOException {
- byte[] schemaNameBytes = Bytes.readByteArray(input);
- byte[] tableNameBytes = Bytes.readByteArray(input);
- PName schemaName = PNameFactory.newName(schemaNameBytes);
- PName tableName = PNameFactory.newName(tableNameBytes);
- PTableType tableType = PTableType.values()[WritableUtils.readVInt(input)];
- PIndexState indexState = null;
- if (tableType == PTableType.INDEX) {
- int ordinal = WritableUtils.readVInt(input);
- if (ordinal >= 0) {
- indexState = PIndexState.values()[ordinal];
- }
- }
- long sequenceNumber = WritableUtils.readVLong(input);
- long timeStamp = input.readLong();
- byte[] pkNameBytes = Bytes.readByteArray(input);
- PName pkName = pkNameBytes.length == 0 ? null : PNameFactory.newName(pkNameBytes);
- Integer bucketNum = WritableUtils.readVInt(input);
- int nColumns = WritableUtils.readVInt(input);
- List<PColumn> columns = Lists.newArrayListWithExpectedSize(nColumns);
- for (int i = 0; i < nColumns; i++) {
- PColumn column = new PColumnImpl();
- column.readFields(input);
- columns.add(column);
- }
- int nIndexes = WritableUtils.readVInt(input);
- List<PTable> indexes = Lists.newArrayListWithExpectedSize(nIndexes);
- for (int i = 0; i < nIndexes; i++) {
- PTable index = new PTableImpl();
- index.readFields(input);
- indexes.add(index);
- }
- boolean isImmutableRows = input.readBoolean();
- Map<String, byte[][]> guidePosts = new HashMap<String, byte[][]>();
- int size = WritableUtils.readVInt(input);
- for (int i=0; i<size; i++) {
- String key = WritableUtils.readString(input);
- int valueSize = WritableUtils.readVInt(input);
- byte[][] value = new byte[valueSize][];
- for (int j=0; j<valueSize; j++) {
- value[j] = Bytes.readByteArray(input);
- }
- guidePosts.put(key, value);
- }
- byte[] dataTableNameBytes = Bytes.readByteArray(input);
- PName dataTableName = dataTableNameBytes.length == 0 ? null : PNameFactory.newName(dataTableNameBytes);
- byte[] defaultFamilyNameBytes = Bytes.readByteArray(input);
- PName defaultFamilyName = defaultFamilyNameBytes.length == 0 ? null : PNameFactory.newName(defaultFamilyNameBytes);
- boolean disableWAL = input.readBoolean();
- boolean multiTenant = input.readBoolean();
- ViewType viewType = null;
- String viewStatement = null;
- List<PName> physicalNames = Collections.emptyList();
- if (tableType == PTableType.VIEW) {
- viewType = ViewType.fromSerializedValue(input.readByte());
- byte[] viewStatementBytes = Bytes.readByteArray(input);
- viewStatement = viewStatementBytes.length == 0 ? null : (String)PDataType.VARCHAR.toObject(viewStatementBytes);
- int nPhysicalNames = WritableUtils.readVInt(input);
- physicalNames = Lists.newArrayListWithExpectedSize(nPhysicalNames);
- for (int i = 0; i < nPhysicalNames; i++) {
- byte[] physicalNameBytes = Bytes.readByteArray(input);
- physicalNames.add(PNameFactory.newName(physicalNameBytes));
- }
- }
- PTableStats stats = new PTableStatsImpl(guidePosts);
- try {
- init(schemaName, tableName, tableType, indexState, timeStamp, sequenceNumber, pkName,
- bucketNum.equals(NO_SALTING) ? null : bucketNum, columns, stats, dataTableName,
- indexes, isImmutableRows, physicalNames, defaultFamilyName,
- viewStatement, disableWAL, multiTenant, viewType);
- } catch (SQLException e) {
- throw new RuntimeException(e); // Impossible
- }
- }
-
- @Override
- public void write(DataOutput output) throws IOException {
- Bytes.writeByteArray(output, schemaName.getBytes());
- Bytes.writeByteArray(output, tableName.getBytes());
- WritableUtils.writeVInt(output, type.ordinal());
- if (type == PTableType.INDEX) {
- WritableUtils.writeVInt(output, state == null ? -1 : state.ordinal());
- }
- WritableUtils.writeVLong(output, sequenceNumber);
- output.writeLong(timeStamp);
- Bytes.writeByteArray(output, pkName == null ? ByteUtil.EMPTY_BYTE_ARRAY : pkName.getBytes());
- int offset = 0, nColumns = allColumns.size();
- if (bucketNum == null) {
- WritableUtils.writeVInt(output, NO_SALTING);
- } else {
- offset = 1;
- nColumns--;
- WritableUtils.writeVInt(output, bucketNum);
- }
- WritableUtils.writeVInt(output, nColumns);
- for (int i = offset; i < allColumns.size(); i++) {
- PColumn column = allColumns.get(i);
- column.write(output);
- }
- WritableUtils.writeVInt(output, indexes.size());
- for (PTable index: indexes) {
- index.write(output);
- }
- output.writeBoolean(isImmutableRows);
- stats.write(output);
- Bytes.writeByteArray(output, parentTableName == null ? ByteUtil.EMPTY_BYTE_ARRAY : parentTableName.getBytes());
- Bytes.writeByteArray(output, defaultFamilyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : defaultFamilyName.getBytes());
- output.writeBoolean(disableWAL);
- output.writeBoolean(multiTenant);
- if (type == PTableType.VIEW) {
- output.writeByte(viewType.getSerializedValue());
- Bytes.writeByteArray(output, viewStatement == null ? ByteUtil.EMPTY_BYTE_ARRAY : PDataType.VARCHAR.toBytes(viewStatement));
- WritableUtils.writeVInt(output, physicalNames.size());
- for (int i = 0; i < physicalNames.size(); i++) {
- Bytes.writeByteArray(output, physicalNames.get(i).getBytes());
- }
- }
- }
-
- @Override
public PColumn getPKColumn(String name) throws ColumnNotFoundException {
List<PColumn> columns = columnsByName.get(name);
int size = columns.size();
@@ -862,4 +746,140 @@ public class PTableImpl implements PTable {
public boolean isWALDisabled() {
return disableWAL;
}
+
+ /**
+ * Construct a PTable instance from ProtoBuffered PTable instance
+ * @param table
+ */
+ public static PTable createFromProto(PTableProtos.PTable table) {
+ PName schemaName = PNameFactory.newName(table.getSchemaNameBytes().toByteArray());
+ PName tableName = PNameFactory.newName(table.getTableNameBytes().toByteArray());
+ PTableType tableType = PTableType.values()[table.getTableType().ordinal()];
+ PIndexState indexState = null;
+ if (table.hasIndexState()) {
+ indexState = PIndexState.fromSerializedValue(table.getIndexState());
+ }
+ long sequenceNumber = table.getSequenceNumber();
+ long timeStamp = table.getTimeStamp();
+ PName pkName = null;
+ if (table.hasPkNameBytes()) {
+ pkName = PNameFactory.newName(table.getPkNameBytes().toByteArray());
+ }
+ int bucketNum = table.getBucketNum();
+ List<PColumn> columns = Lists.newArrayListWithExpectedSize(table.getColumnsCount());
+ for (PTableProtos.PColumn curPColumnProto : table.getColumnsList()) {
+ columns.add(PColumnImpl.createFromProto(curPColumnProto));
+ }
+ List<PTable> indexes = Lists.newArrayListWithExpectedSize(table.getIndexesCount());
+ for (PTableProtos.PTable curPTableProto : table.getIndexesList()) {
+ indexes.add(createFromProto(curPTableProto));
+ }
+ boolean isImmutableRows = table.getIsImmutableRows();
+ Map<String, byte[][]> guidePosts = new HashMap<String, byte[][]>();
+ for (PTableProtos.PTableStats pTableStatsProto : table.getGuidePostsList()) {
+ byte[][] value = new byte[pTableStatsProto.getValuesCount()][];
+ for (int j = 0; j < pTableStatsProto.getValuesCount(); j++) {
+ value[j] = pTableStatsProto.getValues(j).toByteArray();
+ }
+ guidePosts.put(pTableStatsProto.getKey(), value);
+ }
+ PName dataTableName = null;
+ if (table.hasDataTableNameBytes()) {
+ dataTableName = PNameFactory.newName(table.getDataTableNameBytes().toByteArray());
+ }
+ PName defaultFamilyName = null;
+ if (table.hasDefaultFamilyName()) {
+ defaultFamilyName = PNameFactory.newName(table.getDefaultFamilyName().toByteArray());
+ }
+ boolean disableWAL = table.getDisableWAL();
+ boolean multiTenant = table.getMultiTenant();
+ ViewType viewType = null;
+ String viewStatement = null;
+ List<PName> physicalNames = Collections.emptyList();
+ if (tableType == PTableType.VIEW) {
+ viewType = ViewType.fromSerializedValue(table.getViewType().toByteArray()[0]);
+ if(table.hasViewStatement()){
+ viewStatement = (String)PDataType.VARCHAR.toObject(table.getViewStatement().toByteArray());
+ physicalNames = Lists.newArrayListWithExpectedSize(table.getPhysicalNamesCount());
+ for(int i = 0; i < table.getPhysicalNamesCount(); i++){
+ physicalNames.add(PNameFactory.newName(table.getPhysicalNames(i).toByteArray()));
+ }
+ }
+ }
+ PTableStats stats = new PTableStatsImpl(guidePosts);
+ try {
+ PTableImpl result = new PTableImpl();
+ result.init(schemaName, tableName, tableType, indexState, timeStamp, sequenceNumber, pkName,
+ (bucketNum == NO_SALTING) ? null : bucketNum, columns, stats, dataTableName,indexes, isImmutableRows,
+ physicalNames, defaultFamilyName, viewStatement, disableWAL, multiTenant, viewType);
+ return result;
+ } catch (SQLException e) {
+ throw new RuntimeException(e); // Impossible
+ }
+ }
+
+ public static PTableProtos.PTable toProto(PTable table) {
+ PTableProtos.PTable.Builder builder = PTableProtos.PTable.newBuilder();
+ builder.setSchemaNameBytes(HBaseZeroCopyByteString.wrap(table.getSchemaName().getBytes()));
+ builder.setTableNameBytes(HBaseZeroCopyByteString.wrap(table.getTableName().getBytes()));
+ builder.setTableType(ProtobufUtil.toPTableTypeProto(table.getType()));
+ if (table.getType() == PTableType.INDEX && table.getIndexState() != null) {
+ builder.setIndexState(table.getIndexState().getSerializedValue());
+ }
+ builder.setSequenceNumber(table.getSequenceNumber());
+ builder.setTimeStamp(table.getTimeStamp());
+ PName tmp = table.getPKName();
+ if (tmp != null) {
+ builder.setPkNameBytes(HBaseZeroCopyByteString.wrap(tmp.getBytes()));
+ }
+ Integer bucketNum = table.getBucketNum();
+ int offset = 0;
+ if(bucketNum == null){
+ builder.setBucketNum(NO_SALTING);
+ } else {
+ offset = 1;
+ builder.setBucketNum(bucketNum);
+ }
+ List<PColumn> columns = table.getColumns();
+ int columnSize = columns.size();
+ for (int i = offset; i < columnSize; i++) {
+ PColumn column = columns.get(i);
+ builder.addColumns(PColumnImpl.toProto(column));
+ }
+ List<PTable> indexes = table.getIndexes();
+ for (PTable curIndex : indexes) {
+ builder.addIndexes(toProto(curIndex));
+ }
+ builder.setIsImmutableRows(table.isImmutableRows());
+
+ // build stats
+ Map<String, byte[][]> statsMap = table.getTableStats().getGuidePosts();
+ if(statsMap != null) {
+ for (Entry<String, byte[][]> entry : statsMap.entrySet()) {
+ PTableProtos.PTableStats.Builder statsBuilder = PTableProtos.PTableStats.newBuilder();
+ statsBuilder.setKey(entry.getKey());
+ for (byte[] curVal : entry.getValue()) {
+ statsBuilder.addValues(HBaseZeroCopyByteString.wrap(curVal));
+ }
+ builder.addGuidePosts(statsBuilder.build());
+ }
+ }
+ if (table.getParentName() != null) {
+ builder.setDataTableNameBytes(HBaseZeroCopyByteString.wrap(table.getParentTableName().getBytes()));
+ }
+ if (table.getDefaultFamilyName()!= null) {
+ builder.setDefaultFamilyName(HBaseZeroCopyByteString.wrap(table.getDefaultFamilyName().getBytes()));
+ }
+ builder.setDisableWAL(table.isWALDisabled());
+ builder.setMultiTenant(table.isMultiTenant());
+ if(table.getType() == PTableType.VIEW){
+ builder.setViewType(HBaseZeroCopyByteString.wrap(new byte[]{table.getViewType().getSerializedValue()}));
+ builder.setViewStatement(HBaseZeroCopyByteString.wrap(PDataType.VARCHAR.toBytes(table.getViewStatement())));
+ for (int i = 0; i < table.getPhysicalNames().size(); i++) {
+ builder.addPhysicalNames(HBaseZeroCopyByteString.wrap(table.getPhysicalNames().get(i).getBytes()));
+ }
+ }
+
+ return builder.build();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java
index f88475d..9f95a30 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java
@@ -13,14 +13,13 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
-
-import com.google.common.collect.Lists;
import org.apache.phoenix.coprocessor.MetaDataProtocol;
import org.apache.phoenix.coprocessor.SequenceRegionObserver;
import org.apache.phoenix.exception.SQLExceptionCode;
@@ -31,6 +30,8 @@ import org.apache.phoenix.util.ByteUtil;
import org.apache.phoenix.util.KeyValueUtil;
import org.apache.phoenix.util.SchemaUtil;
+import com.google.common.collect.Lists;
+
public class Sequence {
public static final int SUCCESS = 0;
@@ -143,9 +144,9 @@ public class Sequence {
byte[] opBuf = new byte[] {(byte)SequenceRegionObserver.Op.RETURN_SEQUENCE.ordinal()};
append.setAttribute(SequenceRegionObserver.OPERATION_ATTRIB, opBuf);
append.setAttribute(SequenceRegionObserver.CURRENT_VALUE_ATTRIB, PDataType.LONG.toBytes(value.nextValue));
- Map<byte[], List<KeyValue>> familyMap = append.getFamilyMap();
- familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<KeyValue>asList(
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CURRENT_VALUE_BYTES, value.timestamp, PDataType.LONG.toBytes(value.currentValue))
+ Map<byte[], List<Cell>> familyMap = append.getFamilyCellMap();
+ familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<Cell>asList(
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CURRENT_VALUE_BYTES, value.timestamp, PDataType.LONG.toBytes(value.currentValue))
));
return append;
}
@@ -172,9 +173,9 @@ public class Sequence {
// from the cache that we shouldn't have which will cause a gap in sequence values.
// In that case, we might get an error that a curr value was done on a sequence
// before a next val was. Not sure how to prevent that.
- if (result.raw().length == 1) {
- KeyValue errorKV = result.raw()[0];
- int errorCode = PDataType.INTEGER.getCodec().decodeInt(errorKV.getBuffer(), errorKV.getValueOffset(), null);
+ if (result.rawCells().length == 1) {
+ Cell errorKV = result.rawCells()[0];
+ int errorCode = PDataType.INTEGER.getCodec().decodeInt(errorKV.getValueArray(), errorKV.getValueOffset(), null);
SQLExceptionCode code = SQLExceptionCode.fromErrorCode(errorCode);
// TODO: We could have the server return the timestamps of the
// delete markers and we could insert them here, but this seems
@@ -227,28 +228,28 @@ public class Sequence {
}
public static KeyValue getCurrentValueKV(Result r) {
- KeyValue[] kvs = r.raw();
+ Cell[] kvs = r.rawCells();
assert(kvs.length == SEQUENCE_KEY_VALUES);
- return kvs[CURRENT_VALUE_INDEX];
+ return org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(kvs[CURRENT_VALUE_INDEX]);
}
public static KeyValue getIncrementByKV(Result r) {
- KeyValue[] kvs = r.raw();
+ Cell[] kvs = r.rawCells();
assert(kvs.length == SEQUENCE_KEY_VALUES);
- return kvs[INCREMENT_BY_INDEX];
+ return org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(kvs[INCREMENT_BY_INDEX]);
}
public static KeyValue getCacheSizeKV(Result r) {
- KeyValue[] kvs = r.raw();
+ Cell[] kvs = r.rawCells();
assert(kvs.length == SEQUENCE_KEY_VALUES);
- return kvs[CACHE_SIZE_INDEX];
+ return org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(kvs[CACHE_SIZE_INDEX]);
}
public static Result replaceCurrentValueKV(Result r, KeyValue currentValueKV) {
- KeyValue[] kvs = r.raw();
- List<KeyValue> newkvs = Lists.newArrayList(kvs);
+ Cell[] kvs = r.rawCells();
+ List<Cell> newkvs = Lists.newArrayList(kvs);
newkvs.set(CURRENT_VALUE_INDEX, currentValueKV);
- return new Result(newkvs);
+ return Result.create(newkvs);
}
private static final class SequenceValue {
@@ -286,20 +287,20 @@ public class Sequence {
KeyValue incrementByKV = getIncrementByKV(r);
KeyValue cacheSizeKV = getCacheSizeKV(r);
timestamp = currentValueKV.getTimestamp();
- nextValue = PDataType.LONG.getCodec().decodeLong(currentValueKV.getBuffer(), currentValueKV.getValueOffset(), null);
- incrementBy = PDataType.LONG.getCodec().decodeLong(incrementByKV.getBuffer(), incrementByKV.getValueOffset(), null);
- cacheSize = PDataType.INTEGER.getCodec().decodeInt(cacheSizeKV.getBuffer(), cacheSizeKV.getValueOffset(), null);
+ nextValue = PDataType.LONG.getCodec().decodeLong(currentValueKV.getValueArray(), currentValueKV.getValueOffset(), null);
+ incrementBy = PDataType.LONG.getCodec().decodeLong(incrementByKV.getValueArray(), incrementByKV.getValueOffset(), null);
+ cacheSize = PDataType.INTEGER.getCodec().decodeInt(cacheSizeKV.getValueArray(), cacheSizeKV.getValueOffset(), null);
currentValue = nextValue - incrementBy * cacheSize;
}
}
public boolean returnValue(Result result) throws SQLException {
- KeyValue statusKV = result.raw()[0];
+ Cell statusKV = result.rawCells()[0];
if (statusKV.getValueLength() == 0) { // No error, but unable to return sequence values
return false;
}
long timestamp = statusKV.getTimestamp();
- int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getBuffer(), statusKV.getValueOffset(), null);
+ int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getValueArray(), statusKV.getValueOffset(), null);
if (statusCode == SUCCESS) { // Success - update nextValue down to currentValue
SequenceValue value = findSequenceValue(timestamp);
if (value == null) {
@@ -327,22 +328,22 @@ public class Sequence {
if (timestamp != HConstants.LATEST_TIMESTAMP) {
append.setAttribute(SequenceRegionObserver.MAX_TIMERANGE_ATTRIB, Bytes.toBytes(timestamp));
}
- Map<byte[], List<KeyValue>> familyMap = append.getFamilyMap();
+ Map<byte[], List<Cell>> familyMap = append.getFamilyCellMap();
byte[] startWithBuf = PDataType.LONG.toBytes(startWith);
- familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<KeyValue>asList(
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timestamp, ByteUtil.EMPTY_BYTE_ARRAY),
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CURRENT_VALUE_BYTES, timestamp, startWithBuf),
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.START_WITH_BYTES, timestamp, startWithBuf),
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.INCREMENT_BY_BYTES, timestamp, PDataType.LONG.toBytes(incrementBy)),
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CACHE_SIZE_BYTES, timestamp, PDataType.INTEGER.toBytes(cacheSize))
+ familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<Cell>asList(
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timestamp, ByteUtil.EMPTY_BYTE_ARRAY),
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CURRENT_VALUE_BYTES, timestamp, startWithBuf),
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.START_WITH_BYTES, timestamp, startWithBuf),
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.INCREMENT_BY_BYTES, timestamp, PDataType.LONG.toBytes(incrementBy)),
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, PhoenixDatabaseMetaData.CACHE_SIZE_BYTES, timestamp, PDataType.INTEGER.toBytes(cacheSize))
));
return append;
}
public long createSequence(Result result) throws SQLException {
- KeyValue statusKV = result.raw()[0];
+ Cell statusKV = result.rawCells()[0];
long timestamp = statusKV.getTimestamp();
- int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getBuffer(), statusKV.getValueOffset(), null);
+ int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getValueArray(), statusKV.getValueOffset(), null);
if (statusCode == 0) { // Success - add sequence value and return timestamp
SequenceValue value = new SequenceValue(timestamp);
insertSequenceValue(value);
@@ -362,16 +363,16 @@ public class Sequence {
if (timestamp != HConstants.LATEST_TIMESTAMP) {
append.setAttribute(SequenceRegionObserver.MAX_TIMERANGE_ATTRIB, Bytes.toBytes(timestamp));
}
- Map<byte[], List<KeyValue>> familyMap = append.getFamilyMap();
- familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<KeyValue>asList(
- KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timestamp, ByteUtil.EMPTY_BYTE_ARRAY)));
+ Map<byte[], List<Cell>> familyMap = append.getFamilyCellMap();
+ familyMap.put(PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, Arrays.<Cell>asList(
+ (Cell)KeyValueUtil.newKeyValue(key, PhoenixDatabaseMetaData.SEQUENCE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timestamp, ByteUtil.EMPTY_BYTE_ARRAY)));
return append;
}
public long dropSequence(Result result) throws SQLException {
- KeyValue statusKV = result.raw()[0];
+ Cell statusKV = result.rawCells()[0];
long timestamp = statusKV.getTimestamp();
- int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getBuffer(), statusKV.getValueOffset(), null);
+ int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getValueArray(), statusKV.getValueOffset(), null);
SQLExceptionCode code = statusCode == 0 ? null : SQLExceptionCode.fromErrorCode(statusCode);
if (code == null) {
// Insert delete marker so that point-in-time sequences work
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStats.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStats.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStats.java
index d34ec2d..98b8c66 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStats.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStats.java
@@ -21,6 +21,7 @@ package org.apache.phoenix.schema.stat;
import java.io.DataOutput;
import java.io.IOException;
+import java.util.Map;
import org.apache.hadoop.hbase.HRegionInfo;
@@ -43,5 +44,5 @@ public interface PTableStats {
*/
byte[][] getRegionGuidePosts(HRegionInfo region);
- void write(DataOutput output) throws IOException;
+ Map<String, byte[][]> getGuidePosts();
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java
index b7d5063..672518a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java
@@ -52,19 +52,11 @@ public class PTableStatsImpl implements PTableStats {
}
@Override
- public void write(DataOutput output) throws IOException {
- if (regionGuidePosts == null) {
- WritableUtils.writeVInt(output, 0);
- return;
- }
- WritableUtils.writeVInt(output, regionGuidePosts.size());
- for (Entry<String, byte[][]> entry : regionGuidePosts.entrySet()) {
- WritableUtils.writeString(output, entry.getKey());
- byte[][] value = entry.getValue();
- WritableUtils.writeVInt(output, value.length);
- for (int i=0; i<value.length; i++) {
- Bytes.writeByteArray(output, value[i]);
- }
- }
+ public Map<String, byte[][]> getGuidePosts(){
+ if(regionGuidePosts != null) {
+ return ImmutableMap.copyOf(regionGuidePosts);
+ }
+
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
index fefd435..3395f61 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
@@ -21,6 +21,7 @@ package org.apache.phoenix.schema.tuple;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -29,23 +30,23 @@ import org.apache.phoenix.util.KeyValueUtil;
public class MultiKeyValueTuple implements Tuple {
- private List<KeyValue> values;
+ private List<Cell> values;
- public MultiKeyValueTuple(List<KeyValue> values) {
+ public MultiKeyValueTuple(List<Cell> values) {
setKeyValues(values);
}
public MultiKeyValueTuple() {
}
- public void setKeyValues(List<KeyValue> values) {
+ public void setKeyValues(List<Cell> values) {
this.values = ImmutableList.copyOf(values);
}
@Override
public void getKey(ImmutableBytesWritable ptr) {
- KeyValue value = values.get(0);
- ptr.set(value.getBuffer(), value.getRowOffset(), value.getRowLength());
+ Cell value = values.get(0);
+ ptr.set(value.getRowArray(), value.getRowOffset(), value.getRowLength());
}
@Override
@@ -54,7 +55,7 @@ public class MultiKeyValueTuple implements Tuple {
}
@Override
- public KeyValue getValue(byte[] family, byte[] qualifier) {
+ public Cell getValue(byte[] family, byte[] qualifier) {
return KeyValueUtil.getColumnLatest(values, family, qualifier);
}
@@ -69,17 +70,17 @@ public class MultiKeyValueTuple implements Tuple {
}
@Override
- public KeyValue getValue(int index) {
+ public Cell getValue(int index) {
return values.get(index);
}
@Override
public boolean getValue(byte[] family, byte[] qualifier,
ImmutableBytesWritable ptr) {
- KeyValue kv = getValue(family, qualifier);
+ Cell kv = getValue(family, qualifier);
if (kv == null)
return false;
- ptr.set(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
+ ptr.set(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength());
return true;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/Tuple.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/Tuple.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/Tuple.java
index 419102d..5b492da 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/Tuple.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/Tuple.java
@@ -19,7 +19,7 @@
*/
package org.apache.phoenix.schema.tuple;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
/**
@@ -58,7 +58,7 @@ public interface Tuple {
* @return the KeyValue at the given index
* @throws IndexOutOfBoundsException if an invalid index is used
*/
- public KeyValue getValue(int index);
+ public Cell getValue(int index);
/***
* Get the KeyValue contained by the Tuple with the given family and
@@ -68,7 +68,7 @@ public interface Tuple {
* @return the KeyValue with the given family and qualifier name or
* null if not found.
*/
- public KeyValue getValue(byte [] family, byte [] qualifier);
+ public Cell getValue(byte [] family, byte [] qualifier);
/***
* Get the value byte array of the KeyValue contained by the Tuple with
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/CSVLoader.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVLoader.java
index d5b3c9e..9741874 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVLoader.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVLoader.java
@@ -194,7 +194,6 @@ public class CSVLoader {
* PDataType
*
* @param columns
- * @return
* @throws SQLException
*/
private ColumnInfo[] generateColumnInfo(List<String> columns)
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
index 5bd74d2..a30e704 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
@@ -24,16 +24,14 @@ import java.sql.SQLException;
import java.util.List;
import java.util.Map;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import com.google.common.collect.Lists;
import org.apache.hadoop.hbase.index.ValueGetter;
import org.apache.hadoop.hbase.index.covered.update.ColumnReference;
import org.apache.hadoop.hbase.index.util.ImmutableBytesPtr;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.client.KeyValueBuilder;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -46,6 +44,8 @@ import org.apache.phoenix.schema.PColumnFamily;
import org.apache.phoenix.schema.PDataType;
import org.apache.phoenix.schema.PTable;
+import com.google.common.collect.Lists;
+
public class IndexUtil {
public static final String INDEX_COLUMN_NAME_SEP = ":";
public static final byte[] INDEX_COLUMN_NAME_SEP_BYTES = Bytes.toBytes(INDEX_COLUMN_NAME_SEP);
@@ -166,17 +166,17 @@ public class IndexUtil {
if (isEmptyKeyValue(table, ref)) {
return null;
}
- Map<byte [], List<KeyValue>> familyMap = dataMutation.getFamilyMap();
+ Map<byte [], List<Cell>> familyMap = dataMutation.getFamilyCellMap();
byte[] family = ref.getFamily();
- List<KeyValue> kvs = familyMap.get(family);
+ List<Cell> kvs = familyMap.get(family);
if (kvs == null) {
return null;
}
byte[] qualifier = ref.getQualifier();
- for (KeyValue kv : kvs) {
- if (Bytes.compareTo(kv.getBuffer(), kv.getFamilyOffset(), kv.getFamilyLength(), family, 0, family.length) == 0 &&
- Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(), qualifier, 0, qualifier.length) == 0) {
- return new ImmutableBytesPtr(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
+ for (Cell kv : kvs) {
+ if (Bytes.compareTo(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(), family, 0, family.length) == 0 &&
+ Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), qualifier, 0, qualifier.length) == 0) {
+ return new ImmutableBytesPtr(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength());
}
}
return null;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
index 4e46397..bb56d02 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.client.Result;
@@ -74,6 +75,16 @@ public class KeyValueUtil {
ts, Type.Put,
value, valueOffset, valueLength);
}
+
+ public static KeyValue newKeyValue(byte[] key, int keyOffset, int keyLength, byte[] cf,
+ int cfOffset, int cfLength, byte[] cq, int cqOffset, int cqLength, long ts, byte[] value,
+ int valueOffset, int valueLength) {
+ return new KeyValue(key, keyOffset, keyLength,
+ cf, cfOffset, cfLength,
+ cq, cqOffset, cqLength,
+ ts, Type.Put,
+ value, valueOffset, valueLength);
+ }
public static KeyValue newKeyValue(byte[] key, byte[] cf, byte[] cq, long ts, byte[] value) {
return newKeyValue(key,cf,cq,ts,value,0,value.length);
@@ -89,12 +100,12 @@ public class KeyValueUtil {
* @param family
* @param qualifier
*/
- public static KeyValue getColumnLatest(List<KeyValue>kvs, byte[] family, byte[] qualifier) {
+ public static Cell getColumnLatest(List<Cell>kvs, byte[] family, byte[] qualifier) {
if (kvs.size() == 0) {
return null;
}
- KeyValue row = kvs.get(0);
- Comparator<KeyValue> comp = new SearchComparator(row.getBuffer(), row.getRowOffset(), row.getRowLength(), family, qualifier);
+ Cell row = kvs.get(0);
+ Comparator<Cell> comp = new SearchComparator(row.getRowArray(), row.getRowOffset(), row.getRowLength(), family, qualifier);
// pos === ( -(insertion point) - 1)
int pos = Collections.binarySearch(kvs, null, comp);
// never will exact match
@@ -106,12 +117,12 @@ public class KeyValueUtil {
return null; // doesn't exist
}
- KeyValue kv = kvs.get(pos);
- if (Bytes.compareTo(kv.getBuffer(), kv.getFamilyOffset(), kv.getFamilyLength(),
+ Cell kv = kvs.get(pos);
+ if (Bytes.compareTo(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(),
family, 0, family.length) != 0) {
return null;
}
- if (Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(),
+ if (Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(),
qualifier, 0, qualifier.length) != 0) {
return null;
}
@@ -124,7 +135,7 @@ public class KeyValueUtil {
* Making use of that saves instanceof checks, and allows us
* to inline the search term in the comparator
*/
- private static class SearchComparator implements Comparator<KeyValue> {
+ private static class SearchComparator implements Comparator<Cell> {
private final byte[] row;
private final byte[] family;
private final byte[] qualifier;
@@ -140,9 +151,9 @@ public class KeyValueUtil {
}
@Override
- public int compare(final KeyValue l, final KeyValue ignored) {
+ public int compare(final Cell l, final Cell ignored) {
assert ignored == null;
- final byte[] buf = l.getBuffer();
+ final byte[] buf = l.getRowArray();
final int rOff = l.getRowOffset();
final short rLen = l.getRowLength();
// row
@@ -151,15 +162,15 @@ public class KeyValueUtil {
return val;
}
// family
- final int fOff = l.getFamilyOffset(rLen);
- final byte fLen = l.getFamilyLength(fOff);
- val = Bytes.compareTo(buf, fOff, fLen, family, 0, family.length);
+ final int fOff = l.getFamilyOffset();
+ final byte fLen = l.getFamilyLength();
+ val = Bytes.compareTo(l.getFamilyArray(), fOff, fLen, family, 0, family.length);
if (val != 0) {
return val;
}
// qualifier
- val = Bytes.compareTo(buf, l.getQualifierOffset(fOff),
- l.getQualifierLength(rLen, fLen), qualifier, 0, qualifier.length);
+ val = Bytes.compareTo(l.getQualifierArray(), l.getQualifierOffset(),
+ l.getQualifierLength(), qualifier, 0, qualifier.length);
if (val != 0) {
return val;
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
index 3e78726..5c92aed 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
@@ -24,6 +24,7 @@ import static org.apache.phoenix.util.SchemaUtil.getVarChars;
import java.util.Collection;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
@@ -151,11 +152,11 @@ public class MetaDataUtil {
}
public static long getSequenceNumber(Mutation tableMutation) {
- List<KeyValue> kvs = tableMutation.getFamilyMap().get(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES);
+ List<Cell> kvs = tableMutation.getFamilyCellMap().get(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES);
if (kvs != null) {
- for (KeyValue kv : kvs) { // list is not ordered, so search. TODO: we could potentially assume the position
- if (Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(), PhoenixDatabaseMetaData.TABLE_SEQ_NUM_BYTES, 0, PhoenixDatabaseMetaData.TABLE_SEQ_NUM_BYTES.length) == 0) {
- return PDataType.LONG.getCodec().decodeLong(kv.getBuffer(), kv.getValueOffset(), null);
+ for (Cell kv : kvs) { // list is not ordered, so search. TODO: we could potentially assume the position
+ if (Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), PhoenixDatabaseMetaData.TABLE_SEQ_NUM_BYTES, 0, PhoenixDatabaseMetaData.TABLE_SEQ_NUM_BYTES.length) == 0) {
+ return PDataType.LONG.getCodec().decodeLong(kv.getValueArray(), kv.getValueOffset(), null);
}
}
}
@@ -167,8 +168,8 @@ public class MetaDataUtil {
}
public static PTableType getTableType(List<Mutation> tableMetaData) {
- KeyValue kv = getMutationKeyValue(getPutOnlyTableHeaderRow(tableMetaData), PhoenixDatabaseMetaData.TABLE_TYPE_BYTES);
- return kv == null ? null : PTableType.fromSerializedValue(kv.getBuffer()[kv.getValueOffset()]);
+ Cell kv = getMutationKeyValue(getPutOnlyTableHeaderRow(tableMetaData), PhoenixDatabaseMetaData.TABLE_TYPE_BYTES);
+ return kv == null ? null : PTableType.fromSerializedValue(kv.getValueArray()[kv.getValueOffset()]);
}
public static long getParentSequenceNumber(List<Mutation> tableMetaData) {
@@ -186,11 +187,11 @@ public class MetaDataUtil {
}
private static KeyValue getMutationKeyValue(Mutation headerRow, byte[] key) {
- List<KeyValue> kvs = headerRow.getFamilyMap().get(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES);
+ List<Cell> kvs = headerRow.getFamilyCellMap().get(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES);
if (kvs != null) {
- for (KeyValue kv : kvs) {
- if (Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(), key, 0,
- key.length) == 0) { return kv; }
+ for (Cell kv : kvs) {
+ if (Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), key, 0,
+ key.length) == 0) { return org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(kv); }
}
}
return null;
@@ -217,7 +218,7 @@ public class MetaDataUtil {
}
public static long getClientTimeStamp(Mutation m) {
- Collection<List<KeyValue>> kvs = m.getFamilyMap().values();
+ Collection<List<Cell>> kvs = m.getFamilyCellMap().values();
// Empty if Mutation is a Delete
// TODO: confirm that Delete timestamp is reset like Put
return kvs.isEmpty() ? m.getTimeStamp() : kvs.iterator().next().get(0).getTimestamp();
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index 8b35935..d7d8e5d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -298,9 +299,9 @@ public class PhoenixRuntime {
Pair<byte[],List<Mutation>> pair = iterator.next();
List<KeyValue> keyValues = Lists.newArrayListWithExpectedSize(pair.getSecond().size() * 5); // Guess-timate 5 key values per row
for (Mutation mutation : pair.getSecond()) {
- for (List<KeyValue> keyValueList : mutation.getFamilyMap().values()) {
- for (KeyValue keyValue : keyValueList) {
- keyValues.add(keyValue);
+ for (List<Cell> keyValueList : mutation.getFamilyCellMap().values()) {
+ for (Cell keyValue : keyValueList) {
+ keyValues.add(org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(keyValue));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/ResultUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ResultUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ResultUtil.java
index 7c697d6..3e25e16 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ResultUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ResultUtil.java
@@ -19,9 +19,12 @@
*/
package org.apache.phoenix.util;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -43,6 +46,20 @@ public class ResultUtil {
private ResultUtil() {
}
+ public static Result toResult(ImmutableBytesWritable bytes) {
+ byte [] buf = bytes.get();
+ int offset = bytes.getOffset();
+ int finalOffset = bytes.getSize() + offset;
+ List<Cell> kvs = new ArrayList<Cell>();
+ while(offset < finalOffset) {
+ int keyLength = Bytes.toInt(buf, offset);
+ offset += Bytes.SIZEOF_INT;
+ kvs.add(new KeyValue(buf, offset, keyLength));
+ offset += keyLength;
+ }
+ return Result.create(kvs);
+ }
+
/**
* Return a pointer into a potentially much bigger byte buffer that points to the key of a Result.
* @param r
@@ -92,11 +109,10 @@ public class ResultUtil {
/**
* Get the offset into the Result byte array to the key.
* @param r
- * @return
*/
static int getKeyOffset(Result r) {
- // Special case for when Result was instantiated via KeyValue array (no bytes in that case) versus returned from a scanner
- return (r.getBytes() == null ? r.raw()[0].getOffset() : (r.getBytes().getOffset() + Bytes.SIZEOF_INT /* KV length in Result */)) + KeyValue.ROW_OFFSET /* key offset in KV */ + Bytes.SIZEOF_SHORT /* key length */;
+ KeyValue firstKV = org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(r.rawCells()[0]);
+ return firstKV.getOffset();
}
static int getKeyLength(Result r) {
@@ -105,11 +121,8 @@ public class ResultUtil {
}
static byte[] getRawBytes(Result r) {
- // Handle special case for when Result was instantiated via KeyValue array (no bytes in that case) versus returned from a scanner
- ImmutableBytesWritable rPtr = r.getBytes();
- if (rPtr != null)
- return rPtr.get();
- return r.raw()[0].getBuffer();
+ KeyValue firstKV = org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(r.rawCells()[0]);
+ return firstKV.getBuffer();
}
public static int compareKeys(Result r1, Result r2) {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
index c4ca7d6..d0ab434 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
@@ -54,8 +54,6 @@ import org.apache.phoenix.schema.RowKeySchema.RowKeySchemaBuilder;
import org.apache.phoenix.schema.SaltingUtil;
import org.apache.phoenix.schema.ValueSchema.Field;
-
-
/**
*
* Static class for various schema-related utilities
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
index 99850b9..76cf186 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -44,6 +44,10 @@ public class ServerUtil {
}
public static void throwIOException(String msg, Throwable t) throws IOException {
+ throw createIOException(msg, t);
+ }
+
+ public static IOException createIOException(String msg, Throwable t) {
// First unwrap SQLExceptions if it's root cause is an IOException.
if (t instanceof SQLException) {
Throwable cause = t.getCause();
@@ -53,18 +57,18 @@ public class ServerUtil {
}
// Throw immediately if DoNotRetryIOException
if (t instanceof DoNotRetryIOException) {
- throw (DoNotRetryIOException)t;
+ return (DoNotRetryIOException) t;
} else if (t instanceof IOException) {
// If the IOException does not wrap any exception, then bubble it up.
Throwable cause = t.getCause();
if (cause == null || cause instanceof IOException) {
- throw (IOException)t;
+ return (IOException) t;
}
// Else assume it's been wrapped, so throw as DoNotRetryIOException to prevent client hanging while retrying
- throw new DoNotRetryIOException(t.getMessage(), cause);
+ return new DoNotRetryIOException(t.getMessage(), cause);
} else if (t instanceof SQLException) {
// If it's already an SQLException, construct an error message so we can parse and reconstruct on the client side.
- throw new DoNotRetryIOException(constructSQLErrorMessage((SQLException) t, msg), t);
+ return new DoNotRetryIOException(constructSQLErrorMessage((SQLException) t, msg), t);
} else {
// Not a DoNotRetryIOException, IOException or SQLException. Map the exception type to a general SQLException
// and construct the error message so it can be reconstruct on the client side.
@@ -72,9 +76,9 @@ public class ServerUtil {
// If no mapping exists, rethrow it as a generic exception.
SQLExceptionCode code = errorcodeMap.get(t.getClass());
if (code == null) {
- throw new DoNotRetryIOException(msg + ": " + t.getMessage(), t);
+ return new DoNotRetryIOException(msg + ": " + t.getMessage(), t);
} else {
- throw new DoNotRetryIOException(constructSQLErrorMessage(code, t, msg), t);
+ return new DoNotRetryIOException(constructSQLErrorMessage(code, t, msg), t);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/main/java/org/apache/phoenix/util/TupleUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/TupleUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/TupleUtil.java
index dc42d8c..d4ae7b7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/TupleUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/TupleUtil.java
@@ -26,6 +26,7 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.List;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -79,10 +80,10 @@ public class TupleUtil {
*/
public static void getAggregateValue(Tuple r, ImmutableBytesWritable ptr) {
if (r.size() == 1) {
- KeyValue kv = r.getValue(0); // Just one KV for aggregation
- if (Bytes.compareTo(SINGLE_COLUMN_FAMILY, 0, SINGLE_COLUMN_FAMILY.length, kv.getBuffer(), kv.getFamilyOffset(), kv.getFamilyLength()) == 0) {
- if (Bytes.compareTo(SINGLE_COLUMN, 0, SINGLE_COLUMN.length, kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength()) == 0) {
- ptr.set(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
+ Cell kv = r.getValue(0); // Just one KV for aggregation
+ if (Bytes.compareTo(SINGLE_COLUMN_FAMILY, 0, SINGLE_COLUMN_FAMILY.length, kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength()) == 0) {
+ if (Bytes.compareTo(SINGLE_COLUMN, 0, SINGLE_COLUMN.length, kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()) == 0) {
+ ptr.set(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength());
return;
}
}
@@ -139,14 +140,14 @@ public class TupleUtil {
public static int write(Tuple result, DataOutput out) throws IOException {
int size = 0;
for(int i = 0; i < result.size(); i++) {
- KeyValue kv = result.getValue(i);
+ KeyValue kv = org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(result.getValue(i));
size += kv.getLength();
size += Bytes.SIZEOF_INT; // kv.getLength
}
WritableUtils.writeVInt(out, size);
for(int i = 0; i < result.size(); i++) {
- KeyValue kv = result.getValue(i);
+ KeyValue kv = org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(result.getValue(i));
out.writeInt(kv.getLength());
out.write(kv.getBuffer(), kv.getOffset(), kv.getLength());
}
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/IndexTestingUtils.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/IndexTestingUtils.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/IndexTestingUtils.java
index 6acb8bc..78ee897 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/IndexTestingUtils.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/IndexTestingUtils.java
@@ -35,7 +35,7 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec;
-import org.apache.hadoop.hbase.regionserver.wal.WALEditCodec;
+import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import org.apache.hadoop.hbase.util.Bytes;
@@ -57,7 +57,7 @@ public class IndexTestingUtils {
conf.setInt(MASTER_INFO_PORT_KEY, -1);
conf.setInt(RS_INFO_PORT_KEY, -1);
// setup our codec, so we get proper replay/write
- conf.set(WALEditCodec.WAL_EDIT_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
+ conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName());
}
/**
* Verify the state of the index table between the given key and time ranges against the list of
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/TestFailForUnsupportedHBaseVersions.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/TestFailForUnsupportedHBaseVersions.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/TestFailForUnsupportedHBaseVersions.java
index 559c161..9bff7fc 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/TestFailForUnsupportedHBaseVersions.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/TestFailForUnsupportedHBaseVersions.java
@@ -116,6 +116,8 @@ public class TestFailForUnsupportedHBaseVersions {
// start the minicluster
HBaseTestingUtility util = new HBaseTestingUtility(conf);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
util.startMiniCluster();
// setup the primary table
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestEndToEndCoveredColumnsIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestEndToEndCoveredColumnsIndexBuilder.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestEndToEndCoveredColumnsIndexBuilder.java
index a671550..99ea0c7 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestEndToEndCoveredColumnsIndexBuilder.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestEndToEndCoveredColumnsIndexBuilder.java
@@ -33,8 +33,10 @@ import java.util.Map;
import java.util.Queue;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -100,6 +102,8 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
// disable version checking, so we can test against whatever version of HBase happens to be
// installed (right now, its generally going to be SNAPSHOT versions).
conf.setBoolean(Indexer.CHECK_VERSION_CONF_KEY, false);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
UTIL.startMiniCluster();
}
@@ -130,11 +134,11 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
*/
private class ListMatchingVerifier implements TableStateVerifier {
- private List<KeyValue> expectedKvs;
+ private List<Cell> expectedKvs;
private ColumnReference[] columns;
private String msg;
- public ListMatchingVerifier(String msg, List<KeyValue> kvs, ColumnReference... columns) {
+ public ListMatchingVerifier(String msg, List<Cell> kvs, ColumnReference... columns) {
this.expectedKvs = kvs;
this.columns = columns;
this.msg = msg;
@@ -149,7 +153,7 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
int count = 0;
KeyValue kv;
while ((kv = kvs.next()) != null) {
- KeyValue next = expectedKvs.get(count++);
+ Cell next = expectedKvs.get(count++);
assertEquals(
msg + ": Unexpected kv in table state!\nexpected v1: "
+ Bytes.toString(next.getValue()) + "\nactual v1:" + Bytes.toString(kv.getValue()),
@@ -199,8 +203,8 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
p.add(family, qual, Bytes.toBytes("v1"));
// get all the underlying kvs for the put
- final List<KeyValue> expectedKvs = new ArrayList<KeyValue>();
- final List<KeyValue> allKvs = new ArrayList<KeyValue>();
+ final List<Cell> expectedKvs = new ArrayList<Cell>();
+ final List<Cell> allKvs = new ArrayList<Cell>();
allKvs.addAll(p.getFamilyMap().get(family));
// setup the verifier for the data we expect to write
@@ -255,9 +259,9 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
// since we need to iterate the batch.
// get all the underlying kvs for the put
- final List<KeyValue> allKvs = new ArrayList<KeyValue>(2);
- allKvs.addAll(p2.getFamilyMap().get(family));
- allKvs.addAll(p1.getFamilyMap().get(family));
+ final List<Cell> allKvs = new ArrayList<Cell>(2);
+ allKvs.addAll(p2.getFamilyCellMap().get(family));
+ allKvs.addAll(p1.getFamilyCellMap().get(family));
// setup the verifier for the data we expect to write
// both puts should be put into a single batch
@@ -266,11 +270,11 @@ public class TestEndToEndCoveredColumnsIndexBuilder {
VerifyingIndexCodec codec = state.codec;
// no previous state in the table
codec.verifiers.add(new ListMatchingVerifier("cleanup state 1", Collections
- .<KeyValue> emptyList(), familyRef));
- codec.verifiers.add(new ListMatchingVerifier("put state 1", p1.getFamilyMap().get(family),
+ .<Cell> emptyList(), familyRef));
+ codec.verifiers.add(new ListMatchingVerifier("put state 1", p1.getFamilyCellMap().get(family),
familyRef));
- codec.verifiers.add(new ListMatchingVerifier("cleanup state 2", p1.getFamilyMap().get(family),
+ codec.verifiers.add(new ListMatchingVerifier("cleanup state 2", p1.getFamilyCellMap().get(family),
familyRef));
// kvs from both puts should be in the table now
codec.verifiers.add(new ListMatchingVerifier("put state 2", allKvs, familyRef));
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestLocalTableState.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestLocalTableState.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestLocalTableState.java
index 66b4561..0bbdc6e 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestLocalTableState.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/TestLocalTableState.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Scan;
@@ -75,7 +76,7 @@ public class TestLocalTableState {
public Boolean answer(InvocationOnMock invocation) throws Throwable {
List<KeyValue> list = (List<KeyValue>) invocation.getArguments()[0];
KeyValue kv = new KeyValue(row, fam, qual, ts, Type.Put, stored);
- kv.setMemstoreTS(0);
+ kv.setMvccVersion(0);
list.add(kv);
return false;
}
@@ -85,7 +86,7 @@ public class TestLocalTableState {
LocalHBaseState state = new LocalTable(env);
LocalTableState table = new LocalTableState(env, state, m);
//add the kvs from the mutation
- table.addPendingUpdates(m.get(fam, qual));
+ table.addPendingUpdates(KeyValueUtil.ensureKeyValues(m.get(fam, qual)));
// setup the lookup
ColumnReference col = new ColumnReference(fam, qual);
@@ -114,7 +115,7 @@ public class TestLocalTableState {
Mockito.when(region.getScanner(Mockito.any(Scan.class))).thenReturn(scanner);
final byte[] stored = Bytes.toBytes("stored-value");
final KeyValue storedKv = new KeyValue(row, fam, qual, ts, Type.Put, stored);
- storedKv.setMemstoreTS(2);
+ storedKv.setMvccVersion(2);
Mockito.when(scanner.next(Mockito.any(List.class))).thenAnswer(new Answer<Boolean>() {
@Override
public Boolean answer(InvocationOnMock invocation) throws Throwable {
@@ -127,8 +128,8 @@ public class TestLocalTableState {
LocalHBaseState state = new LocalTable(env);
LocalTableState table = new LocalTableState(env, state, m);
// add the kvs from the mutation
- KeyValue kv = m.get(fam, qual).get(0);
- kv.setMemstoreTS(0);
+ KeyValue kv = KeyValueUtil.ensureKeyValue(m.get(fam, qual).get(0));
+ kv.setMvccVersion(0);
table.addPendingUpdates(kv);
// setup the lookup
@@ -160,7 +161,7 @@ public class TestLocalTableState {
Mockito.when(region.getScanner(Mockito.any(Scan.class))).thenReturn(scanner);
final KeyValue storedKv =
new KeyValue(row, fam, qual, ts, Type.Put, Bytes.toBytes("stored-value"));
- storedKv.setMemstoreTS(2);
+ storedKv.setMvccVersion(2);
Mockito.when(scanner.next(Mockito.any(List.class))).thenAnswer(new Answer<Boolean>() {
@Override
public Boolean answer(InvocationOnMock invocation) throws Throwable {
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/data/TestIndexMemStore.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/data/TestIndexMemStore.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/data/TestIndexMemStore.java
index 6e1ec67..4d3fefa 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/data/TestIndexMemStore.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/data/TestIndexMemStore.java
@@ -41,9 +41,9 @@ public class TestIndexMemStore {
IndexMemStore store = new IndexMemStore(IndexMemStore.COMPARATOR);
long ts = 10;
KeyValue kv = new KeyValue(row, family, qual, ts, Type.Put, val);
- kv.setMemstoreTS(2);
+ kv.setMvccVersion(2);
KeyValue kv2 = new KeyValue(row, family, qual, ts, Type.Put, val2);
- kv2.setMemstoreTS(0);
+ kv2.setMvccVersion(0);
store.add(kv, true);
// adding the exact same kv shouldn't change anything stored if not overwritting
store.add(kv2, false);
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestCoveredColumnIndexCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestCoveredColumnIndexCodec.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestCoveredColumnIndexCodec.java
index 991d6eb..ddf749a 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestCoveredColumnIndexCodec.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestCoveredColumnIndexCodec.java
@@ -32,7 +32,9 @@ import java.util.Collections;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
@@ -154,7 +156,7 @@ public class TestCoveredColumnIndexCodec {
ColumnGroup group = new ColumnGroup("test-column-group");
group.add(COLUMN_REF);
- final Result emptyState = new Result(Collections.<KeyValue> emptyList());
+ final Result emptyState = Result.create(Collections.<Cell> emptyList());
// setup the state we expect for the codec
RegionCoprocessorEnvironment env = Mockito.mock(RegionCoprocessorEnvironment.class);
@@ -169,7 +171,7 @@ public class TestCoveredColumnIndexCodec {
// start with a basic put that has some keyvalues
Put p = new Put(PK);
// setup the kvs to add
- List<KeyValue> kvs = new ArrayList<KeyValue>();
+ List<Cell> kvs = new ArrayList<Cell>();
byte[] v1 = Bytes.toBytes("v1");
KeyValue kv = new KeyValue(PK, FAMILY, QUAL, 1, v1);
kvs.add(kv);
@@ -187,7 +189,7 @@ public class TestCoveredColumnIndexCodec {
// get the updates with the pending update
state.setCurrentTimestamp(1);
- state.addPendingUpdates(kvs);
+ state.addPendingUpdates(KeyValueUtil.ensureKeyValues(kvs));
updates = codec.getIndexUpserts(state);
assertTrue("Didn't find index updates for pending primary table update!", updates.iterator()
.hasNext());
@@ -207,7 +209,7 @@ public class TestCoveredColumnIndexCodec {
d.deleteFamily(FAMILY, 2);
// setup the next batch of 'current state', basically just ripping out the current state from
// the last round
- table = new SimpleTableState(new Result(kvs));
+ table = new SimpleTableState(Result.create(kvs));
state = new LocalTableState(env, table, d);
state.setCurrentTimestamp(2);
// check the cleanup of the current table, after the puts (mocking a 'next' update)
@@ -234,13 +236,13 @@ public class TestCoveredColumnIndexCodec {
ensureNoUpdatesWhenCoveredByDelete(env, codec, kvs, d);
}
- private void ensureNoUpdatesWhenCoveredByDelete(RegionCoprocessorEnvironment env, IndexCodec codec, List<KeyValue> currentState,
+ private void ensureNoUpdatesWhenCoveredByDelete(RegionCoprocessorEnvironment env, IndexCodec codec, List<Cell> currentState,
Delete d) throws IOException {
- LocalHBaseState table = new SimpleTableState(new Result(currentState));
+ LocalHBaseState table = new SimpleTableState(Result.create(currentState));
LocalTableState state = new LocalTableState(env, table, d);
state.setCurrentTimestamp(d.getTimeStamp());
// now we shouldn't see anything when getting the index update
- state.addPendingUpdates(d.getFamilyMap().get(FAMILY));
+ state.addPendingUpdates(KeyValueUtil.ensureKeyValues(d.getFamilyCellMap().get(FAMILY)));
Iterable<IndexUpdate> updates = codec.getIndexUpserts(state);
for (IndexUpdate update : updates) {
assertFalse("Had some index updates, though it should have been covered by the delete",
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/53f7d3ce/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndToEndCoveredIndexing.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndToEndCoveredIndexing.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndToEndCoveredIndexing.java
index d186e38..69aff9d 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndToEndCoveredIndexing.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/index/covered/example/TestEndToEndCoveredIndexing.java
@@ -106,6 +106,8 @@ public class TestEndToEndCoveredIndexing {
// disable version checking, so we can test against whatever version of HBase happens to be
// installed (right now, its generally going to be SNAPSHOT versions).
conf.setBoolean(Indexer.CHECK_VERSION_CONF_KEY, false);
+ // disable replication
+ conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
UTIL.startMiniCluster();
}