Skip to content

Commit

Permalink
Check for no scanners specified when createing consistent transactions
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Young <[email protected]>
  • Loading branch information
eeSeeGee committed Feb 15, 2019
1 parent c4fdd1d commit d435735
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit d435735

Please sign in to comment.