SOLR-15136: Reduce excessive logging introduced with Per Replica States feature

This commit is contained in:
Ishan Chattopadhyaya 2021-02-12 11:52:19 +05:30
parent db61297590
commit 938039a688
3 changed files with 16 additions and 13 deletions

View File

@ -253,6 +253,8 @@ Bug Fixes
* SOLR-15114: Fix bug that caused WAND optimization to be disabled in cases where the max score is requested (such as
multi-shard requests in SolrCloud) (Naoto Minami via Tomás Fernández Löbbe)
* SOLR-15136: Reduce excessive logging introduced with Per Replica States feature (Ishan Chattopadhyaya)
================== 8.8.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -60,7 +60,7 @@ public class PerReplicaStatesOps {
List<Op> ops = new ArrayList<>(operations.size());
for (PerReplicaStates.Operation op : operations) {
//the state of the replica is being updated
// the state of the replica is being updated
String path = znode + "/" + op.state.asString;
ops.add(op.typ == PerReplicaStates.Operation.Type.ADD ?
Op.create(path, null, zkClient.getZkACLProvider().getACLsToAdd(path), CreateMode.PERSISTENT) :
@ -77,7 +77,8 @@ public class PerReplicaStatesOps {
}
/**There is a possibility that a replica may have some leftover entries . delete them too
/**
* There is a possibility that a replica may have some leftover entries. Delete them too.
*/
private static List<PerReplicaStates.Operation> addDeleteStaleNodes(List<PerReplicaStates.Operation> ops, PerReplicaStates.State rs) {
while (rs != null) {
@ -97,9 +98,9 @@ public class PerReplicaStatesOps {
persist(operations, znode, zkClient);
return;
} catch (KeeperException.NodeExistsException | KeeperException.NoNodeException e) {
//state is stale
// state is stale
if(log.isInfoEnabled()) {
log.info("stale state for {} , attempt: {}. retrying...", znode, i);
log.info("Stale state for {}, attempt: {}. retrying...", znode, i);
}
operations = refresh(PerReplicaStates.fetch(znode, zkClient, null));
}
@ -111,7 +112,7 @@ public class PerReplicaStatesOps {
}
/**
* state of a replica is changed
* Change the state of a replica
*
* @param newState the new state
*/
@ -168,21 +169,21 @@ public class PerReplicaStatesOps {
ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(st.replica, Replica.State.ACTIVE, Boolean.TRUE, st.version + 1)));
ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.DELETE, st));
}
//else do not do anything , that node is the leader
// else do not do anything, that node is the leader
} else {
//there is no entry for the new leader.
//create one
// there is no entry for the new leader.
// create one
ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(next, Replica.State.ACTIVE, Boolean.TRUE, 0)));
}
}
//now go through all other replicas and unset previous leader
// now go through all other replicas and unset previous leader
for (String r : allReplicas) {
PerReplicaStates.State st = rs.get(r);
if (st == null) continue;//unlikely
if (!Objects.equals(r, next)) {
if (st.isLeader) {
//some other replica is the leader now. unset
// some other replica is the leader now. unset
ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(st.replica, st.state, Boolean.FALSE, st.version + 1)));
ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.DELETE, st));
}
@ -219,7 +220,7 @@ public class PerReplicaStatesOps {
}
/**
* mark a bunch of replicas as DOWN
* Mark the given replicas as DOWN
*/
public static PerReplicaStatesOps downReplicas(List<String> replicas, PerReplicaStates rs) {
return new PerReplicaStatesOps(prs -> {
@ -242,7 +243,7 @@ public class PerReplicaStatesOps {
}
/**
* Just creates and deletes a dummy entry so that the {@link Stat#getCversion()} of states.json
* Just creates and deletes a dummy entry so that the {@link Stat#getCversion()} of state.json
* is updated
*/
public static PerReplicaStatesOps touchChildren() {

View File

@ -1463,7 +1463,7 @@ public class ZkStateReader implements SolrCloseable {
ClusterState.initReplicaStateProvider(() -> {
try {
PerReplicaStates replicaStates = PerReplicaStates.fetch(collectionPath, zkClient, null);
log.info("per-replica-state ver: {} fetched for initializing {} ", replicaStates.cversion, collectionPath);
log.debug("per-replica-state ver: {} fetched for initializing {} ", replicaStates.cversion, collectionPath);
return replicaStates;
} catch (Exception e) {
//TODO