8000 Fix transaction_mode parsing by saifalharthi · Pull Request #5963 · vitessio/vitess · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix transaction_mode parsing #5963

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

Merged
merged 2 commits into from
Mar 26, 2020
Merged
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
16 changes: 10 additions & 6 deletions go/vt/vtgate/vtgate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"flag"
"fmt"
"net/http"
"os"
"strings"
"time"

"golang.org/x/net/context"
Expand Down Expand Up @@ -63,19 +65,21 @@ var (
)

func getTxMode() vtgatepb.TransactionMode {
switch *transactionMode {
case "SINGLE":
switch strings.ToLower(*transactionMode) {
case "single":
log.Infof("Transaction mode: '%s'", *transactionMode)
return vtgatepb.TransactionMode_SINGLE
case "MULTI":
case "multi":
log.Infof("Transaction mode: '%s'", *transactionMode)
return vtgatepb.TransactionMode_MULTI
case "TWOPC":
case "twopc":
log.Infof("Transaction mode: '%s'", *transactionMode)
return vtgatepb.TransactionMode_TWOPC
default:
log.Warningf("Unrecognized transactionMode '%s'. Continuing with default 'MULTI'", *transactionMode)
return vtgatepb.TransactionMode_MULTI
fmt.Printf("Invalid option: %v\n", *transactionMode)
fmt.Println("Usage: -transaction_mode {SINGLE | MULTI | TWOPC}")
os.Exit(1)
return -1
}
}

Expand Down
0