hbase git commit: Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale
Repository: hbase Updated Branches: refs/heads/master 783e20e1a -> 45d67435a Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/45d67435 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/45d67435 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/45d67435 Branch: refs/heads/master Commit: 45d67435adc9195325bfccc78b7e1a0202a446e5 Parents: 783e20e Author: Jerry He Authored: Mon Sep 21 19:34:55 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 19:58:17 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/45d67435/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index 2037786..9b95ae7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -251,10 +251,6 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed -// Just delete the directory -if (!fs.delete(status.getPath(), false)) { - LOG.warn("Unable to delete " + status.getPath()); -} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale
Repository: hbase Updated Branches: refs/heads/branch-1.2 cb57ebaa8 -> 05cb05142 Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/05cb0514 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/05cb0514 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/05cb0514 Branch: refs/heads/branch-1.2 Commit: 05cb051423953b913156e4950b67f3d9b28ada5f Parents: cb57eba Author: Jerry He Authored: Mon Sep 21 19:34:55 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 19:55:20 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/05cb0514/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index a706bcf..e648c2e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -248,10 +248,6 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed -// Just delete the directory -if (!fs.delete(status.getPath(), false)) { - LOG.warn("Unable to delete " + status.getPath()); -} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale
Repository: hbase Updated Branches: refs/heads/branch-1.1 242594d0b -> 489dd6427 Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/489dd642 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/489dd642 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/489dd642 Branch: refs/heads/branch-1.1 Commit: 489dd6427a499d09fb8cde4fbdd46303f0a57b20 Parents: 242594d Author: Jerry He Authored: Mon Sep 21 19:34:55 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 19:37:14 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/489dd642/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index c645135..bd2b8f5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -241,10 +241,6 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed -// Just delete the directory -if (!fs.delete(status.getPath(), false)) { - LOG.warn("Unable to delete " + status.getPath()); -} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale
Repository: hbase Updated Branches: refs/heads/branch-1 05bd89b9b -> 73ec3fdd5 Revert: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/73ec3fdd Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/73ec3fdd Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/73ec3fdd Branch: refs/heads/branch-1 Commit: 73ec3fdd5c64354ae8339baceed4ed0de229712d Parents: 05bd89b Author: Jerry He Authored: Mon Sep 21 19:34:55 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 19:34:55 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/73ec3fdd/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index a706bcf..e648c2e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -248,10 +248,6 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed -// Just delete the directory -if (!fs.delete(status.getPath(), false)) { - LOG.warn("Unable to delete " + status.getPath()); -} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
[02/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/75356f2d/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java new file mode 100644 index 000..3b5a13a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java @@ -0,0 +1,1394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: NamespacePropertiesMessage.proto + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +public final class NamespacePropertiesMessage { + private NamespacePropertiesMessage() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface NamespacePropertiesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + +// repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + java.util.List +getPropsList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +int getPropsCount(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +java.util.List +getPropsOrBuilderList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder( +int index); + } + /** + * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties} + */ + public static final class NamespaceProperties extends + com.google.protobuf.GeneratedMessage + implements NamespacePropertiesOrBuilder { +// Use NamespaceProperties.newBuilder() to construct. +private NamespaceProperties(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); +} +private NamespaceProperties(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + +private static final NamespaceProperties defaultInstance; +public static NamespaceProperties getDefaultInstance() { + return defaultInstance; +} + +public NamespaceProperties getDefaultInstanceForType() { + return defaultInstance; +} + +private final com.google.protobuf.UnknownFieldSet unknownFields; +@java.lang.Override +public final com.google.protobuf.UnknownFieldSet +getUnknownFields() { + return this.unknownFields; +} +private NamespaceProperties( +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_ & 0x0001) == 0x0001)) { +props_ = new java.util.ArrayList(); +mutable_bitField0_ |= 0x0001; + } + props_.add(input.readMessage(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.PARSER, extensionRegistry)); + 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);
[12/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
HBASE-14147 Add namespace CRUD functionality to REST Signed-off-by: Andrew Purtell Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/783e20e1 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/783e20e1 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/783e20e1 Branch: refs/heads/master Commit: 783e20e1a7ca2c796b8d9c9e938e5c5779aa30c7 Parents: 8765ffb Author: Matt Warhaftig Authored: Mon Aug 10 01:23:58 2015 -0400 Committer: Andrew Purtell Committed: Mon Sep 21 19:03:24 2015 -0700 -- hbase-rest/pom.xml |2 + .../hbase/rest/NamespacesInstanceResource.java | 325 .../hadoop/hbase/rest/NamespacesResource.java | 90 ++ .../apache/hadoop/hbase/rest/RootResource.java |5 + .../rest/model/NamespacesInstanceModel.java | 168 +++ .../hbase/rest/model/NamespacesModel.java | 116 ++ .../generated/NamespacePropertiesMessage.java | 1394 ++ .../protobuf/generated/NamespacesMessage.java | 547 +++ .../rest/provider/JAXBContextResolver.java |4 + .../org/apache/hadoop/hbase/rest/XMLSchema.xsd | 28 + .../protobuf/NamespacePropertiesMessage.proto | 26 + .../hbase/rest/protobuf/NamespacesMessage.proto | 22 + .../rest/TestNamespacesInstanceResource.java| 441 ++ .../hbase/rest/TestNamespacesResource.java | 204 +++ .../rest/model/TestNamespacesInstanceModel.java | 98 ++ .../hbase/rest/model/TestNamespacesModel.java | 86 ++ 16 files changed, 3556 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/783e20e1/hbase-rest/pom.xml -- diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 2c3ec3f..3443afc 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -366,6 +366,8 @@ CellMessage.proto CellSetMessage.proto ColumnSchemaMessage.proto + NamespacesMessage.proto + NamespacePropertiesMessage.proto ScannerMessage.proto StorageClusterStatusMessage.proto TableInfoMessage.proto http://git-wip-us.apache.org/repos/asf/hbase/blob/783e20e1/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java new file mode 100644 index 000..8f64738 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java @@ -0,0 +1,325 @@ +/* + * + * 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.rest; + +import java.io.IOException; + +import javax.servlet.ServletContext; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; + +/** + * Implements the following REST end points: + * + * /namespaces/{namespace} GET: get namespace properties. + * /namespaces/{namespace} POST: create namespace. + * /namespaces/{namespace} PUT: alter namespace. + * /namesp
[01/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
Repository: hbase Updated Branches: refs/heads/0.98 c4fa84965 -> 75356f2d4 refs/heads/branch-1 9574c6761 -> 05bd89b9b refs/heads/branch-1.2 7e9f7b53a -> cb57ebaa8 refs/heads/master 8765ffb0c -> 783e20e1a http://git-wip-us.apache.org/repos/asf/hbase/blob/75356f2d/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java -- diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java new file mode 100644 index 000..e1990b2 --- /dev/null +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java @@ -0,0 +1,441 @@ +/* + * + * 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.rest; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.rest.client.Client; +import org.apache.hadoop.hbase.rest.client.Cluster; +import org.apache.hadoop.hbase.rest.client.Response; +import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; +import org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.provider.JacksonProvider; +import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.codehaus.jackson.map.ObjectMapper; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category(MediumTests.class) +public class TestNamespacesInstanceResource { + private static String NAMESPACE1 = "TestNamespacesInstanceResource1"; + private static Map NAMESPACE1_PROPS = new HashMap(); + private static String NAMESPACE2 = "TestNamespacesInstanceResource2"; + private static Map NAMESPACE2_PROPS = new HashMap(); + private static String NAMESPACE3 = "TestNamespacesInstanceResource3"; + private static Map NAMESPACE3_PROPS = new HashMap(); + private static String NAMESPACE4 = "TestNamespacesInstanceResource4"; + private static Map NAMESPACE4_PROPS = new HashMap(); + + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static final HBaseRESTTestingUtility REST_TEST_UTIL = +new HBaseRESTTestingUtility(); + private static Client client; + private static JAXBContext context; + private static Configuration conf; + private static TestNamespacesInstanceModel testNamespacesInstanceModel; + protected static ObjectMapper jsonMapper; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { +conf = TEST_UTIL.getConfiguration(); +TEST_UTIL.startMiniCluster(); +REST_TEST_UTIL.startServletContainer(conf); +client = new Client(new Cluster().add("localhost", + REST_TEST_UTIL.getServletPort())); +testNamespacesInstanceModel = new TestNamespacesInstanceModel(); +context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class); +jsonMapper = new JacksonProvider() +.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE); +NAMESPACE1_PROPS.put("key1", "value1"); +NAMESPACE2_PROPS.put("key2a", "value2a"); +NAMESPACE2_PROPS.put("key2b", "value2b"); +NAMESPACE3_PROPS.put("key3", "value3"); +NAMESPACE4_PROPS.put("key4a", "value
[09/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
HBASE-14147 Add namespace CRUD functionality to REST Conflicts: hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesInstanceModel.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesModel.java Signed-off-by: Andrew Purtell Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cb57ebaa Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cb57ebaa Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cb57ebaa Branch: refs/heads/branch-1.2 Commit: cb57ebaa8a4c1b783df230785e1b6a584d078896 Parents: 7e9f7b5 Author: Matt Warhaftig Authored: Mon Aug 10 01:23:58 2015 -0400 Committer: Andrew Purtell Committed: Mon Sep 21 19:03:21 2015 -0700 -- hbase-rest/pom.xml |2 + .../hbase/rest/NamespacesInstanceResource.java | 325 .../hadoop/hbase/rest/NamespacesResource.java | 90 ++ .../apache/hadoop/hbase/rest/RootResource.java |5 + .../rest/model/NamespacesInstanceModel.java | 168 +++ .../hbase/rest/model/NamespacesModel.java | 116 ++ .../generated/NamespacePropertiesMessage.java | 1394 ++ .../protobuf/generated/NamespacesMessage.java | 547 +++ .../rest/provider/JAXBContextResolver.java |4 + .../org/apache/hadoop/hbase/rest/XMLSchema.xsd | 28 + .../protobuf/NamespacePropertiesMessage.proto | 26 + .../hbase/rest/protobuf/NamespacesMessage.proto | 22 + .../rest/TestNamespacesInstanceResource.java| 440 ++ .../hbase/rest/TestNamespacesResource.java | 203 +++ .../rest/model/TestNamespacesInstanceModel.java | 97 ++ .../hbase/rest/model/TestNamespacesModel.java | 85 ++ 16 files changed, 3552 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/cb57ebaa/hbase-rest/pom.xml -- diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 5204fb5..f19bc92 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -366,6 +366,8 @@ CellMessage.proto CellSetMessage.proto ColumnSchemaMessage.proto + NamespacesMessage.proto + NamespacePropertiesMessage.proto ScannerMessage.proto StorageClusterStatusMessage.proto TableInfoMessage.proto http://git-wip-us.apache.org/repos/asf/hbase/blob/cb57ebaa/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java new file mode 100644 index 000..8f64738 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java @@ -0,0 +1,325 @@ +/* + * + * 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.rest; + +import java.io.IOException; + +import javax.servlet.ServletContext; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.
[05/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/05bd89b9/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java new file mode 100644 index 000..3b5a13a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java @@ -0,0 +1,1394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: NamespacePropertiesMessage.proto + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +public final class NamespacePropertiesMessage { + private NamespacePropertiesMessage() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface NamespacePropertiesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + +// repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + java.util.List +getPropsList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +int getPropsCount(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +java.util.List +getPropsOrBuilderList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder( +int index); + } + /** + * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties} + */ + public static final class NamespaceProperties extends + com.google.protobuf.GeneratedMessage + implements NamespacePropertiesOrBuilder { +// Use NamespaceProperties.newBuilder() to construct. +private NamespaceProperties(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); +} +private NamespaceProperties(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + +private static final NamespaceProperties defaultInstance; +public static NamespaceProperties getDefaultInstance() { + return defaultInstance; +} + +public NamespaceProperties getDefaultInstanceForType() { + return defaultInstance; +} + +private final com.google.protobuf.UnknownFieldSet unknownFields; +@java.lang.Override +public final com.google.protobuf.UnknownFieldSet +getUnknownFields() { + return this.unknownFields; +} +private NamespaceProperties( +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_ & 0x0001) == 0x0001)) { +props_ = new java.util.ArrayList(); +mutable_bitField0_ |= 0x0001; + } + props_.add(input.readMessage(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.PARSER, extensionRegistry)); + 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);
[08/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/cb57ebaa/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java new file mode 100644 index 000..3b5a13a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java @@ -0,0 +1,1394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: NamespacePropertiesMessage.proto + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +public final class NamespacePropertiesMessage { + private NamespacePropertiesMessage() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface NamespacePropertiesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + +// repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + java.util.List +getPropsList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +int getPropsCount(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +java.util.List +getPropsOrBuilderList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder( +int index); + } + /** + * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties} + */ + public static final class NamespaceProperties extends + com.google.protobuf.GeneratedMessage + implements NamespacePropertiesOrBuilder { +// Use NamespaceProperties.newBuilder() to construct. +private NamespaceProperties(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); +} +private NamespaceProperties(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + +private static final NamespaceProperties defaultInstance; +public static NamespaceProperties getDefaultInstance() { + return defaultInstance; +} + +public NamespaceProperties getDefaultInstanceForType() { + return defaultInstance; +} + +private final com.google.protobuf.UnknownFieldSet unknownFields; +@java.lang.Override +public final com.google.protobuf.UnknownFieldSet +getUnknownFields() { + return this.unknownFields; +} +private NamespaceProperties( +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_ & 0x0001) == 0x0001)) { +props_ = new java.util.ArrayList(); +mutable_bitField0_ |= 0x0001; + } + props_.add(input.readMessage(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.PARSER, extensionRegistry)); + 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);
[10/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/783e20e1/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java -- diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java new file mode 100644 index 000..d7649b0 --- /dev/null +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java @@ -0,0 +1,441 @@ +/* + * + * 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.rest; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.rest.client.Client; +import org.apache.hadoop.hbase.rest.client.Cluster; +import org.apache.hadoop.hbase.rest.client.Response; +import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; +import org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.provider.JacksonProvider; +import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.testclassification.RestTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.codehaus.jackson.map.ObjectMapper; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category({RestTests.class, MediumTests.class}) +public class TestNamespacesInstanceResource { + private static String NAMESPACE1 = "TestNamespacesInstanceResource1"; + private static Map NAMESPACE1_PROPS = new HashMap(); + private static String NAMESPACE2 = "TestNamespacesInstanceResource2"; + private static Map NAMESPACE2_PROPS = new HashMap(); + private static String NAMESPACE3 = "TestNamespacesInstanceResource3"; + private static Map NAMESPACE3_PROPS = new HashMap(); + private static String NAMESPACE4 = "TestNamespacesInstanceResource4"; + private static Map NAMESPACE4_PROPS = new HashMap(); + + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static final HBaseRESTTestingUtility REST_TEST_UTIL = +new HBaseRESTTestingUtility(); + private static Client client; + private static JAXBContext context; + private static Configuration conf; + private static TestNamespacesInstanceModel testNamespacesInstanceModel; + protected static ObjectMapper jsonMapper; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { +conf = TEST_UTIL.getConfiguration(); +TEST_UTIL.startMiniCluster(); +REST_TEST_UTIL.startServletContainer(conf); +client = new Client(new Cluster().add("localhost", + REST_TEST_UTIL.getServletPort())); +testNamespacesInstanceModel = new TestNamespacesInstanceModel(); +context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class); +jsonMapper = new JacksonProvider() +.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE); +NAMESPACE1_PROPS.put("key1", "value1"); +NAMESPACE2_PROPS.put("key2a", "value2a"); +NAMESPACE2_PROPS.put("key2b", "value2b"); +NAMESPACE3_PROPS.put("key3", "value3"); +NAMESPACE4_PROPS.put("key4a", "value4a"); +NAMESPACE4_PROPS.put("key4b", "value4b"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { +
[04/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/05bd89b9/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java -- diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java new file mode 100644 index 000..bd76be9 --- /dev/null +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java @@ -0,0 +1,440 @@ +/* + * + * 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.rest; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.rest.client.Client; +import org.apache.hadoop.hbase.rest.client.Cluster; +import org.apache.hadoop.hbase.rest.client.Response; +import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; +import org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.provider.JacksonProvider; +import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.codehaus.jackson.map.ObjectMapper; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category(MediumTests.class) +public class TestNamespacesInstanceResource { + private static String NAMESPACE1 = "TestNamespacesInstanceResource1"; + private static Map NAMESPACE1_PROPS = new HashMap(); + private static String NAMESPACE2 = "TestNamespacesInstanceResource2"; + private static Map NAMESPACE2_PROPS = new HashMap(); + private static String NAMESPACE3 = "TestNamespacesInstanceResource3"; + private static Map NAMESPACE3_PROPS = new HashMap(); + private static String NAMESPACE4 = "TestNamespacesInstanceResource4"; + private static Map NAMESPACE4_PROPS = new HashMap(); + + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static final HBaseRESTTestingUtility REST_TEST_UTIL = +new HBaseRESTTestingUtility(); + private static Client client; + private static JAXBContext context; + private static Configuration conf; + private static TestNamespacesInstanceModel testNamespacesInstanceModel; + protected static ObjectMapper jsonMapper; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { +conf = TEST_UTIL.getConfiguration(); +TEST_UTIL.startMiniCluster(); +REST_TEST_UTIL.startServletContainer(conf); +client = new Client(new Cluster().add("localhost", + REST_TEST_UTIL.getServletPort())); +testNamespacesInstanceModel = new TestNamespacesInstanceModel(); +context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class); +jsonMapper = new JacksonProvider() +.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE); +NAMESPACE1_PROPS.put("key1", "value1"); +NAMESPACE2_PROPS.put("key2a", "value2a"); +NAMESPACE2_PROPS.put("key2b", "value2b"); +NAMESPACE3_PROPS.put("key3", "value3"); +NAMESPACE4_PROPS.put("key4a", "value4a"); +NAMESPACE4_PROPS.put("key4b", "value4b"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { +REST_TEST_UTIL.shutdownServletContainer(); +TEST_UTIL.shutdownMiniCluster
[03/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
HBASE-14147 Add namespace CRUD functionality to REST Conflicts: hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/NamespacesInstanceModel.java hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/NamespacesModel.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesInstanceModel.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesModel.java Signed-off-by: Andrew Purtell Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/75356f2d Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/75356f2d Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/75356f2d Branch: refs/heads/0.98 Commit: 75356f2d49aeb4d532705ca922b7fe9416e66883 Parents: c4fa849 Author: Matt Warhaftig Authored: Mon Sep 21 18:48:11 2015 -0700 Committer: Andrew Purtell Committed: Mon Sep 21 18:48:15 2015 -0700 -- hbase-rest/pom.xml |2 + .../hbase/rest/NamespacesInstanceResource.java | 325 .../hadoop/hbase/rest/NamespacesResource.java | 90 ++ .../apache/hadoop/hbase/rest/RootResource.java |5 + .../rest/model/NamespacesInstanceModel.java | 168 +++ .../hbase/rest/model/NamespacesModel.java | 116 ++ .../generated/NamespacePropertiesMessage.java | 1394 ++ .../protobuf/generated/NamespacesMessage.java | 547 +++ .../rest/provider/JAXBContextResolver.java |4 + .../org/apache/hadoop/hbase/rest/XMLSchema.xsd | 28 + .../protobuf/NamespacePropertiesMessage.proto | 26 + .../hbase/rest/protobuf/NamespacesMessage.proto | 22 + .../rest/TestNamespacesInstanceResource.java| 441 ++ .../hbase/rest/TestNamespacesResource.java | 203 +++ .../rest/model/TestNamespacesInstanceModel.java | 97 ++ .../hbase/rest/model/TestNamespacesModel.java | 85 ++ 16 files changed, 3553 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/75356f2d/hbase-rest/pom.xml -- diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 9192b41..396d4c4 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -365,6 +365,8 @@ CellMessage.proto CellSetMessage.proto ColumnSchemaMessage.proto + NamespacesMessage.proto + NamespacePropertiesMessage.proto ScannerMessage.proto StorageClusterStatusMessage.proto TableInfoMessage.proto http://git-wip-us.apache.org/repos/asf/hbase/blob/75356f2d/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java new file mode 100644 index 000..77eda11 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java @@ -0,0 +1,325 @@ +/* + * + * 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.rest; + +import java.io.IOException; + +import javax.servlet.ServletContext; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.commons.logging.Log; +import org.apache.comm
[07/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/cb57ebaa/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java -- diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java new file mode 100644 index 000..bd76be9 --- /dev/null +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java @@ -0,0 +1,440 @@ +/* + * + * 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.rest; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.rest.client.Client; +import org.apache.hadoop.hbase.rest.client.Cluster; +import org.apache.hadoop.hbase.rest.client.Response; +import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; +import org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel; +import org.apache.hadoop.hbase.rest.provider.JacksonProvider; +import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.codehaus.jackson.map.ObjectMapper; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category(MediumTests.class) +public class TestNamespacesInstanceResource { + private static String NAMESPACE1 = "TestNamespacesInstanceResource1"; + private static Map NAMESPACE1_PROPS = new HashMap(); + private static String NAMESPACE2 = "TestNamespacesInstanceResource2"; + private static Map NAMESPACE2_PROPS = new HashMap(); + private static String NAMESPACE3 = "TestNamespacesInstanceResource3"; + private static Map NAMESPACE3_PROPS = new HashMap(); + private static String NAMESPACE4 = "TestNamespacesInstanceResource4"; + private static Map NAMESPACE4_PROPS = new HashMap(); + + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static final HBaseRESTTestingUtility REST_TEST_UTIL = +new HBaseRESTTestingUtility(); + private static Client client; + private static JAXBContext context; + private static Configuration conf; + private static TestNamespacesInstanceModel testNamespacesInstanceModel; + protected static ObjectMapper jsonMapper; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { +conf = TEST_UTIL.getConfiguration(); +TEST_UTIL.startMiniCluster(); +REST_TEST_UTIL.startServletContainer(conf); +client = new Client(new Cluster().add("localhost", + REST_TEST_UTIL.getServletPort())); +testNamespacesInstanceModel = new TestNamespacesInstanceModel(); +context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class); +jsonMapper = new JacksonProvider() +.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE); +NAMESPACE1_PROPS.put("key1", "value1"); +NAMESPACE2_PROPS.put("key2a", "value2a"); +NAMESPACE2_PROPS.put("key2b", "value2b"); +NAMESPACE3_PROPS.put("key3", "value3"); +NAMESPACE4_PROPS.put("key4a", "value4a"); +NAMESPACE4_PROPS.put("key4b", "value4b"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { +REST_TEST_UTIL.shutdownServletContainer(); +TEST_UTIL.shutdownMiniCluster
[06/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
HBASE-14147 Add namespace CRUD functionality to REST Conflicts: hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesResource.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesInstanceModel.java hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestNamespacesModel.java Signed-off-by: Andrew Purtell Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/05bd89b9 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/05bd89b9 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/05bd89b9 Branch: refs/heads/branch-1 Commit: 05bd89b9b781d7c108858d883aae7f08fe1fce32 Parents: 9574c67 Author: Matt Warhaftig Authored: Mon Aug 10 01:23:58 2015 -0400 Committer: Andrew Purtell Committed: Mon Sep 21 19:03:16 2015 -0700 -- hbase-rest/pom.xml |2 + .../hbase/rest/NamespacesInstanceResource.java | 325 .../hadoop/hbase/rest/NamespacesResource.java | 90 ++ .../apache/hadoop/hbase/rest/RootResource.java |5 + .../rest/model/NamespacesInstanceModel.java | 168 +++ .../hbase/rest/model/NamespacesModel.java | 116 ++ .../generated/NamespacePropertiesMessage.java | 1394 ++ .../protobuf/generated/NamespacesMessage.java | 547 +++ .../rest/provider/JAXBContextResolver.java |4 + .../org/apache/hadoop/hbase/rest/XMLSchema.xsd | 28 + .../protobuf/NamespacePropertiesMessage.proto | 26 + .../hbase/rest/protobuf/NamespacesMessage.proto | 22 + .../rest/TestNamespacesInstanceResource.java| 440 ++ .../hbase/rest/TestNamespacesResource.java | 203 +++ .../rest/model/TestNamespacesInstanceModel.java | 97 ++ .../hbase/rest/model/TestNamespacesModel.java | 85 ++ 16 files changed, 3552 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/05bd89b9/hbase-rest/pom.xml -- diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 02dad90..75320da 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -366,6 +366,8 @@ CellMessage.proto CellSetMessage.proto ColumnSchemaMessage.proto + NamespacesMessage.proto + NamespacePropertiesMessage.proto ScannerMessage.proto StorageClusterStatusMessage.proto TableInfoMessage.proto http://git-wip-us.apache.org/repos/asf/hbase/blob/05bd89b9/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java new file mode 100644 index 000..8f64738 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java @@ -0,0 +1,325 @@ +/* + * + * 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.rest; + +import java.io.IOException; + +import javax.servlet.ServletContext; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hb
[11/12] hbase git commit: HBASE-14147 Add namespace CRUD functionality to REST
http://git-wip-us.apache.org/repos/asf/hbase/blob/783e20e1/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java -- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java new file mode 100644 index 000..3b5a13a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/NamespacePropertiesMessage.java @@ -0,0 +1,1394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: NamespacePropertiesMessage.proto + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +public final class NamespacePropertiesMessage { + private NamespacePropertiesMessage() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface NamespacePropertiesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + +// repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + java.util.List +getPropsList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +int getPropsCount(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ +java.util.List +getPropsOrBuilderList(); +/** + * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1; + */ + org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder( +int index); + } + /** + * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties} + */ + public static final class NamespaceProperties extends + com.google.protobuf.GeneratedMessage + implements NamespacePropertiesOrBuilder { +// Use NamespaceProperties.newBuilder() to construct. +private NamespaceProperties(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); +} +private NamespaceProperties(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + +private static final NamespaceProperties defaultInstance; +public static NamespaceProperties getDefaultInstance() { + return defaultInstance; +} + +public NamespaceProperties getDefaultInstanceForType() { + return defaultInstance; +} + +private final com.google.protobuf.UnknownFieldSet unknownFields; +@java.lang.Override +public final com.google.protobuf.UnknownFieldSet +getUnknownFields() { + return this.unknownFields; +} +private NamespaceProperties( +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_ & 0x0001) == 0x0001)) { +props_ = new java.util.ArrayList(); +mutable_bitField0_ |= 0x0001; + } + props_.add(input.readMessage(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.PARSER, extensionRegistry)); + 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);
hbase git commit: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang)
Repository: hbase Updated Branches: refs/heads/branch-1.1 dcf859fcb -> 242594d0b HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/242594d0 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/242594d0 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/242594d0 Branch: refs/heads/branch-1.1 Commit: 242594d0b65ede977282520b5d4edecf3d2b9e26 Parents: dcf859f Author: Jerry He Authored: Mon Sep 21 15:14:28 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 15:14:28 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/242594d0/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index bd2b8f5..c645135 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -241,6 +241,10 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed +// Just delete the directory +if (!fs.delete(status.getPath(), false)) { + LOG.warn("Unable to delete " + status.getPath()); +} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang)
Repository: hbase Updated Branches: refs/heads/branch-1.2 ec1215707 -> 7e9f7b53a HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7e9f7b53 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7e9f7b53 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7e9f7b53 Branch: refs/heads/branch-1.2 Commit: 7e9f7b53a2c3900ba7a305dd8effab252c55e8f4 Parents: ec12157 Author: Jerry He Authored: Mon Sep 21 15:10:35 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 15:10:35 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/7e9f7b53/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index e648c2e..a706bcf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -248,6 +248,10 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed +// Just delete the directory +if (!fs.delete(status.getPath(), false)) { + LOG.warn("Unable to delete " + status.getPath()); +} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang)
Repository: hbase Updated Branches: refs/heads/branch-1 ec86d174b -> 9574c6761 HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9574c676 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9574c676 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9574c676 Branch: refs/heads/branch-1 Commit: 9574c67610cf30eaad58de64171726eac954be9c Parents: ec86d17 Author: Jerry He Authored: Mon Sep 21 15:06:20 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 15:06:20 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/9574c676/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index e648c2e..a706bcf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -248,6 +248,10 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed +// Just delete the directory +if (!fs.delete(status.getPath(), false)) { + LOG.warn("Unable to delete " + status.getPath()); +} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang)
Repository: hbase Updated Branches: refs/heads/master 54e8c4bf2 -> 8765ffb0c HBASE-14391 Empty regionserver WAL will never be deleted although the coresponding regionserver has been stale (Qianxi Zhang) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8765ffb0 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8765ffb0 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8765ffb0 Branch: refs/heads/master Commit: 8765ffb0ca2b1c39d864ac495f0b3ee2abc520ed Parents: 54e8c4b Author: Jerry He Authored: Mon Sep 21 15:03:43 2015 -0700 Committer: Jerry He Committed: Mon Sep 21 15:03:43 2015 -0700 -- .../java/org/apache/hadoop/hbase/master/MasterFileSystem.java| 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/8765ffb0/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index 9b95ae7..2037786 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -251,6 +251,10 @@ public class MasterFileSystem { FileStatus[] curLogFiles = FSUtils.listStatus(this.fs, status.getPath(), null); if (curLogFiles == null || curLogFiles.length == 0) { // Empty log folder. No recovery needed +// Just delete the directory +if (!fs.delete(status.getPath(), false)) { + LOG.warn("Unable to delete " + status.getPath()); +} continue; } final ServerName serverName = DefaultWALProvider.getServerNameFromWALDirectoryName(
hbase git commit: HBASE-14280 Revert due to TestFSHDFSUtils failure
Repository: hbase Updated Branches: refs/heads/master 86cf14889 -> 54e8c4bf2 HBASE-14280 Revert due to TestFSHDFSUtils failure Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/54e8c4bf Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/54e8c4bf Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/54e8c4bf Branch: refs/heads/master Commit: 54e8c4bf23294b53bc50e15aa92148f7994e8962 Parents: 86cf148 Author: tedyu Authored: Mon Sep 21 09:51:53 2015 -0700 Committer: tedyu Committed: Mon Sep 21 09:51:53 2015 -0700 -- .../apache/hadoop/hbase/util/FSHDFSUtils.java | 25 ++-- 1 file changed, 2 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/54e8c4bf/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java index bdc2534..1360fb2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java @@ -27,7 +27,6 @@ import java.net.URI; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.Collection; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; @@ -67,17 +66,8 @@ public class FSHDFSUtils extends FSUtils { dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil"); } if (getNNAddressesMethod == null) { - try { -// getNNServiceRpcAddressesForCluster is available only in version -// equal to or later than Hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class); - } catch (NoSuchMethodError e) { -// If hadoop version is older than hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); - } - + getNNAddressesMethod = + dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); } Map> addressMap = @@ -125,17 +115,6 @@ public class FSHDFSUtils extends FSUtils { if (srcServiceName.equals(desServiceName)) { return true; } -if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) { - Collection internalNameServices = - conf.getTrimmedStringCollection("dfs.internal.nameservices"); - if (!internalNameServices.isEmpty()) { -if (internalNameServices.contains(srcServiceName.split(":")[1])) { - return true; -} else { - return false; -} - } -} if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) { //If one serviceName is an HA format while the other is a non-HA format, // maybe they refer to the same FileSystem.
hbase git commit: HBASE-14280 Revert due to TestFSHDFSUtils failure
Repository: hbase Updated Branches: refs/heads/branch-1 ca6c7f0a6 -> ec86d174b HBASE-14280 Revert due to TestFSHDFSUtils failure Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ec86d174 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ec86d174 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ec86d174 Branch: refs/heads/branch-1 Commit: ec86d174b48e0611783346e586fb398dcd47bbe0 Parents: ca6c7f0 Author: tedyu Authored: Mon Sep 21 09:51:27 2015 -0700 Committer: tedyu Committed: Mon Sep 21 09:51:27 2015 -0700 -- .../apache/hadoop/hbase/util/FSHDFSUtils.java | 25 ++-- 1 file changed, 2 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/ec86d174/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java index bdc2534..1360fb2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java @@ -27,7 +27,6 @@ import java.net.URI; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.Collection; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; @@ -67,17 +66,8 @@ public class FSHDFSUtils extends FSUtils { dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil"); } if (getNNAddressesMethod == null) { - try { -// getNNServiceRpcAddressesForCluster is available only in version -// equal to or later than Hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class); - } catch (NoSuchMethodError e) { -// If hadoop version is older than hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); - } - + getNNAddressesMethod = + dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); } Map> addressMap = @@ -125,17 +115,6 @@ public class FSHDFSUtils extends FSUtils { if (srcServiceName.equals(desServiceName)) { return true; } -if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) { - Collection internalNameServices = - conf.getTrimmedStringCollection("dfs.internal.nameservices"); - if (!internalNameServices.isEmpty()) { -if (internalNameServices.contains(srcServiceName.split(":")[1])) { - return true; -} else { - return false; -} - } -} if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) { //If one serviceName is an HA format while the other is a non-HA format, // maybe they refer to the same FileSystem.
hbase git commit: HBASE-14280 Revert due to TestFSHDFSUtils failure
Repository: hbase Updated Branches: refs/heads/branch-1.2 78c8c772d -> ec1215707 HBASE-14280 Revert due to TestFSHDFSUtils failure Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ec121570 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ec121570 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ec121570 Branch: refs/heads/branch-1.2 Commit: ec121570738e5920d74e7b7d3276d6324dd4d65a Parents: 78c8c77 Author: tedyu Authored: Mon Sep 21 09:50:16 2015 -0700 Committer: tedyu Committed: Mon Sep 21 09:50:16 2015 -0700 -- .../apache/hadoop/hbase/util/FSHDFSUtils.java | 25 ++-- 1 file changed, 2 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/ec121570/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java index bdc2534..1360fb2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java @@ -27,7 +27,6 @@ import java.net.URI; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.Collection; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; @@ -67,17 +66,8 @@ public class FSHDFSUtils extends FSUtils { dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil"); } if (getNNAddressesMethod == null) { - try { -// getNNServiceRpcAddressesForCluster is available only in version -// equal to or later than Hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class); - } catch (NoSuchMethodError e) { -// If hadoop version is older than hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); - } - + getNNAddressesMethod = + dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); } Map> addressMap = @@ -125,17 +115,6 @@ public class FSHDFSUtils extends FSUtils { if (srcServiceName.equals(desServiceName)) { return true; } -if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) { - Collection internalNameServices = - conf.getTrimmedStringCollection("dfs.internal.nameservices"); - if (!internalNameServices.isEmpty()) { -if (internalNameServices.contains(srcServiceName.split(":")[1])) { - return true; -} else { - return false; -} - } -} if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) { //If one serviceName is an HA format while the other is a non-HA format, // maybe they refer to the same FileSystem.
hbase git commit: HBASE-14280 Revert due to TestFSHDFSUtils failure
Repository: hbase Updated Branches: refs/heads/branch-1.1 9ae6cead3 -> dcf859fcb HBASE-14280 Revert due to TestFSHDFSUtils failure Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/dcf859fc Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/dcf859fc Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/dcf859fc Branch: refs/heads/branch-1.1 Commit: dcf859fcb5184bd590c0a72ad74b385a22d929d5 Parents: 9ae6cea Author: tedyu Authored: Mon Sep 21 09:48:41 2015 -0700 Committer: tedyu Committed: Mon Sep 21 09:48:41 2015 -0700 -- .../apache/hadoop/hbase/util/FSHDFSUtils.java | 25 ++-- 1 file changed, 2 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/dcf859fc/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java index 099bdc0..0fffcc6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java @@ -27,7 +27,6 @@ import java.net.URI; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.Collection; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; @@ -67,17 +66,8 @@ public class FSHDFSUtils extends FSUtils { dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil"); } if (getNNAddressesMethod == null) { - try { -// getNNServiceRpcAddressesForCluster is available only in version -// equal to or later than Hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class); - } catch (NoSuchMethodError e) { -// If hadoop version is older than hadoop 2.6 -getNNAddressesMethod = -dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); - } - + getNNAddressesMethod = + dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); } Map> addressMap = @@ -125,17 +115,6 @@ public class FSHDFSUtils extends FSUtils { if (srcServiceName.equals(desServiceName)) { return true; } -if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) { - Collection internalNameServices = - conf.getTrimmedStringCollection("dfs.internal.nameservices"); - if (!internalNameServices.isEmpty()) { -if (internalNameServices.contains(srcServiceName.split(":")[1])) { - return true; -} else { - return false; -} - } -} if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) { //If one serviceName is an HA format while the other is a non-HA format, // maybe they refer to the same FileSystem.
hbase git commit: HBASE-14431 Addendum checks for null connectionInPool (Yu Li)
Repository: hbase Updated Branches: refs/heads/branch-1.1 36200f1ea -> 9ae6cead3 HBASE-14431 Addendum checks for null connectionInPool (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9ae6cead Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9ae6cead Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9ae6cead Branch: refs/heads/branch-1.1 Commit: 9ae6cead335c5afc298bd192820ecb7af928ab2c Parents: 36200f1 Author: tedyu Authored: Mon Sep 21 07:24:39 2015 -0700 Committer: tedyu Committed: Mon Sep 21 07:24:39 2015 -0700 -- .../src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/9ae6cead/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java -- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java index 80156d6..bb3f332 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java @@ -398,7 +398,7 @@ public class AsyncRpcClient extends AbstractRpcClient { // we use address as cache key, so we should check here to prevent removing the // wrong connection AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode); - if (connectionInPool.equals(connection)) { + if (connectionInPool != null && connectionInPool.equals(connection)) { this.connections.remove(connectionHashCode); } else if (LOG.isDebugEnabled()) { LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",
hbase git commit: HBASE-14431 Addendum checks for null connectionInPool (Yu Li)
Repository: hbase Updated Branches: refs/heads/branch-1.2 34032492d -> 78c8c772d HBASE-14431 Addendum checks for null connectionInPool (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/78c8c772 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/78c8c772 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/78c8c772 Branch: refs/heads/branch-1.2 Commit: 78c8c772db84d88dcecaafd6ba9c7f7e611cc091 Parents: 3403249 Author: tedyu Authored: Mon Sep 21 07:24:08 2015 -0700 Committer: tedyu Committed: Mon Sep 21 07:24:08 2015 -0700 -- .../src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/78c8c772/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java -- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java index 876eb70..e1662f3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java @@ -403,7 +403,7 @@ public class AsyncRpcClient extends AbstractRpcClient { // we use address as cache key, so we should check here to prevent removing the // wrong connection AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode); - if (connectionInPool.equals(connection)) { + if (connectionInPool != null && connectionInPool.equals(connection)) { this.connections.remove(connectionHashCode); } else if (LOG.isDebugEnabled()) { LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",
hbase git commit: HBASE-14431 Addendum checks for null connectionInPool (Yu Li)
Repository: hbase Updated Branches: refs/heads/branch-1 81d04cde2 -> ca6c7f0a6 HBASE-14431 Addendum checks for null connectionInPool (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ca6c7f0a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ca6c7f0a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ca6c7f0a Branch: refs/heads/branch-1 Commit: ca6c7f0a6857a5ac16be6a13c461e2aae0b51821 Parents: 81d04cd Author: tedyu Authored: Mon Sep 21 07:23:47 2015 -0700 Committer: tedyu Committed: Mon Sep 21 07:23:47 2015 -0700 -- .../src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/ca6c7f0a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java -- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java index 876eb70..e1662f3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java @@ -403,7 +403,7 @@ public class AsyncRpcClient extends AbstractRpcClient { // we use address as cache key, so we should check here to prevent removing the // wrong connection AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode); - if (connectionInPool.equals(connection)) { + if (connectionInPool != null && connectionInPool.equals(connection)) { this.connections.remove(connectionHashCode); } else if (LOG.isDebugEnabled()) { LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",
hbase git commit: HBASE-14431 Addendum checks for null connectionInPool (Yu Li)
Repository: hbase Updated Branches: refs/heads/master bf8596013 -> 86cf14889 HBASE-14431 Addendum checks for null connectionInPool (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/86cf1488 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/86cf1488 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/86cf1488 Branch: refs/heads/master Commit: 86cf14889462b6947f921c41401a8f925fe2b3b6 Parents: bf85960 Author: tedyu Authored: Mon Sep 21 07:23:14 2015 -0700 Committer: tedyu Committed: Mon Sep 21 07:23:14 2015 -0700 -- .../src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/86cf1488/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java -- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java index 876eb70..e1662f3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java @@ -403,7 +403,7 @@ public class AsyncRpcClient extends AbstractRpcClient { // we use address as cache key, so we should check here to prevent removing the // wrong connection AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode); - if (connectionInPool.equals(connection)) { + if (connectionInPool != null && connectionInPool.equals(connection)) { this.connections.remove(connectionHashCode); } else if (LOG.isDebugEnabled()) { LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",
hbase git commit: HBASE-14448 Refine RegionGroupingProvider Phase-2: remove provider nesting and formalize wal group name (Yu Li)
Repository: hbase Updated Branches: refs/heads/branch-1 566a20145 -> 81d04cde2 HBASE-14448 Refine RegionGroupingProvider Phase-2: remove provider nesting and formalize wal group name (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/81d04cde Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/81d04cde Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/81d04cde Branch: refs/heads/branch-1 Commit: 81d04cde275addcef5730943721c0f3601f74a72 Parents: 566a201 Author: tedyu Authored: Mon Sep 21 06:45:02 2015 -0700 Committer: tedyu Committed: Mon Sep 21 06:45:02 2015 -0700 -- .../hbase/wal/BoundedGroupingStrategy.java | 2 +- .../hadoop/hbase/wal/DefaultWALProvider.java| 19 +-- .../hbase/wal/RegionGroupingProvider.java | 136 --- 3 files changed, 98 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/81d04cde/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java index 14c5594..c8f434f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.wal.RegionGroupingProvider.RegionGroupingStrategy; /** - * A WAL grouping strategy that limits the number of delegate providers (i.e. wal group) to + * A WAL grouping strategy that limits the number of wal groups to * "hbase.wal.regiongrouping.numgroups". */ @InterfaceAudience.Private http://git-wip-us.apache.org/repos/asf/hbase/blob/81d04cde/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java index 5e65f47..23dd79e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java @@ -76,7 +76,7 @@ public class DefaultWALProvider implements WALProvider { void init(FileSystem fs, Path path, Configuration c, boolean overwritable) throws IOException; } - protected FSHLog log = null; + protected volatile FSHLog log = null; private WALFactory factory = null; private Configuration conf = null; private List listeners = null; @@ -121,13 +121,16 @@ public class DefaultWALProvider implements WALProvider { @Override public WAL getWAL(final byte[] identifier) throws IOException { -// must lock since getWAL will create hlog on fs which is time consuming -synchronized (walCreateLock) { - if (log == null) { -log = new FSHLog(FileSystem.get(conf), FSUtils.getRootDir(conf), -getWALDirectoryName(factory.factoryId), HConstants.HREGION_OLDLOGDIR_NAME, conf, -listeners, true, logPrefix, -META_WAL_PROVIDER_ID.equals(providerId) ? META_WAL_PROVIDER_ID : null); +if (log == null) { + // only lock when need to create wal, and need to lock since + // creating hlog on fs is time consuming + synchronized (walCreateLock) { +if (log == null) { + log = new FSHLog(FileSystem.get(conf), FSUtils.getRootDir(conf), + getWALDirectoryName(factory.factoryId), HConstants.HREGION_OLDLOGDIR_NAME, conf, + listeners, true, logPrefix, + META_WAL_PROVIDER_ID.equals(providerId) ? META_WAL_PROVIDER_ID : null); +} } } return log; http://git-wip-us.apache.org/repos/asf/hbase/blob/81d04cde/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java index 8395818..00a5651 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java @@ -18,23 +18,30 @@ */ package org.apache.hadoop.hbase.wal; +import static org.apache.hadoop.hbase.wal.DefaultWALProvider.META_WAL_PROVIDER_ID; +import static org.apache.hadoop.hbase.wal.DefaultWALProvider.WAL_
hbase git commit: HBASE-14448 Refine RegionGroupingProvider Phase-2: remove provider nesting and formalize wal group name (Yu Li)
Repository: hbase Updated Branches: refs/heads/master a7afc132e -> bf8596013 HBASE-14448 Refine RegionGroupingProvider Phase-2: remove provider nesting and formalize wal group name (Yu Li) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bf859601 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bf859601 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bf859601 Branch: refs/heads/master Commit: bf859601317dbf6493818dc2a27e5e813112eb2c Parents: a7afc13 Author: tedyu Authored: Mon Sep 21 06:42:39 2015 -0700 Committer: tedyu Committed: Mon Sep 21 06:42:39 2015 -0700 -- .../hbase/wal/BoundedGroupingStrategy.java | 2 +- .../hadoop/hbase/wal/DefaultWALProvider.java| 19 +-- .../hbase/wal/RegionGroupingProvider.java | 136 --- 3 files changed, 98 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/bf859601/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java index 14c5594..c8f434f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.wal.RegionGroupingProvider.RegionGroupingStrategy; /** - * A WAL grouping strategy that limits the number of delegate providers (i.e. wal group) to + * A WAL grouping strategy that limits the number of wal groups to * "hbase.wal.regiongrouping.numgroups". */ @InterfaceAudience.Private http://git-wip-us.apache.org/repos/asf/hbase/blob/bf859601/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java index f15a387..be95e16 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/DefaultWALProvider.java @@ -74,7 +74,7 @@ public class DefaultWALProvider implements WALProvider { void init(FileSystem fs, Path path, Configuration c, boolean overwritable) throws IOException; } - protected FSHLog log = null; + protected volatile FSHLog log = null; private WALFactory factory = null; private Configuration conf = null; private List listeners = null; @@ -119,13 +119,16 @@ public class DefaultWALProvider implements WALProvider { @Override public WAL getWAL(final byte[] identifier) throws IOException { -// must lock since getWAL will create hlog on fs which is time consuming -synchronized (walCreateLock) { - if (log == null) { -log = new FSHLog(FileSystem.get(conf), FSUtils.getRootDir(conf), -getWALDirectoryName(factory.factoryId), HConstants.HREGION_OLDLOGDIR_NAME, conf, -listeners, true, logPrefix, -META_WAL_PROVIDER_ID.equals(providerId) ? META_WAL_PROVIDER_ID : null); +if (log == null) { + // only lock when need to create wal, and need to lock since + // creating hlog on fs is time consuming + synchronized (walCreateLock) { +if (log == null) { + log = new FSHLog(FileSystem.get(conf), FSUtils.getRootDir(conf), + getWALDirectoryName(factory.factoryId), HConstants.HREGION_OLDLOGDIR_NAME, conf, + listeners, true, logPrefix, + META_WAL_PROVIDER_ID.equals(providerId) ? META_WAL_PROVIDER_ID : null); +} } } return log; http://git-wip-us.apache.org/repos/asf/hbase/blob/bf859601/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java index 8395818..00a5651 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java @@ -18,23 +18,30 @@ */ package org.apache.hadoop.hbase.wal; +import static org.apache.hadoop.hbase.wal.DefaultWALProvider.META_WAL_PROVIDER_ID; +import static org.apache.hadoop.hbase.wal.DefaultWALProvider.WAL_FILE