Skip to content

Commit 6278f7a

Browse files
committed
[hotfix][runtime] Guard DEBUG log calls with isDebugEnabled in ZooKeeperLeaderRetrievalDriver
1 parent 916faa8 commit 6278f7a

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalDriver.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ public ZooKeeperLeaderRetrievalDriver(
104104

105105
client.getConnectionStateListenable().addListener(connectionStateListener);
106106

107-
LOG.debug(
108-
"Monitoring data change in {}",
109-
ZooKeeperUtils.generateZookeeperPath(
110-
client.getNamespace(), connectionInformationPath));
107+
if (LOG.isDebugEnabled()) {
108+
LOG.debug(
109+
"Monitoring data change in {}",
110+
ZooKeeperUtils.generateZookeeperPath(
111+
client.getNamespace(), connectionInformationPath));
112+
}
111113

112114
running = true;
113115
}
@@ -142,7 +144,9 @@ public void close() throws Exception {
142144

143145
private void retrieveLeaderInformationFromZooKeeper() {
144146
try {
145-
LOG.debug("Leader node has changed.");
147+
if (LOG.isDebugEnabled()) {
148+
LOG.debug("Leader node has changed.");
149+
}
146150

147151
final ChildData childData = cache.getCurrentData(connectionInformationPath);
148152

@@ -170,7 +174,9 @@ private void retrieveLeaderInformationFromZooKeeper() {
170174
private void handleStateChange(ConnectionState newState) {
171175
switch (newState) {
172176
case CONNECTED:
173-
LOG.debug("Connected to ZooKeeper quorum. Leader retrieval can start.");
177+
if (LOG.isDebugEnabled()) {
178+
LOG.debug("Connected to ZooKeeper quorum. Leader retrieval can start.");
179+
}
174180
break;
175181
case SUSPENDED:
176182
LOG.warn("Connection to ZooKeeper suspended, waiting for reconnection.");

0 commit comments

Comments
 (0)