Skip to content

Commit 07a898d

Browse files
committed
libs: update apache-curator to 5.9.0
Motivation: The in-use curator version might fail to recover leader in some cases: https://github.com/apache/curator/issues//1239 Modification: Update apacke-curator iversion to 5.9.0 Update HAServiceLeadershipManager to specify the 'behaviour of listener on explicit close' when LeaderLatch is created. Result: up-to-date curator version with a potential issue fix. Issue: #8057 Acked-by: Dmitry Litvintsev Target: master, 11.2 Require-book: no Require-notes: yes (cherry picked from commit b656f9a) Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
1 parent faec79f commit 07a898d

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

modules/cells/src/main/java/dmg/cells/zookeeper/CellCuratorFramework.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dCache - http://www.dcache.org/
22
*
3-
* Copyright (C) 2016 - 2024 Deutsches Elektronen-Synchrotron
3+
* Copyright (C) 2016 - 2026 Deutsches Elektronen-Synchrotron
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Affero General Public License as
@@ -394,6 +394,11 @@ public SchemaSet getSchemaSet() {
394394
return inner.getSchemaSet();
395395
}
396396

397+
@Override
398+
public boolean compressionEnabled() {
399+
return inner.compressionEnabled();
400+
}
401+
397402
@Override
398403
public CompletableFuture<Void> postSafeNotify(Object monitorHolder) {
399404
return inner.postSafeNotify(monitorHolder);
@@ -550,6 +555,11 @@ public CreateBackgroundModeStatACLable compressed() {
550555
return new CreateBackgroundModeStatACLableDecorator(inner.compressed());
551556
}
552557

558+
@Override
559+
public CreateBackgroundModeStatACLable uncompressed() {
560+
return new CreateBackgroundModeStatACLableDecorator(inner.uncompressed());
561+
}
562+
553563
@Override
554564
public CreateBuilder2 idempotent() {
555565
return inner.idempotent();
@@ -766,6 +776,11 @@ public GetDataWatchBackgroundStatable decompressed() {
766776
return new GetDataWatchBackgroundStatableDecorator(inner.decompressed());
767777
}
768778

779+
@Override
780+
public GetDataWatchBackgroundStatable undecompressed() {
781+
return new GetDataWatchBackgroundStatableDecorator(inner.undecompressed());
782+
}
783+
769784
@Override
770785
public byte[] forPath(String path) throws Exception {
771786
return inner.forPath(path);
@@ -842,6 +857,11 @@ public SetDataBackgroundVersionable compressed() {
842857
return new SetDataBackgroundVersionableDecorator(inner.compressed());
843858
}
844859

860+
@Override
861+
public SetDataBackgroundVersionable uncompressed() {
862+
return new SetDataBackgroundVersionableDecorator(inner.uncompressed());
863+
}
864+
845865
@Override
846866
public Stat forPath(String path, byte[] data) throws Exception {
847867
return inner.forPath(path, data);
@@ -1058,6 +1078,11 @@ public ACLCreateModePathAndBytesable<CuratorTransactionBridge> compressed() {
10581078
return new ACLCreateModePathAndBytesableDecorator<>(inner.compressed());
10591079
}
10601080

1081+
@Override
1082+
public ACLCreateModePathAndBytesable<CuratorTransactionBridge> uncompressed() {
1083+
return new ACLCreateModePathAndBytesableDecorator<>(inner.uncompressed());
1084+
}
1085+
10611086
@Override
10621087
public ACLPathAndBytesable<CuratorTransactionBridge> withMode(CreateMode mode) {
10631088
return new ACLPathAndBytesableDecorator<>(inner.withMode(mode));
@@ -1118,6 +1143,11 @@ public VersionPathAndBytesable<CuratorTransactionBridge> compressed() {
11181143
return new VersionPathAndBytesableCuratorTransactionBridgeDecorator(inner.compressed());
11191144
}
11201145

1146+
@Override
1147+
public VersionPathAndBytesable<CuratorTransactionBridge> uncompressed() {
1148+
return new VersionPathAndBytesableCuratorTransactionBridgeDecorator(inner.uncompressed());
1149+
}
1150+
11211151
@Override
11221152
public CuratorTransactionBridge forPath(String path, byte[] data) throws Exception {
11231153
return new CuratorTransactionBridgeDecorator(inner.forPath(path, data));

modules/dcache/src/main/java/org/dcache/cells/HAServiceLeadershipManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* dCache - http://www.dcache.org/
33
*
4-
* Copyright (C) 2020 - 2024 Deutsches Elektronen-Synchrotron
4+
* Copyright (C) 2020 - 2026 Deutsches Elektronen-Synchrotron
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU Affero General Public License as
@@ -35,6 +35,7 @@
3535
import java.util.concurrent.Callable;
3636
import org.apache.curator.framework.CuratorFramework;
3737
import org.apache.curator.framework.recipes.leader.LeaderLatch;
38+
import org.apache.curator.framework.recipes.leader.LeaderLatch.CloseMode;
3839
import org.apache.curator.framework.recipes.leader.LeaderLatchListener;
3940
import org.apache.curator.framework.recipes.leader.Participant;
4041
import org.apache.curator.utils.CloseableUtils;
@@ -102,7 +103,7 @@ private void createZkLeadershipPath(String serviceName) {
102103
* Creates a ZooKeeper leader latch, attaches and starts a listener.
103104
*/
104105
private void initZkLeaderListener() {
105-
zkLeaderLatch = new LeaderLatch(zkClient, zkLeaderPath, cellAddress.toString());
106+
zkLeaderLatch = new LeaderLatch(zkClient, zkLeaderPath, cellAddress.toString(), CloseMode.NOTIFY_LEADER);
106107
zkLeaderLatch.addListener(new CDCLeaderLatchListener(leadershipListener));
107108
try {
108109
zkLeaderLatch.start();
@@ -118,7 +119,7 @@ public boolean hasLeadership() {
118119

119120
private synchronized void releaseLeadership() {
120121
try {
121-
zkLeaderLatch.close(LeaderLatch.CloseMode.NOTIFY_LEADER);
122+
zkLeaderLatch.close();
122123
} catch (Exception e) {
123124
Throwables.throwIfUnchecked(e);
124125
throw new RuntimeException(e);

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
<dependency>
166166
<groupId>org.apache.curator</groupId>
167167
<artifactId>curator-recipes</artifactId>
168-
<version>5.7.0</version>
168+
<version>5.9.0</version>
169169
<exclusions>
170170
<exclusion>
171171
<groupId>org.slf4j</groupId>

0 commit comments

Comments
 (0)