HBASE-21857 Addendum fix broken UTs
This commit is contained in:
parent
5464ed0f9e
commit
575c6cf8ff
@ -252,7 +252,7 @@ public class ReplicationPeerManager {
|
|||||||
try {
|
try {
|
||||||
endpoint = Class.forName(replicationEndpointImpl)
|
endpoint = Class.forName(replicationEndpointImpl)
|
||||||
.asSubclass(ReplicationEndpoint.class).getDeclaredConstructor().newInstance();
|
.asSubclass(ReplicationEndpoint.class).getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
throw new DoNotRetryIOException(
|
throw new DoNotRetryIOException(
|
||||||
"Can not instantiate configured replication endpoint class=" + replicationEndpointImpl,
|
"Can not instantiate configured replication endpoint class=" + replicationEndpointImpl,
|
||||||
e);
|
e);
|
||||||
|
@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.ReplicationPeerNotFoundException;
|
|||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
import org.apache.hadoop.hbase.client.Admin;
|
||||||
|
import org.apache.hadoop.hbase.replication.DummyReplicationEndpoint;
|
||||||
import org.apache.hadoop.hbase.replication.ReplicationException;
|
import org.apache.hadoop.hbase.replication.ReplicationException;
|
||||||
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
|
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
|
||||||
import org.apache.hadoop.hbase.replication.ReplicationPeerConfigBuilder;
|
import org.apache.hadoop.hbase.replication.ReplicationPeerConfigBuilder;
|
||||||
@ -48,7 +49,6 @@ import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
|
|||||||
import org.apache.hadoop.hbase.replication.ReplicationQueueStorage;
|
import org.apache.hadoop.hbase.replication.ReplicationQueueStorage;
|
||||||
import org.apache.hadoop.hbase.replication.ReplicationStorageFactory;
|
import org.apache.hadoop.hbase.replication.ReplicationStorageFactory;
|
||||||
import org.apache.hadoop.hbase.replication.TestReplicationEndpoint.InterClusterReplicationEndpointForTest;
|
import org.apache.hadoop.hbase.replication.TestReplicationEndpoint.InterClusterReplicationEndpointForTest;
|
||||||
import org.apache.hadoop.hbase.replication.TestReplicationEndpoint.ReplicationEndpointForTest;
|
|
||||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@ -874,7 +874,7 @@ public class TestReplicationAdmin {
|
|||||||
public void testPeerReplicationEndpointImpl() throws Exception {
|
public void testPeerReplicationEndpointImpl() throws Exception {
|
||||||
ReplicationPeerConfigBuilder builder = ReplicationPeerConfig.newBuilder();
|
ReplicationPeerConfigBuilder builder = ReplicationPeerConfig.newBuilder();
|
||||||
builder.setClusterKey(KEY_ONE);
|
builder.setClusterKey(KEY_ONE);
|
||||||
builder.setReplicationEndpointImpl(ReplicationEndpointForTest.class.getName());
|
builder.setReplicationEndpointImpl(DummyReplicationEndpoint.class.getName());
|
||||||
hbaseAdmin.addReplicationPeer(ID_ONE, builder.build());
|
hbaseAdmin.addReplicationPeer(ID_ONE, builder.build());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -899,7 +899,7 @@ public class TestReplicationAdmin {
|
|||||||
hbaseAdmin.addReplicationPeer(ID_SECOND, builder.build());
|
hbaseAdmin.addReplicationPeer(ID_SECOND, builder.build());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
builder.setReplicationEndpointImpl(ReplicationEndpointForTest.class.getName());
|
builder.setReplicationEndpointImpl(DummyReplicationEndpoint.class.getName());
|
||||||
hbaseAdmin.updateReplicationPeerConfig(ID_SECOND, builder.build());
|
hbaseAdmin.updateReplicationPeerConfig(ID_SECOND, builder.build());
|
||||||
fail("Change replication endpoint implementation class on an existing peer is not allowed");
|
fail("Change replication endpoint implementation class on an existing peer is not allowed");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* 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.replication;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.apache.yetus.audience.InterfaceAudience;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dummy replication endpoint that does nothing, for test use only.
|
||||||
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
|
public class DummyReplicationEndpoint extends BaseReplicationEndpoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canReplicateToSameCluster() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getPeerUUID() {
|
||||||
|
return ctx.getClusterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WALEntryFilter getWALEntryfilter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replicate(ReplicateContext replicateContext) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
startAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
stopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doStart() {
|
||||||
|
notifyStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doStop() {
|
||||||
|
notifyStopped();
|
||||||
|
}
|
||||||
|
}
|
@ -601,7 +601,7 @@ module Hbase
|
|||||||
|
|
||||||
define_test "get_peer_config: works with replicationendpointimpl peer and config params" do
|
define_test "get_peer_config: works with replicationendpointimpl peer and config params" do
|
||||||
cluster_key = 'localhost:2181:/hbase-test'
|
cluster_key = 'localhost:2181:/hbase-test'
|
||||||
repl_impl = 'org.apache.hadoop.hbase.replication.ReplicationEndpointForTest'
|
repl_impl = 'org.apache.hadoop.hbase.replication.DummyReplicationEndpoint'
|
||||||
config_params = { "config1" => "value1", "config2" => "value2" }
|
config_params = { "config1" => "value1", "config2" => "value2" }
|
||||||
args = { CLUSTER_KEY => cluster_key, ENDPOINT_CLASSNAME => repl_impl,
|
args = { CLUSTER_KEY => cluster_key, ENDPOINT_CLASSNAME => repl_impl,
|
||||||
CONFIG => config_params }
|
CONFIG => config_params }
|
||||||
@ -621,7 +621,7 @@ module Hbase
|
|||||||
peer_id_second = '2'
|
peer_id_second = '2'
|
||||||
command(:add_peer, @peer_id, args)
|
command(:add_peer, @peer_id, args)
|
||||||
|
|
||||||
repl_impl = "org.apache.hadoop.hbase.replication.ReplicationEndpointForTest"
|
repl_impl = "org.apache.hadoop.hbase.replication.DummyReplicationEndpoint"
|
||||||
config_params = { "config1" => "value1", "config2" => "value2" }
|
config_params = { "config1" => "value1", "config2" => "value2" }
|
||||||
args2 = { ENDPOINT_CLASSNAME => repl_impl, CONFIG => config_params}
|
args2 = { ENDPOINT_CLASSNAME => repl_impl, CONFIG => config_params}
|
||||||
command(:add_peer, peer_id_second, args2)
|
command(:add_peer, peer_id_second, args2)
|
||||||
@ -636,7 +636,7 @@ module Hbase
|
|||||||
end
|
end
|
||||||
|
|
||||||
define_test "update_peer_config: can update peer config and data" do
|
define_test "update_peer_config: can update peer config and data" do
|
||||||
repl_impl = "org.apache.hadoop.hbase.replication.ReplicationEndpointForTest"
|
repl_impl = "org.apache.hadoop.hbase.replication.DummyReplicationEndpoint"
|
||||||
config_params = { "config1" => "value1", "config2" => "value2" }
|
config_params = { "config1" => "value1", "config2" => "value2" }
|
||||||
data_params = {"data1" => "value1", "data2" => "value2"}
|
data_params = {"data1" => "value1", "data2" => "value2"}
|
||||||
args = { ENDPOINT_CLASSNAME => repl_impl, CONFIG => config_params, DATA => data_params}
|
args = { ENDPOINT_CLASSNAME => repl_impl, CONFIG => config_params, DATA => data_params}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user