Skip to content

Commit 3d36adb

Browse files
authored
parse transaction timeout as duration (vitessio#16338)
Signed-off-by: shanth96 <[email protected]>
1 parent 0f242e9 commit 3d36adb

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

go/cmd/vttestserver/cli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func New() (cmd *cobra.Command) {
206206
cmd.Flags().BoolVar(&config.EnableSystemSettings, "enable_system_settings", true, "This will enable the system settings to be changed per session at the database connection level")
207207

208208
cmd.Flags().StringVar(&config.TransactionMode, "transaction_mode", "MULTI", "Transaction mode MULTI (default), SINGLE or TWOPC ")
209-
cmd.Flags().Float64Var(&config.TransactionTimeout, "queryserver-config-transaction-timeout", 0, "query server transaction timeout (in seconds), a transaction will be killed if it takes longer than this value")
209+
cmd.Flags().DurationVar(&config.TransactionTimeout, "queryserver-config-transaction-timeout", 30*time.Second, "query server transaction timeout, a transaction will be killed if it takes longer than this value")
210210

211211
cmd.Flags().StringVar(&config.TabletHostName, "tablet_hostname", "localhost", "The hostname to use for the tablet otherwise it will be derived from OS' hostname")
212212

go/flags/endtoend/vttestserver.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Flags:
106106
--pprof-http enable pprof http endpoints
107107
--proto_topo string Define the fake cluster topology as a compact text format encoded vttest proto. See vttest.proto for more information.
108108
--purge_logs_interval duration how often try to remove old logs (default 1h0m0s)
109-
--queryserver-config-transaction-timeout float query server transaction timeout (in seconds), a transaction will be killed if it takes longer than this value
109+
--queryserver-config-transaction-timeout duration query server transaction timeout, a transaction will be killed if it takes longer than this value (default 30s)
110110
--rdonly_count int Rdonly tablets per shard (default 1)
111111
--replica_count int Replica tablets per shard (includes primary) (default 2)
112112
--replication_connect_retry duration how long to wait in between replica reconnect attempts. Only precise to the second. (default 10s)

go/vt/vttest/local_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ type Config struct {
128128
// TransactionMode is SINGLE, MULTI or TWOPC
129129
TransactionMode string
130130

131-
TransactionTimeout float64
131+
TransactionTimeout time.Duration
132132

133133
// The host name to use for the table otherwise it will be resolved from the local hostname
134134
TabletHostName string

go/vt/vttest/vtprocess.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ var QueryServerArgs = []string{
188188
"--queryserver-config-schema-reload-time", "60s",
189189
"--queryserver-config-stream-pool-size", "4",
190190
"--queryserver-config-transaction-cap", "4",
191-
"--queryserver-config-transaction-timeout", "300s",
192191
"--queryserver-config-txpool-timeout", "300s",
193192
}
194193

@@ -260,7 +259,7 @@ func VtcomboProcess(environment Environment, args *Config, mysql MySQLManager) (
260259
vt.ExtraArgs = append(vt.ExtraArgs, []string{"--transaction_mode", args.TransactionMode}...)
261260
}
262261
if args.TransactionTimeout != 0 {
263-
vt.ExtraArgs = append(vt.ExtraArgs, "--queryserver-config-transaction-timeout", fmt.Sprintf("%f", args.TransactionTimeout))
262+
vt.ExtraArgs = append(vt.ExtraArgs, "--queryserver-config-transaction-timeout", fmt.Sprintf("%v", args.TransactionTimeout))
264263
}
265264
if args.TabletHostName != "" {
266265
vt.ExtraArgs = append(vt.ExtraArgs, []string{"--tablet_hostname", args.TabletHostName}...)

0 commit comments

Comments
 (0)