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

fix: for auto-failover, correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950,#1967,#2351) #2386

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

chengyu-l
Copy link
Contributor

@chengyu-l chengyu-l commented Feb 2, 2024

fix: automatic fix master-slave replication relationship after master or slave service restarted (#2373, #2038, #1950,#1967,#2351)

the design proposal: #2367

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Feb 2, 2024
@AlexStocks AlexStocks changed the title fix: automatic fix master-slave replication relationship after master or slave service restarted (#2373, #2038, #1950) fix: correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950) Feb 2, 2024
@chengyu-l chengyu-l changed the title fix: correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950) fix: correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950,#1967,#2351) Feb 4, 2024
@chengyu-l chengyu-l force-pushed the failover2 branch 2 times, most recently from 55e45c1 to 4771a7d Compare February 5, 2024 11:43
return requestSetNewRedisMaster(serverAddr, "NO:ONE", auth, false)
}

func updateMasterToNewOneForce(serverAddr, masterAddr string, auth string) (err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forcefully

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return requestSetNewRedisMaster(serverAddr, masterAddr, auth, true)
}

func requestSetNewRedisMaster(serverAddr, masterAddr string, auth string, force bool) (err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setNewRedisMaster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
g.Servers[index].Action.State = state
// recheck offline status through heartbeat and automatically repair
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check whether the master is offline through heartbeat, if so, select a new master

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for _, state := range states {
var g *models.Group
if g, err = ctx.getGroup(state.GroupID); err != nil {
var group *models.Group
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

挪到for循环外

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

slave_read_only:1
db0:binlog_offset=1 284,safety_purge=none
`
ir, err := parseInfoReplication(text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return ""
}

return i.MasterHost + ":" + i.MasterPort
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joinhost

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chejinge chejinge added 3.5.3 and removed 3.5.4 labels Feb 7, 2024
@AlexStocks AlexStocks changed the title fix: correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950,#1967,#2351) fix: for auto-failover, correct master-slave replication relationship automatically after master or slave pika restarted (#2373, #2038, #1950,#1967,#2351) Feb 7, 2024
@AlexStocks AlexStocks merged commit cc23d34 into OpenAtomFoundation:unstable Feb 7, 2024
14 checks passed
chejinge added a commit that referenced this pull request Feb 7, 2024
* fix: codis-dashboard uses 100% cpu(#2332) (#2393)

Co-authored-by: liuchengyu <[email protected]>

* fix: The role displayed on the first Server in the Group area of the codis-fe is incorrect (#2350) (#2387)

Co-authored-by: liuchengyu <[email protected]>

* fix: automatic fix master-slave replication relationship after master or slave service restarted (#2373, #2038, #1950, #1967, #2351)) (#2386)

Co-authored-by: liuchengyu <[email protected]>

* feat:add 3.5.3 changelog (#2395)

* add 3.5.3 changelog
---------

Co-authored-by: chejinge <[email protected]>

---------

Co-authored-by: Chengyu Liu <[email protected]>
Co-authored-by: liuchengyu <[email protected]>
Co-authored-by: chejinge <[email protected]>
@chengyu-l chengyu-l deleted the failover2 branch February 8, 2024 08:45
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
* fix: codis-dashboard uses 100% cpu(OpenAtomFoundation#2332) (OpenAtomFoundation#2393)

Co-authored-by: liuchengyu <[email protected]>

* fix: The role displayed on the first Server in the Group area of the codis-fe is incorrect (OpenAtomFoundation#2350) (OpenAtomFoundation#2387)

Co-authored-by: liuchengyu <[email protected]>

* fix: automatic fix master-slave replication relationship after master or slave service restarted (OpenAtomFoundation#2373, OpenAtomFoundation#2038, OpenAtomFoundation#1950, OpenAtomFoundation#1967, OpenAtomFoundation#2351)) (OpenAtomFoundation#2386)

Co-authored-by: liuchengyu <[email protected]>

* feat:add 3.5.3 changelog (OpenAtomFoundation#2395)

* add 3.5.3 changelog
---------

Co-authored-by: chejinge <[email protected]>

---------

Co-authored-by: Chengyu Liu <[email protected]>
Co-authored-by: liuchengyu <[email protected]>
Co-authored-by: chejinge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.5.3 ☢️ Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants