Compare commits
1 Commits
master
...
update-dep
Author | SHA1 | Date | |
---|---|---|---|
|
b972a8b693 |
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
@ -61,9 +61,6 @@ It is not reliable to parse the `ALTER` statement to determine if it is instant
|
|||||||
|
|
||||||
`gh-ost` will automatically fallback to the normal DDL process if the attempt to use instant DDL is unsuccessful.
|
`gh-ost` will automatically fallback to the normal DDL process if the attempt to use instant DDL is unsuccessful.
|
||||||
|
|
||||||
### binlogsyncer-max-reconnect-attempts
|
|
||||||
`--binlogsyncer-max-reconnect-attempts=0`, the maximum number of attempts to re-establish a broken inspector connection for sync binlog. `0` or `negative number` means infinite retry, default `0`
|
|
||||||
|
|
||||||
### conf
|
### conf
|
||||||
|
|
||||||
`--conf=/path/to/my.cnf`: file where credentials are specified. Should be in (or contain) the following format:
|
`--conf=/path/to/my.cnf`: file where credentials are specified. Should be in (or contain) the following format:
|
||||||
|
@ -232,8 +232,6 @@ type MigrationContext struct {
|
|||||||
|
|
||||||
recentBinlogCoordinates mysql.BinlogCoordinates
|
recentBinlogCoordinates mysql.BinlogCoordinates
|
||||||
|
|
||||||
BinlogSyncerMaxReconnectAttempts int
|
|
||||||
|
|
||||||
Log Logger
|
Log Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,15 +36,14 @@ func NewGoMySQLReader(migrationContext *base.MigrationContext) *GoMySQLReader {
|
|||||||
currentCoordinates: mysql.BinlogCoordinates{},
|
currentCoordinates: mysql.BinlogCoordinates{},
|
||||||
currentCoordinatesMutex: &sync.Mutex{},
|
currentCoordinatesMutex: &sync.Mutex{},
|
||||||
binlogSyncer: replication.NewBinlogSyncer(replication.BinlogSyncerConfig{
|
binlogSyncer: replication.NewBinlogSyncer(replication.BinlogSyncerConfig{
|
||||||
ServerID: uint32(migrationContext.ReplicaServerId),
|
ServerID: uint32(migrationContext.ReplicaServerId),
|
||||||
Flavor: gomysql.MySQLFlavor,
|
Flavor: gomysql.MySQLFlavor,
|
||||||
Host: connectionConfig.Key.Hostname,
|
Host: connectionConfig.Key.Hostname,
|
||||||
Port: uint16(connectionConfig.Key.Port),
|
Port: uint16(connectionConfig.Key.Port),
|
||||||
User: connectionConfig.User,
|
User: connectionConfig.User,
|
||||||
Password: connectionConfig.Password,
|
Password: connectionConfig.Password,
|
||||||
TLSConfig: connectionConfig.TLSConfig(),
|
TLSConfig: connectionConfig.TLSConfig(),
|
||||||
UseDecimal: true,
|
UseDecimal: true,
|
||||||
MaxReconnectAttempts: migrationContext.BinlogSyncerMaxReconnectAttempts,
|
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,6 @@ func main() {
|
|||||||
flag.Int64Var(&migrationContext.HooksStatusIntervalSec, "hooks-status-interval", 60, "how many seconds to wait between calling onStatus hook")
|
flag.Int64Var(&migrationContext.HooksStatusIntervalSec, "hooks-status-interval", 60, "how many seconds to wait between calling onStatus hook")
|
||||||
|
|
||||||
flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")
|
flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")
|
||||||
flag.IntVar(&migrationContext.BinlogSyncerMaxReconnectAttempts, "binlogsyncer-max-reconnect-attempts", 0, "when master node fails, the maximum number of binlog synchronization attempts to reconnect. 0 is unlimited")
|
|
||||||
|
|
||||||
maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes")
|
maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes")
|
||||||
criticalLoad := flag.String("critical-load", "", "Comma delimited status-name=threshold, same format as --max-load. When status exceeds threshold, app panics and quits")
|
criticalLoad := flag.String("critical-load", "", "Comma delimited status-name=threshold, same format as --max-load. When status exceeds threshold, app panics and quits")
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
gosql "database/sql"
|
gosql "database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -934,7 +935,7 @@ func (this *Applier) CreateAtomicCutOverSentryTable() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AtomicCutOverMagicLock
|
// AtomicCutOverMagicLock
|
||||||
func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocked chan<- error, okToUnlockTable <-chan bool, tableUnlocked chan<- error) error {
|
func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocked chan<- error, okToUnlockTable <-chan bool, tableUnlocked chan<- error, dropCutOverSentryTableOnce *sync.Once) error {
|
||||||
tx, err := this.db.Begin()
|
tx, err := this.db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tableLocked <- err
|
tableLocked <- err
|
||||||
@ -945,7 +946,6 @@ func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocke
|
|||||||
tableLocked <- fmt.Errorf("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads")
|
tableLocked <- fmt.Errorf("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads")
|
||||||
tableUnlocked <- fmt.Errorf("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads")
|
tableUnlocked <- fmt.Errorf("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads")
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
this.DropAtomicCutOverSentryTableIfExists()
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var sessionId int64
|
var sessionId int64
|
||||||
@ -1014,10 +1014,12 @@ func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocke
|
|||||||
sql.EscapeName(this.migrationContext.GetOldTableName()),
|
sql.EscapeName(this.migrationContext.GetOldTableName()),
|
||||||
)
|
)
|
||||||
|
|
||||||
if _, err := tx.Exec(query); err != nil {
|
dropCutOverSentryTableOnce.Do(func() {
|
||||||
this.migrationContext.Log.Errore(err)
|
if _, err := tx.Exec(query); err != nil {
|
||||||
// We DO NOT return here because we must `UNLOCK TABLES`!
|
this.migrationContext.Log.Errore(err)
|
||||||
}
|
// We DO NOT return here because we must `UNLOCK TABLES`!
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Tables still locked
|
// Tables still locked
|
||||||
this.migrationContext.Log.Infof("Releasing lock from %s.%s, %s.%s",
|
this.migrationContext.Log.Infof("Releasing lock from %s.%s, %s.%s",
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -638,8 +639,12 @@ func (this *Migrator) atomicCutOver() (err error) {
|
|||||||
defer atomic.StoreInt64(&this.migrationContext.InCutOverCriticalSectionFlag, 0)
|
defer atomic.StoreInt64(&this.migrationContext.InCutOverCriticalSectionFlag, 0)
|
||||||
|
|
||||||
okToUnlockTable := make(chan bool, 4)
|
okToUnlockTable := make(chan bool, 4)
|
||||||
|
var dropCutOverSentryTableOnce sync.Once
|
||||||
defer func() {
|
defer func() {
|
||||||
okToUnlockTable <- true
|
okToUnlockTable <- true
|
||||||
|
dropCutOverSentryTableOnce.Do(func() {
|
||||||
|
this.applier.DropAtomicCutOverSentryTableIfExists()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
|
|
||||||
atomic.StoreInt64(&this.migrationContext.AllEventsUpToLockProcessedInjectedFlag, 0)
|
atomic.StoreInt64(&this.migrationContext.AllEventsUpToLockProcessedInjectedFlag, 0)
|
||||||
@ -648,7 +653,7 @@ func (this *Migrator) atomicCutOver() (err error) {
|
|||||||
tableLocked := make(chan error, 2)
|
tableLocked := make(chan error, 2)
|
||||||
tableUnlocked := make(chan error, 2)
|
tableUnlocked := make(chan error, 2)
|
||||||
go func() {
|
go func() {
|
||||||
if err := this.applier.AtomicCutOverMagicLock(lockOriginalSessionIdChan, tableLocked, okToUnlockTable, tableUnlocked); err != nil {
|
if err := this.applier.AtomicCutOverMagicLock(lockOriginalSessionIdChan, tableLocked, okToUnlockTable, tableUnlocked, &dropCutOverSentryTableOnce); err != nil {
|
||||||
this.migrationContext.Log.Errore(err)
|
this.migrationContext.Log.Errore(err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user