Skip to content

Commit 28c5abf

Browse files
Mixficsolwangshao1wuxianrong
authored
fix: 355 cherrypick 40 (#3062)
* fix: Reduced ReadCache tags for some commands (#3034) * fix: Fixed an issue with asynchronous loading (#3037) * summary different stages duration && add rocksdb perfcontext (#3036) * fix: The number of element updates in RedisCache is configurable (#3043) * The number of element updates in RedisCache is configurable Co-authored-by: wuxianrong <[email protected]> * fix: fix replication on pika node recovering (#3038) * fix: Fix problems found during testing (#3039) * Example Modify the policy for updating big keys except String to Redis-Cache (#3047) Co-authored-by: wuxianrong <[email protected]> * add auth command to admin-thread-pool (#3048) Co-authored-by: wuxianrong <[email protected]> * fix: Example Repair the subjective and objective offline logic of noeds (#3049) * Example Repair the subjective and objective offline logic of primary and secondary nodes * fix comment --------- Co-authored-by: wuxianrong <[email protected]> * fix: Fixed version information for Pika, Pika_exporter, Codis (#3054) * Fixed version information for Pika, Pika_exporter, Codis * Delete redundant logic --------- Co-authored-by: wuxianrong <[email protected]> * fix: Fixed versions of Pika, Pika_exporter, Codis (#3057) * Resolve conflict differences * Resolve conflict differences * Resolve conflict differences * fix string test * change by review --------- Co-authored-by: wangshao1 <[email protected]> Co-authored-by: wuxianrong <[email protected]>
1 parent 590afe9 commit 28c5abf

41 files changed

Lines changed: 898 additions & 144 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ endif()
738738
aux_source_directory(src DIR_SRCS)
739739

740740
# # generate version
741-
string(TIMESTAMP TS "%Y-%m-%d %H:%M:%S" UTC)
742-
set(PIKA_BUILD_DATE "${TS}" CACHE STRING "the time we first built pika")
741+
string(TIMESTAMP TS "%Y-%m-%d %H:%M:%S")
742+
set(PIKA_BUILD_DATE "${TS}")
743743

744744
find_package(Git)
745745

codis/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
export GO111MODULE=on
44

5-
build-all: codis-dashboard codis-proxy codis-admin codis-ha codis-fe
5+
build-all: generate-version codis-dashboard codis-proxy codis-admin codis-ha codis-fe
66

77
PRJ_ROOT=${CURDIR}
88

9+
generate-version:
10+
$(info generate version)
11+
@mkdir -p ./bin && ./version
912

1013
codis-deps:
11-
@mkdir -p ./bin && go version
12-
14+
@go version
1315
codis-dashboard: codis-deps
1416
$(info build codis-dashboard)
1517
@cd ${PRJ_ROOT}/cmd/dashboard && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-dashboard .

codis/cmd/dashboard/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ Options:
4848
return
4949

5050
case d["--version"].(bool):
51-
fmt.Println("version:", utils.Version)
52-
fmt.Println("compile:", utils.Compile)
51+
fmt.Printf("-----------Codis Dashboard----------\n")
52+
fmt.Println("codis_version:", utils.Version)
53+
fmt.Println("codis_git_sha:", utils.Gitsha)
54+
fmt.Println("codis_build_compile_date:", utils.Compile)
55+
fmt.Println("go version:", utils.GoVersion)
5356
return
5457

5558
}

codis/cmd/fe/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ Options:
7272
}
7373

7474
if d["--version"].(bool) {
75-
fmt.Println("version:", utils.Version)
76-
fmt.Println("compile:", utils.Compile)
75+
fmt.Printf("-----------Codis FE----------\n")
76+
fmt.Println("codis_version:", utils.Version)
77+
fmt.Println("codis_git_sha:", utils.Gitsha)
78+
fmt.Println("codis_build_compile_date:", utils.Compile)
79+
fmt.Println("go version:", utils.GoVersion)
7780
return
7881
}
7982

codis/cmd/ha/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ Options:
3333
}
3434

3535
if d["--version"].(bool) {
36-
fmt.Println("version:", utils.Version)
37-
fmt.Println("compile:", utils.Compile)
36+
fmt.Printf("-----------Codis HA----------\n")
37+
fmt.Println("codis_version:", utils.Version)
38+
fmt.Println("codis_git_sha:", utils.Gitsha)
39+
fmt.Println("codis_build_compile_date:", utils.Compile)
40+
fmt.Println("go version:", utils.GoVersion)
3841
return
3942
}
4043

codis/cmd/proxy/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ Options:
5555
return
5656

5757
case d["--version"].(bool):
58-
fmt.Println("version:", utils.Version)
59-
fmt.Println("compile:", utils.Compile)
58+
fmt.Printf("-----------Codis Proxy----------\n")
59+
fmt.Println("codis_version:", utils.Version)
60+
fmt.Println("codis_git_sha:", utils.Gitsha)
61+
fmt.Println("codis_build_compile_date:", utils.Compile)
62+
fmt.Println("go version:", utils.GoVersion)
6063
return
6164

6265
}

codis/pkg/topom/topom_group.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,11 @@ func (s *Topom) tryFixReplicationRelationship(group *models.Group, groupServer *
381381
}
382382
}
383383
} else {
384-
// skip if it has right replication relationship
385-
if state.Replication.GetMasterAddr() == curMasterAddr {
386-
return nil
387-
}
388-
389-
// current server is slave, execute the command `slaveof [new master ip] [new master port] force`
390-
if err = updateMasterToNewOneForcefully(groupServer.Addr, curMasterAddr, s.config.ProductAuth); err != nil {
391-
return err
384+
if state.Replication.GetMasterAddr() != curMasterAddr {
385+
// current server is slave, execute the command `slaveof [new master ip] [new master port]`
386+
if err = updateMasterToNewOne(groupServer.Addr, curMasterAddr, s.config.ProductAuth); err != nil {
387+
return err
388+
}
392389
}
393390
}
394391

codis/pkg/topom/topom_sentinel.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,36 @@ func (s *Topom) checkAndUpdateGroupServerState(conf *Config, group *models.Group
7474
}
7575

7676
// Start the election master node
77-
if groupServer.State == models.GroupServerStateOffline && isGroupMaster(state, group) {
78-
*masterOfflineGroups = append(*masterOfflineGroups, group)
79-
} else {
80-
*slaveOfflineGroups = append(*slaveOfflineGroups, group)
77+
// Currently, both primary and secondary nodes have subjective and objective logics.
78+
// If it is subjective, we will not perform any operation. If more than 10 probe counts
79+
// fail, it is defined as objective logics, If it is an objective offline, we will add the
80+
// node to masterOfflineGroups or slaveOfflineGroups respectively, and then notify the Proxy
81+
// to change the meta information
82+
if groupServer.State == models.GroupServerStateOffline {
83+
if isGroupMaster(state, group) {
84+
*masterOfflineGroups = append(*masterOfflineGroups, group)
85+
} else {
86+
*slaveOfflineGroups = append(*slaveOfflineGroups, group)
87+
}
8188
}
8289
}
8390
} else {
8491
if groupServer.State == models.GroupServerStateOffline {
8592
*recoveredGroupServers = append(*recoveredGroupServers, state)
8693
// update GroupServer to GroupServerStateNormal state later
8794
} else {
95+
// This may contains any of following condition:
96+
// 1. groupServer.State is Normal
97+
// 2. groupServer.State is GroupServerStateSubjectiveOffline and is Master
98+
// 3. groupServer.State is GroupServerStateSubjectiveOffline and is Slave
99+
// for condition 3, if current server's previous state is SubjectiveOffline
100+
// and has been added to slaveofflinegroups before,
101+
// should also resync mappings to proxy to enable replicationgroup
102+
if groupServer.State == models.GroupServerStateSubjectiveOffline &&
103+
!isGroupMaster(state, group) &&
104+
group.OutOfSync {
105+
*recoveredGroupServers = append(*recoveredGroupServers, state)
106+
}
88107
// Update the offset information of the state and role nodes
89108
groupServer.State = models.GroupServerStateNormal
90109
groupServer.ReCallTimes = 0

codis/pkg/utils/redis/sentinel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ func (i *InfoReplication) UnmarshalJSON(b []byte) error {
106106
}
107107

108108
i.Role = kvmap["role"]
109-
i.MasterPort = kvmap["master_host"]
110-
i.MasterHost = kvmap["master_port"]
109+
i.MasterPort = kvmap["master_port"]
110+
i.MasterHost = kvmap["master_host"]
111111
i.MasterLinkStatus = kvmap["master_link_status"]
112112
i.IsEligibleForMasterElection = kvmap["is_eligible_for_master_election"] == "true"
113113

codis/pkg/utils/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package utils
22

33
const (
4-
Version = "2018-11-04 16:22:35 +0800 @de1ad026e329561c22e2a3035fbfe89dc7fef764 @3.2.2-12-gde1ad026"
5-
Compile = "2023-02-23 11:25:09 +0800 by go version go1.19.6 linux/amd64"
4+
Version = "3.5.4"
5+
Gitsha = "5c5d89d5478138d64bd071840beab30a64105075"
6+
Compile = "2025-03-26 11:30:14 CST"
7+
GoVersion = "go1.23.4 darwin/amd64"
68
)

0 commit comments

Comments
 (0)