SOLR-9340: Change ZooKeeper disconnect and session expiry related logging from INFO to WARN to make debugging easier

This commit is contained in:
Varun Thacker 2016-07-26 23:41:39 +05:30
parent 7b6a16c30b
commit 91ed36ddb4
3 changed files with 16 additions and 6 deletions

View File

@ -169,6 +169,9 @@ Other Changes
* SOLR-9163: Sync up basic_configs and data_driven_schema_configs, removing almost all differences
except what is required for schemaless. (yonik)
* SOLR-9340: Change ZooKeeper disconnect and session expiry related logging from INFO to WARN to
make debugging easier (Varun Thacker)
================== 6.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -28,6 +28,10 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.zookeeper.Watcher.Event.KeeperState.AuthFailed;
import static org.apache.zookeeper.Watcher.Event.KeeperState.Disconnected;
import static org.apache.zookeeper.Watcher.Event.KeeperState.Expired;
public class ConnectionManager implements Watcher {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@ -100,7 +104,10 @@ public class ConnectionManager implements Watcher {
@Override
public void process(WatchedEvent event) {
if (log.isInfoEnabled()) {
if (event.getState() == AuthFailed || event.getState() == Disconnected || event.getState() == Expired) {
log.warn("Watcher " + this + " name:" + name + " got event " + event
+ " path:" + event.getPath() + " type:" + event.getType());
} else if (log.isInfoEnabled()) {
log.info("Watcher " + this + " name:" + name + " got event " + event
+ " path:" + event.getPath() + " type:" + event.getType());
}
@ -115,12 +122,12 @@ public class ConnectionManager implements Watcher {
if (state == KeeperState.SyncConnected) {
connected();
connectionStrategy.connected();
} else if (state == KeeperState.Expired) {
} else if (state == Expired) {
// we don't call disconnected here, because we know we are expired
connected = false;
likelyExpiredState = LikelyExpiredState.EXPIRED;
log.info("Our previous ZooKeeper session was expired. Attempting to reconnect to recover relationship with ZooKeeper...");
log.warn("Our previous ZooKeeper session was expired. Attempting to reconnect to recover relationship with ZooKeeper...");
if (beforeReconnect != null) {
try {
@ -176,7 +183,7 @@ public class ConnectionManager implements Watcher {
} while (!isClosed);
log.info("Connected:" + connected);
} else if (state == KeeperState.Disconnected) {
log.info("zkClient has disconnected");
log.warn("zkClient has disconnected");
disconnected();
connectionStrategy.disconnected();
} else if (state == KeeperState.AuthFailed) {

View File

@ -49,7 +49,7 @@ public class DefaultConnectionStrategy extends ZkClientConnectionStrategy {
@Override
public void reconnect(final String serverAddress, final int zkClientTimeout,
final Watcher watcher, final ZkUpdate updater) throws IOException {
log.info("Connection expired - starting a new one...");
log.warn("Connection expired - starting a new one...");
SolrZooKeeper zk = createSolrZooKeeper(serverAddress, zkClientTimeout, watcher);
boolean success = false;
try {
@ -59,7 +59,7 @@ public class DefaultConnectionStrategy extends ZkClientConnectionStrategy {
log.info("Reconnected to ZooKeeper");
} catch (Exception e) {
SolrException.log(log, "Reconnect to ZooKeeper failed", e);
log.info("Reconnect to ZooKeeper failed");
log.warn("Reconnect to ZooKeeper failed");
} finally {
if (!success) {
try {