This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new f4c1815c531 Rename global lock's key from /lock/exclusive/locks to
/lock/global/locks (#34142)
f4c1815c531 is described below
commit f4c1815c53142090777fd0c4d3f98b8ef4691fc2
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 24 22:03:27 2024 +0800
Rename global lock's key from /lock/exclusive/locks to /lock/global/locks
(#34142)
---
.../apache/shardingsphere/mode/lock/global/GlobalLockDefinition.java | 2 +-
.../shardingsphere/mode/lock/global/GlobalLockDefinitionTest.java | 2 +-
.../manager/cluster/persist/service/GlobalLockPersistServiceTest.java | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinition.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinition.java
index 76376151d59..77f2d032c7a 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinition.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinition.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.lock.LockDefinition;
@Getter
public final class GlobalLockDefinition implements LockDefinition {
- private static final String KEY_PATTERN = "/lock/exclusive/locks/%s";
+ private static final String KEY_PATTERN = "/lock/global/locks/%s";
private final String lockKey;
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinitionTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinitionTest.java
index 82ee55f24a6..ee6bb5b62f6 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinitionTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/lock/global/GlobalLockDefinitionTest.java
@@ -30,6 +30,6 @@ class GlobalLockDefinitionTest {
void assertGetLockKey() {
GlobalLock globalLock = mock(GlobalLock.class);
when(globalLock.getName()).thenReturn("foo_lock");
- assertThat(new GlobalLockDefinition(globalLock).getLockKey(),
is("/lock/exclusive/locks/foo_lock"));
+ assertThat(new GlobalLockDefinition(globalLock).getLockKey(),
is("/lock/global/locks/foo_lock"));
}
}
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistServiceTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistServiceTest.java
index 6a34617d5b2..ddc86c19683 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistServiceTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistServiceTest.java
@@ -47,7 +47,7 @@ class GlobalLockPersistServiceTest {
@Test
void assertTryLock() {
-
when(repository.getDistributedLockHolder().getDistributedLock("/lock/exclusive/locks/foo_lock").tryLock(1000L)).thenReturn(true);
+
when(repository.getDistributedLockHolder().getDistributedLock("/lock/global/locks/foo_lock").tryLock(1000L)).thenReturn(true);
GlobalLockDefinition lockDefinition = new
GlobalLockDefinition(globalLock);
assertTrue(new
GlobalLockPersistService(repository).tryLock(lockDefinition, 1000L));
}
@@ -56,6 +56,6 @@ class GlobalLockPersistServiceTest {
void assertUnlock() {
GlobalLockDefinition lockDefinition = new
GlobalLockDefinition(globalLock);
new GlobalLockPersistService(repository).unlock(lockDefinition);
-
verify(repository.getDistributedLockHolder().getDistributedLock("/lock/exclusive/locks/foo_lock")).unlock();
+
verify(repository.getDistributedLockHolder().getDistributedLock("/lock/global/locks/foo_lock")).unlock();
}
}