Skip to content

Commit

Permalink
Fix the dump and restore core race in case of -persistent flag enab…
Browse files Browse the repository at this point in the history
…led (correct approach)
  • Loading branch information
M. Mert Yildiran committed Feb 9, 2022
1 parent 53014c6 commit 54e90bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ func init() {
macros: make(map[string]string),
}

// Trigger partitioning check for every second.
ticker := time.NewTicker(1 * time.Second)
go periodicPartitioner(ticker)

// Initiate the global watcher
var err error
watcher, err = fsnotify.NewWatcher()
Expand All @@ -199,8 +195,13 @@ func main() {
} else {
// Clean up the database files.
removeDatabaseFiles()
newPartition()
}

// Trigger partitioning check for every second.
ticker := time.NewTicker(1 * time.Second)
go periodicPartitioner(ticker)

// Print version and exit.
if *version {
fmt.Printf("%s\n", VERSION)
Expand Down
7 changes: 7 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@ func TestServerProtocolLimitMode(t *testing.T) {
partitionIndex: -1,
}

f := newPartition()
assert.NotNil(t, f)

// Trigger partitioning check for every second.
ticker := time.NewTicker(1 * time.Second)
go periodicPartitioner(ticker)

server, client := net.Pipe()
go handleConnection(server)

Expand Down

0 comments on commit 54e90bc

Please sign in to comment.