Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pika_for_cluster #1632

Merged
merged 146 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
b42c846
add integrate test
May 18, 2023
a029afe
回滚配置文件
May 18, 2023
0398f6a
回滚配置文件
May 18, 2023
dfef19c
回滚配置文件
May 18, 2023
48e135f
修改执行脚本
May 19, 2023
5e66778
start pika action
May 19, 2023
34c405c
start pika action
May 19, 2023
ee7c494
start pika action
May 19, 2023
d99829d
start pika action
May 19, 2023
4eff686
start pika action
May 19, 2023
2c3e6d0
设置后台启动pika
May 19, 2023
56d5b6e
设置后台启动pika
May 19, 2023
ea58a25
rollback pika.yaml
May 19, 2023
a964610
Merge pull request #6 from luky116/newCode2
luky116 May 22, 2023
561f69e
resolve conflict
May 22, 2023
f717881
feat: merge integ test (#8)
luky116 May 22, 2023
7e0cce6
delete_sharding_mode
chejinge May 22, 2023
fe48386
delete_sharding_mode (#10)
chejinge May 22, 2023
7e9c088
add_slot_command
chejinge May 22, 2023
12978e5
Update pika_conf.cc
chejinge May 22, 2023
124c7d0
Merge branch 'unstable' into unstable
chejinge May 22, 2023
2e850bb
Update pika.yml
chejinge May 22, 2023
898ed68
feat: merge integ test (#8)
luky116 May 22, 2023
835dd93
delete_sharding_mode (#10)
chejinge May 22, 2023
baae84d
Merge pull request #13 from chejinge/pikiwi/rebase
chejinge May 25, 2023
df65771
Merge branch 'pikiwidb:unstable' into unstable
chejinge May 25, 2023
e298ad2
Update pika_slot.cc
chejinge May 25, 2023
851aab7
add codis sentinel
May 29, 2023
b830570
Merge remote-tracking branch 'piki/unstable' into refactorPikaCodis
May 29, 2023
f70dbb3
bugfix
chejinge May 30, 2023
c61f1fd
point->smartpoint
chejinge May 30, 2023
26395d2
Merge pull request #14 from chejinge/unstable
chejinge May 30, 2023
22202fc
resolve conflict
May 30, 2023
1b7004c
fix some bug
May 30, 2023
be73a06
fix auto select master bug
May 30, 2023
9cc66ec
remove previous sentinel code
May 30, 2023
2f8c07e
remove unused code
May 30, 2023
395ba82
remove proxy's sentinel code
May 30, 2023
6630a57
remove sentinel code
May 30, 2023
16fffe0
Merge pull request #20 from luky116/mergeCode2
AlexStocks May 31, 2023
96bcbbd
std::shared_ptr<Partition>partition->std::shared_ptr<Slot>slot
chejinge May 31, 2023
8f22916
referator class slot nocopable
chejinge May 31, 2023
d8172d8
Merge pull request #25 from chejinge/unstable
AlexStocks May 31, 2023
b4357a6
partition->slot
chejinge May 31, 2023
bef47f9
Merge pull request #26 from chejinge/unstable
AlexStocks May 31, 2023
fd5ad3b
partition->slot
chejinge May 31, 2023
ae2b56e
tools reverst
chejinge May 31, 2023
7183f00
Db->DB
chejinge May 31, 2023
a2f1732
Merge pull request #27 from chejinge/unstable
AlexStocks May 31, 2023
baedec9
table->db
chejinge May 31, 2023
75143ff
table->db
chejinge May 31, 2023
e242a06
cmddb->cmdtable
chejinge May 31, 2023
d6fc5f3
table->db
chejinge Jun 1, 2023
708a338
Merge pull request #28 from chejinge/unstable
AlexStocks Jun 1, 2023
c2b93eb
add_codis_slot_command
chejinge Jun 2, 2023
a62bdb3
add_slot_command
chejinge Jun 2, 2023
f719532
reslove_build_bug
chejinge Jun 2, 2023
d7a5493
add table_db
chejinge Jun 4, 2023
5cb2ced
fix
chejinge Jun 4, 2023
43eb9cb
fix
chejinge Jun 5, 2023
ca5db3a
add_slot_debug
chejinge Jun 5, 2023
1635c40
Merge pull request #30 from chejinge/unstable
chejinge Jun 5, 2023
df147d3
add key to slot sets
Jun 5, 2023
c607612
add key to slot sets
Jun 5, 2023
0355477
fix
Jun 6, 2023
cbd0c44
fix
Jun 6, 2023
4782e6c
Merge pull request #31 from luky116/debugSlotCmmand
chejinge Jun 6, 2023
7b7afe8
fix slotsmgrt_sender_thread_ bug
Jun 6, 2023
716844d
Merge remote-tracking branch 'piki/debugSlotCmmand' into tmplocal
Jun 6, 2023
48fead0
add pika megrate thread
Jun 7, 2023
3d517d2
fix SLOTSMGRTTAGSLOT (#33)
chejinge Jun 7, 2023
fa70e40
支持多线程进行迁移slot
Jun 7, 2023
8ea06d7
fix slotsmgrt_sender_thread_ bug (#32)
luky116 Jun 7, 2023
4c8e2df
support multi-threaded migration slots (#37)
luky116 Jun 7, 2023
b7cc151
feat: add SlotsDel and SlotsHashKey cmd (#38)
chejinge Jun 7, 2023
61816c6
Fix lock conflicts in multithreading
Jun 7, 2023
b69ac59
fix conflict
Jun 7, 2023
79c9a4d
remove comment
Jun 7, 2023
74adff0
add todo comment
Jun 8, 2023
5304449
reslove conflict
chejinge Jun 8, 2023
f3be4f2
reslove_conflict
chejinge Jun 8, 2023
18158d6
reslove_build_bug
chejinge Jun 8, 2023
b5954ff
rename func
Jun 8, 2023
7acfc95
fix_info_command
chejinge Jun 9, 2023
aac6b02
set running_ atomic bool
Jun 9, 2023
2ff1521
fast failed
Jun 9, 2023
b89e48a
use func
Jun 9, 2023
f57497e
Merge pull request #39 from luky116/fixLocks
AlexStocks Jun 9, 2023
eff73cc
switch_code_style
chejinge Jun 9, 2023
ad6de6b
add slotsmgrt-exec-wrapper
Jun 9, 2023
98aa7c5
fix_pika_conf
chejinge Jun 9, 2023
f28afc7
fix_code_note
chejinge Jun 9, 2023
e1bf1c0
Merge pull request #42 from chejinge/mergecode
chejinge Jun 9, 2023
8929910
fast failed
Jun 10, 2023
f24f40b
Merge pull request #44 from luky116/addSlotsmgrt-exec-wrapper
chejinge Jun 12, 2023
0db8995
fix_info_command&&addslots_scan_command (#46)
chejinge Jun 12, 2023
29b4a17
fix slots-hash-key cmd bug (#49)
luky116 Jun 12, 2023
0ff0c5a
feat: add slot migrate cmd (#53)
luky116 Jun 13, 2023
27d6580
fix conflict
Jun 13, 2023
e49a41e
merge unstable code
luky116 Jun 13, 2023
e6fb62d
fix: rename function GetSlotID
luky116 Jun 13, 2023
77c56ef
fix_slot_info_command (#67)
chejinge Jun 14, 2023
968b510
optimize: remove unsed param (#83)
luky116 Jun 14, 2023
11495e4
optimize code style (#89)
luky116 Jun 14, 2023
3a77be8
slotsscan add param check (#94)
chejinge Jun 14, 2023
eeeeb8d
support config rewite slotmigrate param (#97)
chejinge Jun 14, 2023
76d32fc
refactor async migrate (#95)
luky116 Jun 14, 2023
3e4a73d
fix slotsmgrt-async-status command (#99)
luky116 Jun 14, 2023
5160b18
fix slotsmgrt-exec-wrapper command (#100)
luky116 Jun 15, 2023
7753160
Slotclean slot reload (#85)
chejinge Jun 15, 2023
0da527a
feat: add binlog when migrate (#59)
luky116 Jun 15, 2023
a829e23
fix_slot_command_code_style (#102)
chejinge Jun 16, 2023
d9b92da
set const std::shared_ptr param (#103)
luky116 Jun 16, 2023
3e6777e
feat: append binlog when add slot key (#106)
luky116 Jun 16, 2023
4781115
fix problem (#111)
luky116 Jun 16, 2023
6ee0077
feat: slotscleanup cmd add binlog (#115)
luky116 Jun 16, 2023
78a467d
optimize async migrate (#110)
luky116 Jun 16, 2023
a8b2ad3
optimize code style (#117)
chejinge Jun 17, 2023
737685b
resolve conflict
Jun 19, 2023
f37871c
Merge pull request #119 from luky116/mergeCode-0619
luky116 Jun 19, 2023
95201f0
class_member init value (#120)
chejinge Jun 19, 2023
43e98ca
fix_code_style (#122)
chejinge Jun 19, 2023
4fbf4bc
fix_code_style (#123)
chejinge Jun 20, 2023
6e28907
Fix code style (#124)
chejinge Jun 20, 2023
f8ca11e
resolve conflict
Jun 20, 2023
e852762
fix_repl (#129)
chejinge Jun 20, 2023
96e96df
Update rpoplpush_replication_test.py
chejinge Jun 20, 2023
05507ee
fix comment
Jun 21, 2023
51c76a4
fix comment
Jun 21, 2023
7d9ccfd
remove unsed code
Jun 21, 2023
6a9f504
fix ci
Jun 21, 2023
c6d3122
update comment to english
Jun 21, 2023
5aa7372
fix client define
Jun 21, 2023
388216e
add config
Jun 21, 2023
30339f0
add json tag
Jun 21, 2023
6d52824
format code
Jun 21, 2023
f0395ee
add log
Jun 21, 2023
82cdcee
refactor codis sentinel
luky116 Jun 21, 2023
0f666dc
fix_redis_cli_connect_bug (#133)
chejinge Jun 25, 2023
21f7ada
mergecodetopikiwd
chejinge Jun 26, 2023
2e38d66
Merge branch 'debugSlotCmmand' into add_code_merge
chejinge Jun 26, 2023
67a349c
remove_clang-tidy
chejinge Jun 26, 2023
96b6cb8
Merge pull request #137 from chejinge/add_code_merge
chejinge Jun 26, 2023
fa67bf5
fix_yaml (#138)
chejinge Jun 26, 2023
1cea953
remove sentinel code (#139)
luky116 Jun 26, 2023
74c01bf
doc: fix ci yaml
chejinge Jun 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,21 @@ Checks: '
-clang-diagnostic-ignored-optimization-argument,
-readability-implicit-bool-conversion,
'
# naming check
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.MemberSuffix, value: _ }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalVariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalVariablePrefix,value: g_pika }
# CheckOptions:
# - { key: readability-identifier-naming.ClassCase, value: CamelCase }
# - { key: readability-identifier-naming.EnumCase, value: CamelCase }
# - { key: readability-identifier-naming.FunctionCase, value: CamelCase }
# - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
# - { key: readability-identifier-naming.MemberCase, value: lower_case }
# - { key: readability-identifier-naming.MemberSuffix, value: _ }
# - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
# - { key: readability-identifier-naming.StructCase, value: CamelCase }
# - { key: readability-identifier-naming.UnionCase, value: CamelCase }
# - { key: readability-identifier-naming.VariableCase, value: lower_case }

WarningsAsErrors: '*'
HeaderFilterRegex: '(src/net/..|src/storage/include|src/pstd/..|src/pstd/include|src/net/..)'
# HeaderFilterRegex: '(|/src|/src/net|/src/pstd|/src/storage)/include'
# HeaderFilterRegex: '/src/(net|storage|pstd)/include'
AnalyzeTemporaryDtors: true

#### Disabled checks and why: #####
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
sudo apt install autoconf libprotobuf-dev protobuf-compiler -y
sudo apt-get install -y clang-tidy-12
# sudo apt-get install -y clang-tidy-12
sudo apt-get install -y python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install redis
Expand All @@ -47,9 +47,9 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Clang-tidy Check
working-directory: ${{github.workspace}}/build
run: make clang-tidy
#- name: Clang-tidy Check
# working-directory: ${{github.workspace}}/build
# run: make clang-tidy

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down Expand Up @@ -90,8 +90,8 @@ jobs:
run: |
yum install -y wget git autoconf centos-release-scl
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
yum install -y llvm-toolset-7
yum install -y llvm-toolset-7-clang
# yum install -y llvm-toolset-7
# yum install -y llvm-toolset-7-clang
source /opt/rh/devtoolset-10/enable
gcc --version
make --version
Expand Down Expand Up @@ -125,9 +125,9 @@ jobs:
source /opt/rh/devtoolset-10/enable
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Clang-tidy Check
working-directory: ${{github.workspace}}/build
run: make clang-tidy
#- name: Clang-tidy Check
# working-directory: ${{github.workspace}}/build
# run: make clang-tidy

- name: Test
# Execute tests defined by the CMake configuration.
Expand All @@ -136,4 +136,3 @@ jobs:
cd ${{github.workspace}}/build
source /opt/rh/devtoolset-10/enable
ctest -C ${{env.BUILD_TYPE}}

6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ if (${AUTOCONF} MATCHES AUTOCONF-NOTFOUND)
message(FATAL_ERROR "not find autoconf on localhost")
endif()

set(CLANG_SEARCH_PATH "/usr/local/bin" "/usr/bin" "/usr/local/opt/llvm/bin"
"/usr/local/opt/llvm@12/bin")
#set(CLANG_SEARCH_PATH "/usr/local/bin" "/usr/bin" "/usr/local/opt/llvm/bin"
# "/usr/local/opt/llvm@12/bin")
find_program(CLANG_TIDY_BIN
NAMES clang-tidy clang-tidy-12
HINTS ${CLANG_SEARCH_PATH})
Expand Down Expand Up @@ -784,6 +784,7 @@ add_custom_target(
clang-tidy
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_clang_tidy.py
-clang-tidy-binary ${CLANG_TIDY_BIN}
-header-filter='${PROJECT_SOURCE_DIR}(/include|/tools|/src)/.*'
-p ${CMAKE_BINARY_DIR}
-quiet
)
Expand All @@ -792,6 +793,7 @@ add_custom_target(clang-tidy-fix
${CMAKE_CURRENT_SOURCE_DIR}/run_clang_tidy.py
-clang-tidy-binary ${CLANG_TIDY_BIN}
-p ${CMAKE_BINARY_DIR}
-header-filter='${PROJECT_SOURCE_DIR}(/include|/tools|/src)/.*'
-clang-apply-replacements-binary ${CLANG_APPLY_REPLACEMENTS_BIN}
-fix
)
45 changes: 0 additions & 45 deletions codis/cmd/admin/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ func (t *cmdDashboard) Main(d map[string]interface{}) {
case d["--promote-server"].(bool):
t.handleGroupCommand(d)

case d["--sentinel-add"].(bool):
fallthrough
case d["--sentinel-del"].(bool):
fallthrough
case d["--sentinel-resync"].(bool):
t.handleSentinelCommand(d)

case d["--sync-action"].(bool):
t.handleSyncActionCommand(d)

Expand Down Expand Up @@ -632,44 +625,6 @@ func (t *cmdDashboard) handleGroupCommand(d map[string]interface{}) {
}
}

func (t *cmdDashboard) handleSentinelCommand(d map[string]interface{}) {
c := t.newTopomClient()

switch {

case d["--sentinel-add"].(bool):

addr := utils.ArgumentMust(d, "--addr")

log.Debugf("call rpc add-sentinel to dashboard %s", t.addr)
if err := c.AddSentinel(addr); err != nil {
log.PanicErrorf(err, "call rpc add-sentinel to dashboard %s failed", t.addr)
}
log.Debugf("call rpc add-sentinel OK")

case d["--sentinel-del"].(bool):

addr := utils.ArgumentMust(d, "--addr")

force := d["--force"].(bool)

log.Debugf("call rpc del-sentinel to dashboard %s", t.addr)
if err := c.DelSentinel(addr, force); err != nil {
log.PanicErrorf(err, "call rpc del-sentinel to dashboard %s failed", t.addr)
}
log.Debugf("call rpc del-sentinel OK")

case d["--sentinel-resync"].(bool):

log.Debugf("call rpc resync-sentinels to dashboard %s", t.addr)
if err := c.ResyncSentinels(); err != nil {
log.PanicErrorf(err, "call rpc resync-sentinels to dashboard %s failed", t.addr)
}
log.Debugf("call rpc resync-sentinels OK")

}
}

func (t *cmdDashboard) handleSyncActionCommand(d map[string]interface{}) {
c := t.newTopomClient()

Expand Down
101 changes: 0 additions & 101 deletions codis/cmd/fe/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -654,107 +654,6 @@ <h4 style="padding-left:30px; padding-right:20px; display: inline;">Group</h4>
</table>
</div>
</div>

<div class="row" style="min-width: 1200px">
<div class="col-md-12"
style="margin-bottom: 10px; margin-top: 30px; padding-bottom: 10px; border-bottom: solid 1px lightgray;">
<form class="form-inline">
<h4 style="padding-left:30px; padding-right:20px; display: inline;">Sentinels</h4>
</form>
</div>
<div class="col-md-12"
style="padding-bottom: 10px">
<form class="form-inline">
<span ng-if="codis_addr != 'NA'">
<button class="btn btn-warning btn-sm active" style="width: 120px; font-size: 14px; padding: 2px;"
ng-click="addSentinel(new_sentinel_addr)"
ng-disabled="!new_sentinel_addr">Add Sentinel
</button>
<input style="height: 28px; width: 250px; " type="text" class="form-control"
placeholder="Redis Sentinel Address"
ng-model="new_sentinel_addr">
</span>
</form>
</div>
<div class="col-md-4"
style="padding-bottom: 10px">
<table class="table table-bordered table-striped table-hover table-condensed" style="white-space: nowrap">
<thead>
<tr>
<th style="width: 85px; text-align: center">
<span ng-switch="sentinel_out_of_sync">
<span ng-switch-when="true">
<button class="btn btn-danger btn-xs active"
data-toggle="tooltip" data-placement="right" title="RESYNC ALL SENTINELS & PROXIES"
style="width: 70px;"
ng-click="resyncSentinels()">
SYNC
</button>
</span>
<span ng-switch-default>
<button class="btn btn-primary btn-xs active"
data-toggle="tooltip" data-placement="right" title="RESYNC ALL SENTINELS & PROXIES"
style="width: 70px;"
ng-click="resyncSentinels()">
SYNC
</button>
</span>
</span>
</th>
<th style="min-width: 220px;">
Sentinels
<span ng-if="sentinel_out_of_sync" style="color: white; background-color: red">
(OUT OF SYNC)
</span>
</th>
<th style="min-width: 35px;"/>
<th style="min-width: 350px;">
Status
</th>
<th style="min-width: 35px;"/>
<th style="min-width: 35px;"/>
</tr>
</thead>
<tr ng-repeat="sentinel in sentinel_servers">
<td style="text-align: center">
<a ng-href="http://[[codis_addr]]/api/topom/sentinels/info/[[sentinel.server]]/monitored" style="width: 70px;" target="_blank" class="btn btn-default btn-xs active" role="button">WATCHED</a>
</td>
<td>
<a ng-href="http://[[codis_addr]]/api/topom/sentinels/info/[[sentinel.server]]" target="_blank" class="btn btn-default btn-xs active" role="button">S</a>
<span>
[[sentinel.server]]
</span>
</td>
<td class="button_tight_column" style="text-align: center">
<button class="btn btn-danger btn-xs active" ng-if="sentinel.status == 'ERROR'"
data-toggle="tooltip" data-placement="right" title="FORCE REMOVE SENTINEL [[sentinel.server]]"
ng-click="delSentinel(sentinel, true)">
<span class="glyphicon glyphicon-remove"></span>
</button>
</td>
<td ng-switch="sentinel.status">
<span ng-switch-when="ERROR" class="status_label_error">[[sentinel.status]]</span>
<span ng-switch-when="TIMEOUT" class="status_label_warning">[[sentinel.status]]</span>
<span ng-switch-when="PENDING" class="status_label_pending">[[sentinel.status]]</span>
<span ng-switch-default>[[sentinel.status_text]]</span>
</td>
<td ng-switch="sentinel.runid_error != ''">
<span ng-switch-when="true" style="color: red">[[sentinel.runid_error]]</span>
<span ng-switch-default/>
</td>
<td class="button_tight_column">
<button class="btn btn-danger btn-xs active"
data-toggle="tooltip" data-placement="right" title="REMOVE SENTINEL [[sentinel.server]]"
ng-click="delSentinel(sentinel, false)">
<span class="glyphicon glyphicon-minus"></span>
</button>
</td>
</tr>
</tbody>
</table>
</div>

</div>
</div>
</div>

Expand Down
4 changes: 4 additions & 0 deletions codis/config/dashboard.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ migration_async_numkeys = 500
migration_timeout = "30s"

# Set configs for redis sentinel.
sentinel_check_server_state_interval = "5s"
sentinel_check_master_failover_interval = "1s"
sentinel_master_dead_check_times = 5

sentinel_client_timeout = "10s"
sentinel_quorum = 2
sentinel_parallel_syncs = 1
Expand Down
2 changes: 1 addition & 1 deletion codis/config/proxy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ backend_replica_parallel = 1
backend_keepalive_period = "75s"

# Set number of databases of backend.
backend_number_databases = 16
backend_number_databases = 6

# If there is no request from client for a long time, the connection will be closed. (0 to disable)
# Set session recv buffer size & timeout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ backend_replica_parallel = 1
backend_keepalive_period = "75s"

# Set number of databases of backend.
backend_number_databases = 16
backend_number_databases = 6

# If there is no request from client for a long time, the connection will be closed. (0 to disable)
# Set session recv buffer size & timeout.
Expand Down
6 changes: 3 additions & 3 deletions codis/pkg/models/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package models
import (
"time"

"pika/codis/v2/pkg/models/etcd"
"pika/codis/v2/pkg/models/fs"
"pika/codis/v2/pkg/models/zk"
etcdclient "pika/codis/v2/pkg/models/etcd"
fsclient "pika/codis/v2/pkg/models/fs"
zkclient "pika/codis/v2/pkg/models/zk"
"pika/codis/v2/pkg/utils/errors"
)

Expand Down
26 changes: 26 additions & 0 deletions codis/pkg/models/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ type Group struct {
OutOfSync bool `json:"out_of_sync"`
}

func (g *Group) GetServersMap() map[string]*GroupServer {
results := make(map[string]*GroupServer)
for _, server := range g.Servers {
results[server.Addr] = server
}
return results
}

type GroupServerState int8

const (
GroupServerStateNormal GroupServerState = iota
GroupServerStateSubjectiveOffline
GroupServerStateOffline
)

type GroupServer struct {
Addr string `json:"server"`
DataCenter string `json:"datacenter"`
Expand All @@ -26,6 +42,16 @@ type GroupServer struct {
State string `json:"state,omitempty"`
} `json:"action"`

// master or slave
Role string `json:"role"`
// If it is a master node, take the master_repl_offset field, otherwise take the slave_repl_offset field
ReplyOffset int `json:"reply_offset"`
// Monitoring status, 0 normal, 1 subjective offline, 2 actual offline
// If marked as 2 , no service is provided
State GroupServerState `json:"state"`

ReCallTimes int8 `json:"recall_times"`

ReplicaGroup bool `json:"replica_group"`
}

Expand Down
Loading