Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
tests,restore: prevent spurious error in checkpoint_chunks test
Browse files Browse the repository at this point in the history
Only kill Lightning if the whole chunk is imported exactly. The chunk
checkpoint may be recorded before a chunk is fully written, and this will
hit the failpoint more than 5 times.
  • Loading branch information
kennytm committed Mar 15, 2019
1 parent 193d876 commit 44db439
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ func (rc *RestoreController) listenCheckpointUpdates(wg *sync.WaitGroup) {

lock.Unlock()

// gofail: var FailIfImportedChunk struct{}
// if _, ok := scp.merger.(*ChunkCheckpointMerger); ok {
// gofail: var FailIfImportedChunk int
// if merger, ok := scp.merger.(*ChunkCheckpointMerger); ok && merger.Checksum.SumKVS() >= uint64(FailIfImportedChunk) {
// wg.Wait()
// panic("forcing failure due to FailIfImportedChunk")
// }
Expand Down
2 changes: 1 addition & 1 deletion tests/checkpoint_chunks/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
region-concurrency = 1
check-requirements = false
file = "/tmp/lightning_test_result/lightning.log"
level = "error"
level = "info"

[checkpoint]
enable = true
Expand Down
2 changes: 1 addition & 1 deletion tests/checkpoint_chunks/file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
region-concurrency = 1
check-requirements = false
file = "/tmp/lightning_test_result/lightning.log"
level = "error"
level = "info"

[checkpoint]
enable = true
Expand Down
2 changes: 1 addition & 1 deletion tests/checkpoint_chunks/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ done

# Set the failpoint to kill the lightning instance as soon as one chunk is imported
# If checkpoint does work, this should only kill $CHUNK_COUNT instances of lightnings.
export GOFAIL_FAILPOINTS='github.com/pingcap/tidb-lightning/lightning/restore/FailIfImportedChunk=return'
export GOFAIL_FAILPOINTS="github.com/pingcap/tidb-lightning/lightning/restore/FailIfImportedChunk=return($ROW_COUNT)"

# Start importing the tables.
run_sql 'DROP DATABASE IF EXISTS cpch_tsr'
Expand Down

0 comments on commit 44db439

Please sign in to comment.