From ea7632988e4b7654387601eecfd46c62300b991f Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Tue, 2 Jan 2024 15:26:15 +0800 Subject: [PATCH] feat(doc): update segment.md --- documentation/docs/guide/segment.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/documentation/docs/guide/segment.md b/documentation/docs/guide/segment.md index a63e081981..f41bff3e72 100644 --- a/documentation/docs/guide/segment.md +++ b/documentation/docs/guide/segment.md @@ -16,9 +16,27 @@ - `Step`越小,乱序程度越小。当`Step=1`时,将无限接近单调递增。需要注意的是这里是无限接近而非等于单调递增,具体原因你可以思考一下这样一个场景: - 号段分发器T1时刻给**Instance 1**分发了`ID=1`,T2时刻给**Instance 2**分发了`ID=2`。因为机器性能、网络等原因,`Instance 2`网络IO写请求先于`Instance 1`到达。那么这个时候对于数据库来说,ID依然是乱序的。 +## 具体实现 -## IdSegmentDistributor +```mermaid +classDiagram +direction BT +class DefaultSegmentId +class IdGenerator { +<> -## SegmentChainId +} +class SegmentChainId +class SegmentId { +<> + +} +class StringSegmentId + +DefaultSegmentId ..> SegmentId +SegmentChainId ..> SegmentId +SegmentId --> IdGenerator +StringSegmentId ..> IdGenerator +StringSegmentId ..> SegmentId +``` -## PrefetchWorker