Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for no scanners specified when createing consistent transactions #4633

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions go/vt/worker/diff_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"strings"
"time"

"vitess.io/vitess/go/vt/proto/vtrpc"

"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vttablet/tmclient"
"vitess.io/vitess/go/vt/wrangler"
Expand Down Expand Up @@ -743,6 +745,10 @@ func CreateConsistentTableScanners(ctx context.Context, tablet *topo.TabletInfo,
// CreateConsistentTransactions creates a number of consistent snapshot transactions,
// all starting from the same spot in the tx log
func CreateConsistentTransactions(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]int64, string, error) {
if numberOfScanners < 1 {
return nil, "", vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "need more than zero scanners: %d", numberOfScanners)
}

tm := tmclient.NewTabletManagerClient()
defer tm.Close()

Expand Down
3 changes: 3 additions & 0 deletions go/vt/worker/split_clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,9 @@ func (scw *SplitCloneWorker) findTransactionalSources(ctx context.Context) error

// stop replication and create transactions to work on
txs, gtid, err := CreateConsistentTransactions(ctx, ti, scw.wr, scw.cleaner, scw.sourceReaderCount)
if err != nil {
return vterrors.Wrapf(err, "error creating consistent transactions")
}
scw.wr.Logger().Infof("created %v transactions", len(txs))
scw.lastPos = gtid
scw.transactions = txs
Expand Down