From 5ec26e19f9cfab509bac92e18ee8662a922c5043 Mon Sep 17 00:00:00 2001 From: Weny Xu Date: Thu, 24 Oct 2024 11:09:03 +0800 Subject: [PATCH] docs: remove dist lock doc (#1228) --- docs/contributor-guide/metasrv/dist-lock.md | 57 ------------------- .../contributor-guide/metasrv/dist-lock.md | 57 ------------------- .../contributor-guide/metasrv/dist-lock.md | 57 ------------------- sidebars.ts | 1 - .../contributor-guide/metasrv/dist-lock.md | 57 ------------------- versioned_sidebars/version-0.9-sidebars.json | 1 - 6 files changed, 230 deletions(-) delete mode 100644 docs/contributor-guide/metasrv/dist-lock.md delete mode 100644 i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/dist-lock.md delete mode 100644 i18n/zh/docusaurus-plugin-content-docs/version-0.9/contributor-guide/metasrv/dist-lock.md delete mode 100644 versioned_docs/version-0.9/contributor-guide/metasrv/dist-lock.md diff --git a/docs/contributor-guide/metasrv/dist-lock.md b/docs/contributor-guide/metasrv/dist-lock.md deleted file mode 100644 index 6458ae9ed..000000000 --- a/docs/contributor-guide/metasrv/dist-lock.md +++ /dev/null @@ -1,57 +0,0 @@ -# Distributed Lock - -## Introduction - -`Metasrv` provides the functionality of distributed locks via `gRPC`. - -## How to use - -The [meta-client][1] crate provides a Rust-based meta client implementation. - -[1]: https://github.com/GreptimeTeam/greptimedb/tree/main/src/meta-client - -For example: - -```rust -async fn do_some_work(meta_client: MetaClient) { - let name = b"lock_name".to_vec(); - let expire_secs = 60; - - let lock_req = LockRequest { name, expire_secs }; - - let lock_result = meta_client.lock(lock_req).await.unwrap(); - let key = lock_result.key; - - info!("do some work, take 3 seconds"); - tokio::time::sleep(Duration::from_secs(3)).await; - - let unlock_req = UnlockRequest { key }; - - meta_client.unlock(unlock_req).await.unwrap(); - info!("unlock success!"); -} -``` - -More examples [here][2]. - -[2]: https://github.com/GreptimeTeam/greptimedb/blob/main/src/meta-client/examples/lock.rs - -Because gRPC works across languages, it is easy to implement clients for other programming languages. - -You can find the protocol buffer definition [here][3]. - -[3]: https://github.com/GreptimeTeam/greptime-proto/blob/main/proto/greptime/v1/meta/lock.proto - -Pay attention to the following points: - -1. The distributed lock will be automatically released if it exceeds its expiration time and is still being held. -2. When using distributed locks, you must set a suitable expiration time, default: 10 seconds. -3. Distributed lock's expiration time should be shorter than the 'gRPC' channel's timeout; otherwise, it may cause a 'gRPC' timeout error, resulting in lock failure. - -## Detailed design - -The current implementation of distributed lock is based on [etcd][4]. We have defined the `Lock` trait, and `EtcdLock` is one of the available implementations. - -[4]: https://etcd.io/docs/v3.5/dev-guide/api_concurrency_reference_v3/ - -Since `etcd` maintains the state of the distributed lock, both the `Metasrv` leader and its follower nodes can provide the Lock's `gRPC` service. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/dist-lock.md b/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/dist-lock.md deleted file mode 100644 index 6458ae9ed..000000000 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/dist-lock.md +++ /dev/null @@ -1,57 +0,0 @@ -# Distributed Lock - -## Introduction - -`Metasrv` provides the functionality of distributed locks via `gRPC`. - -## How to use - -The [meta-client][1] crate provides a Rust-based meta client implementation. - -[1]: https://github.com/GreptimeTeam/greptimedb/tree/main/src/meta-client - -For example: - -```rust -async fn do_some_work(meta_client: MetaClient) { - let name = b"lock_name".to_vec(); - let expire_secs = 60; - - let lock_req = LockRequest { name, expire_secs }; - - let lock_result = meta_client.lock(lock_req).await.unwrap(); - let key = lock_result.key; - - info!("do some work, take 3 seconds"); - tokio::time::sleep(Duration::from_secs(3)).await; - - let unlock_req = UnlockRequest { key }; - - meta_client.unlock(unlock_req).await.unwrap(); - info!("unlock success!"); -} -``` - -More examples [here][2]. - -[2]: https://github.com/GreptimeTeam/greptimedb/blob/main/src/meta-client/examples/lock.rs - -Because gRPC works across languages, it is easy to implement clients for other programming languages. - -You can find the protocol buffer definition [here][3]. - -[3]: https://github.com/GreptimeTeam/greptime-proto/blob/main/proto/greptime/v1/meta/lock.proto - -Pay attention to the following points: - -1. The distributed lock will be automatically released if it exceeds its expiration time and is still being held. -2. When using distributed locks, you must set a suitable expiration time, default: 10 seconds. -3. Distributed lock's expiration time should be shorter than the 'gRPC' channel's timeout; otherwise, it may cause a 'gRPC' timeout error, resulting in lock failure. - -## Detailed design - -The current implementation of distributed lock is based on [etcd][4]. We have defined the `Lock` trait, and `EtcdLock` is one of the available implementations. - -[4]: https://etcd.io/docs/v3.5/dev-guide/api_concurrency_reference_v3/ - -Since `etcd` maintains the state of the distributed lock, both the `Metasrv` leader and its follower nodes can provide the Lock's `gRPC` service. diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-0.9/contributor-guide/metasrv/dist-lock.md b/i18n/zh/docusaurus-plugin-content-docs/version-0.9/contributor-guide/metasrv/dist-lock.md deleted file mode 100644 index 6458ae9ed..000000000 --- a/i18n/zh/docusaurus-plugin-content-docs/version-0.9/contributor-guide/metasrv/dist-lock.md +++ /dev/null @@ -1,57 +0,0 @@ -# Distributed Lock - -## Introduction - -`Metasrv` provides the functionality of distributed locks via `gRPC`. - -## How to use - -The [meta-client][1] crate provides a Rust-based meta client implementation. - -[1]: https://github.com/GreptimeTeam/greptimedb/tree/main/src/meta-client - -For example: - -```rust -async fn do_some_work(meta_client: MetaClient) { - let name = b"lock_name".to_vec(); - let expire_secs = 60; - - let lock_req = LockRequest { name, expire_secs }; - - let lock_result = meta_client.lock(lock_req).await.unwrap(); - let key = lock_result.key; - - info!("do some work, take 3 seconds"); - tokio::time::sleep(Duration::from_secs(3)).await; - - let unlock_req = UnlockRequest { key }; - - meta_client.unlock(unlock_req).await.unwrap(); - info!("unlock success!"); -} -``` - -More examples [here][2]. - -[2]: https://github.com/GreptimeTeam/greptimedb/blob/main/src/meta-client/examples/lock.rs - -Because gRPC works across languages, it is easy to implement clients for other programming languages. - -You can find the protocol buffer definition [here][3]. - -[3]: https://github.com/GreptimeTeam/greptime-proto/blob/main/proto/greptime/v1/meta/lock.proto - -Pay attention to the following points: - -1. The distributed lock will be automatically released if it exceeds its expiration time and is still being held. -2. When using distributed locks, you must set a suitable expiration time, default: 10 seconds. -3. Distributed lock's expiration time should be shorter than the 'gRPC' channel's timeout; otherwise, it may cause a 'gRPC' timeout error, resulting in lock failure. - -## Detailed design - -The current implementation of distributed lock is based on [etcd][4]. We have defined the `Lock` trait, and `EtcdLock` is one of the available implementations. - -[4]: https://etcd.io/docs/v3.5/dev-guide/api_concurrency_reference_v3/ - -Since `etcd` maintains the state of the distributed lock, both the `Metasrv` leader and its follower nodes can provide the Lock's `gRPC` service. diff --git a/sidebars.ts b/sidebars.ts index f0e968ec5..1af6fda24 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -433,7 +433,6 @@ const sidebars: SidebarsConfig = { items: [ 'contributor-guide/metasrv/overview', 'contributor-guide/metasrv/admin-api', - 'contributor-guide/metasrv/dist-lock', 'contributor-guide/metasrv/selector', ], }, diff --git a/versioned_docs/version-0.9/contributor-guide/metasrv/dist-lock.md b/versioned_docs/version-0.9/contributor-guide/metasrv/dist-lock.md deleted file mode 100644 index 6458ae9ed..000000000 --- a/versioned_docs/version-0.9/contributor-guide/metasrv/dist-lock.md +++ /dev/null @@ -1,57 +0,0 @@ -# Distributed Lock - -## Introduction - -`Metasrv` provides the functionality of distributed locks via `gRPC`. - -## How to use - -The [meta-client][1] crate provides a Rust-based meta client implementation. - -[1]: https://github.com/GreptimeTeam/greptimedb/tree/main/src/meta-client - -For example: - -```rust -async fn do_some_work(meta_client: MetaClient) { - let name = b"lock_name".to_vec(); - let expire_secs = 60; - - let lock_req = LockRequest { name, expire_secs }; - - let lock_result = meta_client.lock(lock_req).await.unwrap(); - let key = lock_result.key; - - info!("do some work, take 3 seconds"); - tokio::time::sleep(Duration::from_secs(3)).await; - - let unlock_req = UnlockRequest { key }; - - meta_client.unlock(unlock_req).await.unwrap(); - info!("unlock success!"); -} -``` - -More examples [here][2]. - -[2]: https://github.com/GreptimeTeam/greptimedb/blob/main/src/meta-client/examples/lock.rs - -Because gRPC works across languages, it is easy to implement clients for other programming languages. - -You can find the protocol buffer definition [here][3]. - -[3]: https://github.com/GreptimeTeam/greptime-proto/blob/main/proto/greptime/v1/meta/lock.proto - -Pay attention to the following points: - -1. The distributed lock will be automatically released if it exceeds its expiration time and is still being held. -2. When using distributed locks, you must set a suitable expiration time, default: 10 seconds. -3. Distributed lock's expiration time should be shorter than the 'gRPC' channel's timeout; otherwise, it may cause a 'gRPC' timeout error, resulting in lock failure. - -## Detailed design - -The current implementation of distributed lock is based on [etcd][4]. We have defined the `Lock` trait, and `EtcdLock` is one of the available implementations. - -[4]: https://etcd.io/docs/v3.5/dev-guide/api_concurrency_reference_v3/ - -Since `etcd` maintains the state of the distributed lock, both the `Metasrv` leader and its follower nodes can provide the Lock's `gRPC` service. diff --git a/versioned_sidebars/version-0.9-sidebars.json b/versioned_sidebars/version-0.9-sidebars.json index a0ad854d6..6ab68ef3e 100644 --- a/versioned_sidebars/version-0.9-sidebars.json +++ b/versioned_sidebars/version-0.9-sidebars.json @@ -467,7 +467,6 @@ "items": [ "contributor-guide/metasrv/overview", "contributor-guide/metasrv/admin-api", - "contributor-guide/metasrv/dist-lock", "contributor-guide/metasrv/selector" ] },