You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by el...@apache.org on 2017/03/01 00:55:48 UTC
[3/7] phoenix git commit: PHOENIX-3698 No-args constructor for
IndexedWALEditCodec
PHOENIX-3698 No-args constructor for IndexedWALEditCodec
Change-Id: Ic36c61a314e92aa9a8cdf496e210909abe5829dc
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bf91232d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bf91232d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bf91232d
Branch: refs/heads/4.9-HBase-1.2
Commit: bf91232dfd1a4f23dc36cb9629d670f66f34af42
Parents: 4855511
Author: Josh Elser <el...@apache.org>
Authored: Mon Feb 27 16:55:42 2017 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Tue Feb 28 19:37:33 2017 -0500
----------------------------------------------------------------------
.../regionserver/wal/IndexedWALEditCodec.java | 20 ++++++++++--
.../wal/IndexedWALEditCodecTest.java | 32 ++++++++++++++++++++
2 files changed, 50 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/bf91232d/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 1a70e12..80745a8 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
@@ -55,11 +55,27 @@ public class IndexedWALEditCodec extends WALCellCodec {
private static final int MIN_BINARY_COMPATIBLE_INDEX_CODEC_VERSION = VersionUtil.encodeVersion("1", "1", "3");
private final boolean useDefaultDecoder;
+ private static boolean isUseDefaultDecoder() {
+ String hbaseVersion = VersionInfo.getVersion();
+ return VersionUtil.encodeVersion(hbaseVersion) >= MIN_BINARY_COMPATIBLE_INDEX_CODEC_VERSION;
+ }
+
+ /*
+ * No-args constructor must be provided for WALSplitter/RPC Codec path
+ */
+ public IndexedWALEditCodec() {
+ super();
+ this.compression = null;
+ this.useDefaultDecoder = isUseDefaultDecoder();
+ }
+
+ /*
+ * Two-args Configuration and CompressionContext codec must be provided for WALCellCodec path
+ */
public IndexedWALEditCodec(Configuration conf, CompressionContext compression) {
super(conf, compression);
this.compression = compression;
- String hbaseVersion = VersionInfo.getVersion();
- this.useDefaultDecoder = VersionUtil.encodeVersion(hbaseVersion) >= MIN_BINARY_COMPATIBLE_INDEX_CODEC_VERSION;
+ this.useDefaultDecoder = isUseDefaultDecoder();
}
@Override
http://git-wip-us.apache.org/repos/asf/phoenix/blob/bf91232d/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodecTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodecTest.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodecTest.java
new file mode 100644
index 0000000..ee726bb
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/wal/IndexedWALEditCodecTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.hadoop.hbase.regionserver.wal;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.io.util.LRUDictionary;
+import org.junit.Test;
+
+public class IndexedWALEditCodecTest {
+
+ @SuppressWarnings("unused")
+ @Test
+ public void testConstructorsArePresent() throws Exception {
+ // "testing" via the presence of these constructors
+ IndexedWALEditCodec codec1 = new IndexedWALEditCodec();
+ IndexedWALEditCodec codec2 = new IndexedWALEditCodec(new Configuration(false), new CompressionContext(LRUDictionary.class, false, false));
+ }
+}