File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
#
3
3
#
4
- RELEASE_VERSION=" 0.7.17 "
4
+ RELEASE_VERSION=" 0.8.1 "
5
5
6
6
buildpath=/tmp/gh-ost
7
7
target=gh-ost
Original file line number Diff line number Diff line change 9
9
"flag"
10
10
"fmt"
11
11
"os"
12
+ "os/signal"
13
+ "syscall"
12
14
13
15
"github.com/github/gh-ost/go/base"
14
16
"github.com/github/gh-ost/go/logic"
@@ -17,6 +19,26 @@ import (
17
19
18
20
var AppVersion string
19
21
22
+ // acceptSignals registers for OS signals
23
+ func acceptSignals (migrationContext * base.MigrationContext ) {
24
+ c := make (chan os.Signal , 1 )
25
+
26
+ signal .Notify (c , syscall .SIGHUP )
27
+ go func () {
28
+ for sig := range c {
29
+ switch sig {
30
+ case syscall .SIGHUP :
31
+ log .Infof ("Received SIGHUP. Reloading configuration" )
32
+ if err := migrationContext .ReadConfigFile (); err != nil {
33
+ log .Errore (err )
34
+ } else {
35
+ migrationContext .MarkPointOfInterest ()
36
+ }
37
+ }
38
+ }
39
+ }()
40
+ }
41
+
20
42
// main is the application's entry point. It will either spawn a CLI or HTTP itnerfaces.
21
43
func main () {
22
44
migrationContext := base .GetMigrationContext ()
@@ -122,6 +144,7 @@ func main() {
122
144
migrationContext .ApplyCredentials ()
123
145
124
146
log .Infof ("starting gh-ost %+v" , AppVersion )
147
+ acceptSignals (migrationContext )
125
148
126
149
migrator := logic .NewMigrator ()
127
150
err := migrator .Migrate ()
Original file line number Diff line number Diff line change @@ -606,7 +606,7 @@ func (this *Migrator) printStatus() {
606
606
shouldPrintStatus = (elapsedSeconds % 5 == 0 )
607
607
} else if elapsedSeconds <= 180 {
608
608
shouldPrintStatus = (elapsedSeconds % 5 == 0 )
609
- } else if this .migrationContext .TimeSincePointOfInterest () <= 60 {
609
+ } else if this .migrationContext .TimeSincePointOfInterest (). Seconds () <= 60 {
610
610
shouldPrintStatus = (elapsedSeconds % 5 == 0 )
611
611
} else {
612
612
shouldPrintStatus = (elapsedSeconds % 30 == 0 )
Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ func (this *EventsStreamer) StreamEvents(canStopStreaming func() bool) error {
189
189
for {
190
190
if err := this .binlogReader .StreamEvents (canStopStreaming , this .eventsChannel ); err != nil {
191
191
log .Infof ("StreamEvents encountered unexpected error: %+v" , err )
192
+ this .migrationContext .MarkPointOfInterest ()
192
193
time .Sleep (ReconnectStreamerSleepSeconds * time .Second )
193
194
194
195
// Reposition at same binlog file. Single attempt (TODO: make multiple attempts?)
You can’t perform that action at this time.
0 commit comments