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 829099da5b0 Revise code format for #34169 (#34176)
829099da5b0 is described below
commit 829099da5b051e083546777a389616657c0b347d
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Dec 27 14:20:31 2024 +0800
Revise code format for #34169 (#34176)
* Revise code format for #34169
* Revise code format for #34169
---
.../shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.cn.md | 2 ++
.../shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.en.md | 4 ++++
.../shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.cn.md | 2 ++
.../shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.en.md | 5 +++++
parser/distsql/engine/src/main/antlr4/imports/Keyword.g4 | 2 +-
.../distsql/statement/ral/updatable/LockClusterStatement.java | 5 +++++
.../distsql/statement/ral/updatable/UnlockClusterStatement.java | 5 +++++
7 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.cn.md
index ad51c5bafbb..f3082e0396b 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.cn.md
@@ -11,6 +11,7 @@ weight = 16
{{< tabs >}}
{{% tab name="语法" %}}
+
```sql
LockClusterWith ::=
'LOCK' 'CLUSTER' 'WITH' lockStrategy ('TIMEOUT' timeoutMillis)?
@@ -18,6 +19,7 @@ LockClusterWith ::=
timeoutmillis ::=
long
```
+
{{% /tab %}}
{{% tab name="铁路图" %}}
<iframe frameborder="0" name="diagram" id="diagram" width="100%"
height="100%"></iframe>
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.en.md
index 469e0386488..989ee638559 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/lock-cluster-with.en.md
@@ -11,6 +11,7 @@ The `LOCK CLUSTER WITH` syntax is utilized to apply a lock
with a specific algor
{{< tabs >}}
{{% tab name="Grammar" %}}
+
```sql
LockClusterWith ::=
'LOCK' 'CLUSTER' 'WITH' lockStrategy ('TIMEOUT' timeoutMillis)?
@@ -33,10 +34,13 @@ timeoutmillis ::=
### Example
- Lock the `CLUSTER` with an exclusive lock without setting the timeout.
+-
```sql
LOCK CLUSTER WITH WRITE;
```
+
- Lock the CLUSTER with a read-write lock and set the timeout to 2000
milliseconds.
+-
```sql
LOCK CLUSTER WITH READ_WRITE TIMEOUT 2000;
```
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.cn.md
index 4fb0e462d2a..ab9e748279a 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.cn.md
@@ -11,6 +11,7 @@ weight = 17
{{< tabs >}}
{{% tab name="语法" %}}
+
```sql
UnlockCluster ::=
'UNLOCK' 'CLUSTER' ('TIMEOUT' timeoutMillis)?
@@ -18,6 +19,7 @@ UnlockCluster ::=
timeoutmillis ::=
long
```
+
{{% /tab %}}
{{% tab name="铁路图" %}}
<iframe frameborder="0" name="diagram" id="diagram" width="100%"
height="100%"></iframe>
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.en.md
index b7114d80ccc..2f64bddf7c4 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/unlock-cluster.en.md
@@ -11,6 +11,7 @@ The `UNLOCK CLUSTER` syntax is used to release the lock
applied to the `CLUSTER`
{{< tabs >}}
{{% tab name="Grammar" %}}
+
```sql
UnlockCluster ::=
'UNLOCK' 'CLUSTER' ('TIMEOUT' timeoutMillis)?
@@ -28,13 +29,17 @@ timeoutmillis ::=
- When the `CLUSTER` is not in a locked state, it is impossible to release the
lock; otherwise, an exception will be thrown.
- `timeoutMillis` is used to indicate the timeout duration for attempting to
unlock, with the unit being milliseconds. When not specified, the default value
is 3,000 milliseconds.
+
### Example
- Unlock the `CLUSTER` without setting a timeout.
+-
```sql
UNLOCK CLUSTER;
```
+
- Unlock the `CLUSTER` and set the timeout to 2000 milliseconds.
+
```sql
UNLOCK CLUSTER TIMEOUT 2000;
```
diff --git a/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
b/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
index 00e963e5536..d369824714b 100644
--- a/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
+++ b/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
@@ -345,4 +345,4 @@ CHECK_PRIVILEGES
TIMEOUT
: T I M E O U T
- ;
\ No newline at end of file
+ ;
diff --git
a/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/LockClusterStatement.java
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/LockClusterStatement.java
index 04915e9038a..d8f11fa7440 100644
---
a/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/LockClusterStatement.java
+++
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/LockClusterStatement.java
@@ -34,6 +34,11 @@ public final class LockClusterStatement extends
UpdatableRALStatement {
private final Long timeoutMillis;
+ /**
+ * Get lock timeout milliseconds.
+ *
+ * @return lock timeout milliseconds
+ */
public Optional<Long> getTimeoutMillis() {
return Optional.of(timeoutMillis);
}
diff --git
a/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/UnlockClusterStatement.java
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/UnlockClusterStatement.java
index fe584b661af..870edede5cd 100644
---
a/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/UnlockClusterStatement.java
+++
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/updatable/UnlockClusterStatement.java
@@ -29,6 +29,11 @@ public final class UnlockClusterStatement extends
UpdatableRALStatement {
private final Long timeoutMillis;
+ /**
+ * Get lock timeout milliseconds.
+ *
+ * @return lock timeout milliseconds
+ */
public Optional<Long> getTimeoutMillis() {
return Optional.of(timeoutMillis);
}