-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Implemented PITR-2 #6408
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
Merged
Merged
Implemented PITR-2 #6408
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
b1113c7
Initial commit for PITR
arindamnayak 21b7a04
Initial commit for PITR -2
arindamnayak 28df598
PITR changes
arindamnayak ddf1ee9
Added some validation and fixes while testing
arindamnayak 94e6529
updated vstream to work with go routine and return the gitd back via…
arindamnayak be17562
added fix for replication
arindamnayak 0b7a255
Added timeout of gtid to time lookup
arindamnayak 6805b62
added last method to gtid
arindamnayak f4b8375
added wait for gtid catch up
arindamnayak de7c4c0
added go version of wait till postion
arindamnayak 51864ca
Fix the pos.atleast with required gtid
arindamnayak 239ebb0
sync with vitess/master
arindamnayak ca96cbc
Added mariadb last gtid impl
arindamnayak d5bc793
fix build issue
arindamnayak 1a800d9
added rippled dependency in docker
arindamnayak 47bce65
added pitr testcase
arindamnayak a9bbf8e
checked in the binary for testing
arindamnayak 4acba2e
Added rippled as extra bin path
arindamnayak 1c9fd18
Added binlog server as process
arindamnayak 6a00e4c
added testcase for recovery
arindamnayak f72e277
added check for last pos
arindamnayak 21f5ab3
fix the pitr testcase
arindamnayak 17627c6
tweak the test case
arindamnayak 0317a79
Merge branch 'master' into pitr-2
arindamnayak 53dded5
merged with latest master
arindamnayak 943903c
rearranged the testcases
arindamnayak d24e79e
include changes for improving the error messages and comments, variab…
arindamnayak 653ad37
merge docker tests to matrix
arindamnayak f694c31
updated workflow
arindamnayak ff5a0d2
Rervert back to individual action
arindamnayak 7bb7863
remove the skipmetacheck from unneeded place
arindamnayak c500654
Implemented suggestion in PR comments
arindamnayak eaf2454
handle the case where upto snapshot time there is no binlog event
arindamnayak 6abb509
fix the vstream end of events
arindamnayak ecf278b
improved the comment and rearrange the tests
arindamnayak 5b64ddc
Replace string check with gtid.pos.atleast
arindamnayak 878c871
updated flag name and improvement on code comments
arindamnayak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| package pitr | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "path" | ||
| "strings" | ||
| "syscall" | ||
| "time" | ||
|
|
||
| "vitess.io/vitess/go/vt/log" | ||
| ) | ||
|
|
||
| const ( | ||
| binlogExecutableName = "rippled" | ||
| binlogDataDir = "binlog_dir" | ||
| binlogUser = "ripple" | ||
| ) | ||
|
|
||
| type binLogServer struct { | ||
| hostname string | ||
| port int | ||
| username string | ||
| dataDirectory string | ||
| executablePath string | ||
|
|
||
| proc *exec.Cmd | ||
| exit chan error | ||
| } | ||
|
|
||
| type mysqlMaster struct { | ||
| hostname string | ||
| port int | ||
| username string | ||
| password string | ||
| } | ||
|
|
||
| // newBinlogServer returns an instance of binlog server | ||
| func newBinlogServer(hostname string, port int) (*binLogServer, error) { | ||
| dataDir := path.Join(os.Getenv("VTDATAROOT"), binlogDataDir) | ||
| fmt.Println(dataDir) | ||
| if _, err := os.Stat(dataDir); os.IsNotExist(err) { | ||
| err := os.Mkdir(dataDir, 0700) | ||
| if err != nil { | ||
| log.Error(err) | ||
| return nil, err | ||
| } | ||
| } | ||
| return &binLogServer{ | ||
| executablePath: path.Join(os.Getenv("EXTRA_BIN"), binlogExecutableName), | ||
| dataDirectory: dataDir, | ||
| username: binlogUser, | ||
| hostname: hostname, | ||
| port: port, | ||
| }, nil | ||
| } | ||
|
|
||
| // start starts the binlog server points to running mysql port | ||
| func (bs *binLogServer) start(master mysqlMaster) error { | ||
| bs.proc = exec.Command( | ||
| bs.executablePath, | ||
| fmt.Sprintf("-ripple_datadir=%s", bs.dataDirectory), | ||
| fmt.Sprintf("-ripple_master_address=%s", master.hostname), | ||
| fmt.Sprintf("-ripple_master_port=%d", master.port), | ||
| fmt.Sprintf("-ripple_master_user=%s", master.username), | ||
| fmt.Sprintf("-ripple_server_ports=%d", bs.port), | ||
| ) | ||
| if master.password != "" { | ||
| bs.proc.Args = append(bs.proc.Args, fmt.Sprintf("-ripple_master_password=%s", master.password)) | ||
| } | ||
|
|
||
| errFile, _ := os.Create(path.Join(bs.dataDirectory, "log.txt")) | ||
| bs.proc.Stderr = errFile | ||
|
|
||
| bs.proc.Env = append(bs.proc.Env, os.Environ()...) | ||
|
|
||
| log.Infof("Running binlog server with command: %v", strings.Join(bs.proc.Args, " ")) | ||
|
|
||
| err := bs.proc.Start() | ||
| if err != nil { | ||
| return err | ||
| } | ||
| bs.exit = make(chan error) | ||
| go func() { | ||
| if bs.proc != nil { | ||
| bs.exit <- bs.proc.Wait() | ||
| } | ||
| }() | ||
| return nil | ||
| } | ||
|
|
||
| func (bs *binLogServer) stop() error { | ||
| if bs.proc == nil || bs.exit == nil { | ||
| return nil | ||
| } | ||
| // Attempt graceful shutdown with SIGTERM first | ||
| bs.proc.Process.Signal(syscall.SIGTERM) | ||
|
|
||
| select { | ||
| case err := <-bs.exit: | ||
| bs.proc = nil | ||
| return err | ||
|
|
||
| case <-time.After(10 * time.Second): | ||
| bs.proc.Process.Kill() | ||
| bs.proc = nil | ||
| return <-bs.exit | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.