[
https://issues.apache.org/jira/browse/HBASE-17327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15756533#comment-15756533
]
Joep Rottinghuis commented on HBASE-17327:
------------------------------------------
Yup, that appears to be the issue.
This seems to be the stack when trying to connect to an HBase cluster that is
down:
Thread.sleep(long) line: not available [native method]
Thread.sleep(long, int) line: 340
TimeUnit$3(TimeUnit).sleep(long) line: 386
RetryCounter.sleepUntilNextRetry() line: 158
RecoverableZooKeeper.exists(String, Watcher) line: 232
ZKUtil.checkExists(ZooKeeperWatcher, String) line: 414
ZKClusterId.readClusterIdZNode(ZooKeeperWatcher) line: 65
ZooKeeperRegistry.getClusterId() line: 103
ConnectionImplementation.retrieveClusterId() line: 484
ConnectionImplementation.<init>(Configuration, ExecutorService, User) line: 260
NativeConstructorAccessorImpl.newInstance0(Constructor<?>, Object[]) line: not
available [native method]
NativeConstructorAccessorImpl.newInstance(Object[]) line: 62
DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45
Constructor<T>.newInstance(Object...) line: 423
ConnectionFactory.createConnection(Configuration, ExecutorService, User) line:
235
ConnectionFactory.createConnection(Configuration) line: 122
See the following test code to demonstrate this:
<code>
/**
* 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.mapreduce;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({LargeTests.class})
public class TestConnectionCreation {
private static HBaseTestingUtility util = new HBaseTestingUtility();
@Test
public void test() throws Exception {
util.startMiniCluster();
util.shutdownMiniCluster();
Configuration hbaseConf = util.getConfiguration();
Connection conn = ConnectionFactory.createConnection(hbaseConf);
conn.close();
}
}
<code>
> Allow for lazy connection / BufferedMutator creation
> ----------------------------------------------------
>
> Key: HBASE-17327
> URL: https://issues.apache.org/jira/browse/HBASE-17327
> Project: HBase
> Issue Type: Sub-task
> Reporter: Joep Rottinghuis
>
> The SpoolingBufferedMutatorImpl solution (HBASE-17018) solved the use-case
> when an existing HBase connection stalls out due to HBase being down, or
> other transient issues.
> We have a remaining issue that our service will not start up if it cannot
> initially connect to HBase.
> This can be solved by letting the SpoolingBufferedMutator create the wrapped
> BufferedMutatorImpl later, but the problem has already occurred: we already
> have to have a connection in order to create a BufferedMutator to begin with.
> It would be good to be able to initiate a connection and then have a way for
> multiple users to wait for the connection to succeed before using it.
> I'm thinking perhaps create a LazyConnection interface that extends the
> Connection interface. It would have an additional waitFor(long timeout,
> TimeUnit unit) method where clients can wait for the connection to be
> established before they start using the connection.
> Or perhaps the ConnectionFactory can have a createLazyConnection method.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)