Skip to content

Commit 7bd8059

Browse files
committed
fix gh-ost install
1 parent 43acf58 commit 7bd8059

3 files changed

Lines changed: 30 additions & 32 deletions

File tree

go/base/context.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,11 +1156,10 @@ func SendWithContext[T any](ctx context.Context, ch chan<- T, val T) error {
11561156

11571157
func (mctx *MigrationContext) NewFailPoint(name string) {
11581158
if mctx.UnsafeFailPointsEnabled {
1159-
mctx.Log.Debugf("Injecting fail point: %s", name)
1159+
mctx.Log.Debugf("[TEST] Injecting fail point: '%s'", name)
11601160

1161-
failpoint.Inject(name, func(val failpoint.Value) {
1162-
mctx.Log.Debugf("Encountered fail point: %s", name)
1163-
panic(fmt.Sprintf("encountered fail point: '%s'", name))
1161+
failpoint.Inject(name, func(_ failpoint.Value) {
1162+
panic(fmt.Sprintf("[TEST] Encountered fail point: '%s'", name))
11641163
})
11651164
}
11661165
}

go/logic/applier.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"github.com/github/gh-ost/go/mysql"
3030
drivermysql "github.com/go-sql-driver/mysql"
3131
"github.com/openark/golib/sqlutils"
32-
"github.com/pingcap/failpoint"
3332
)
3433

3534
const (
@@ -1452,16 +1451,16 @@ func (apl *Applier) ApplyIterationInsertQuery() (chunkSize int64, rowsAffected i
14521451
// ApplyIterationMoveTableCopyQueries issues a SELECT query on the original table and an INSERT query on the target table,
14531452
// copying a chunk of rows. It is used when `--move-tables` is specified, instead of ApplyIterationInsertQuery.
14541453
func (apl *Applier) ApplyIterationMoveTableCopyQueries(sourceDB *gosql.DB) (chunkSize int64, rowsAffected int64, duration time.Duration, err error) {
1455-
//apl.migrationContext.NewFailPoint("panic-on-row-copy")
1456-
if apl.migrationContext.UnsafeFailPointsEnabled {
1457-
name := "panic-on-row-copy"
1458-
apl.migrationContext.Log.Debugf("Injecting fail point: %s", name)
1459-
1460-
failpoint.Inject(name, func(val failpoint.Value) {
1461-
apl.migrationContext.Log.Debugf("Encountered fail point: %s", name)
1462-
panic(fmt.Sprintf("encountered fail point: '%s'", name))
1463-
})
1464-
}
1454+
apl.migrationContext.NewFailPoint("panic-on-row-copy")
1455+
//if apl.migrationContext.UnsafeFailPointsEnabled {
1456+
// name := "panic-on-row-copy"
1457+
// apl.migrationContext.Log.Debugf("Injecting fail point: %s", name)
1458+
1459+
// failpoint.Inject(name, func(_ failpoint.Value) {
1460+
// apl.migrationContext.Log.Debugf("Encountered fail point: %s", name)
1461+
// panic(fmt.Sprintf("encountered fail point: '%s'", name))
1462+
// })
1463+
//}
14651464

14661465
startTime := time.Now()
14671466
chunkSize = atomic.LoadInt64(&apl.migrationContext.ChunkSize)

localtests/move-tables-test.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@ build_ghost_command() {
183183
move_tables_arg=$(IFS=, ; echo "${tables_to_migrate[*]}")
184184

185185
# NOTE(chriskirkland): fully qualified package name + failpoint name
186-
FAILPOINT="github.com/github/gh-ost/go/logic/panic-on-row-copy=return(true)"
187-
cmd="GOTRACEBACK=crash \
188-
GO_FAILPOINTS='github.com/github/gh-ost/go/logic/panic-on-row-copy=return(true)' \
189-
$ghost_binary \
186+
cmd="GOTRACEBACK=crash GO_FAILPOINTS=\"github.com/github/gh-ost/go/base/panic-on-row-copy=return(true)\" $ghost_binary \
190187
--move-tables=$move_tables_arg \
191188
--user=root \
192189
--password=opensesame \
@@ -464,27 +461,29 @@ test_single() {
464461
done
465462
}
466463

467-
install_failpoint() {
468-
pushd $repo_root/../..
469-
470-
if [ ! -d "pingcap/failpoint" ]; then
464+
enable_failpoint() {
465+
mkdir -p $repo_root/tools/bin
466+
if [ ! -f $repo_root/tools/bin/failpoint-ctl ]; then
471467
echo "⚙️ Installing failpoint"
472-
mkdir -p pingcap/failpoint
473-
git clone https://github.com/pingcap/failpoint.git pingcap/failpoint
474-
cd pingcap/failpoint
475-
make
476-
else
477-
bin/failpoint-ctl disable
468+
GOBIN=$repo_root/tools/bin go install github.com/pingcap/failpoint/failpoint-ctl@v0.0.0-20220801062533-2eaa32854a6c
478469
fi
479470

480471
echo "⚙️ Enabling failpoint"
481-
bin/failpoint-ctl enable
472+
$repo_root/tools/bin/failpoint-ctl enable go
482473

483474
echo "✅ Successfully enabled failpoint"
484-
popd
475+
}
476+
477+
disable_failpoint() {
478+
echo "⚙️ Disabling failpoint"
479+
$repo_root/tools/bin/failpoint-ctl disable go
480+
481+
echo "✅ Successfully disabled failpoint"
485482
}
486483

487484
build_binary() {
485+
enable_failpoint
486+
488487
echo "Building"
489488
rm -f $default_ghost_binary
490489
[ "$ghost_binary" == "" ] && ghost_binary="$default_ghost_binary"
@@ -499,10 +498,11 @@ build_binary() {
499498
echo "Build failure"
500499
exit 1
501500
fi
501+
502+
disable_failpoint
502503
}
503504

504505
test_all() {
505-
install_failpoint
506506
build_binary
507507
test_dirs=$(find "$tests_path" -mindepth 1 -maxdepth 1 ! -path . -type d | grep "$test_pattern" | sort)
508508
while read -r test_dir; do

0 commit comments

Comments
 (0)