-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
etcdserver: add --max-txn-ops flag #7976
etcdserver: add --max-txn-ops flag #7976
Conversation
etcdmain/config.go
Outdated
@@ -138,6 +138,7 @@ func newConfig() *config { | |||
fs.UintVar(&cfg.TickMs, "heartbeat-interval", cfg.TickMs, "Time (in milliseconds) of a heartbeat interval.") | |||
fs.UintVar(&cfg.ElectionMs, "election-timeout", cfg.ElectionMs, "Time (in milliseconds) for an election to timeout.") | |||
fs.Int64Var(&cfg.QuotaBackendBytes, "quota-backend-bytes", cfg.QuotaBackendBytes, "Raise alarms when backend size exceeds the given quota. 0 means use the default quota.") | |||
fs.UintVar(&cfg.MaxOpsPerTxn, "max-ops-per-txn", cfg.MaxOpsPerTxn, "maximum operations per txn that etcd server allows (0 is unlimited); defaults to unlimited.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max-txn-ops
; the per
is redundant. Should also probably default to 128 so it's harder to take down etcd with the default settings.
etcdserver/api/v3rpc/key.go
Outdated
@@ -39,6 +41,7 @@ type kvServer struct { | |||
} | |||
|
|||
func NewKVServer(s *etcdserver.EtcdServer) pb.KVServer { | |||
MaxOpsPerTxn = int(s.Cfg.MaxOpsPerTxn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break embedding when using multiple etcd servers with different max txn op configurations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heyitsanthony I am thinking about each KvServer should hold its own MaxOpsPerTxn stored in
type kvServer struct {
hdr header
kv etcdserver.RaftKV
maxTxnOps uint
}
and use kvServer.maxTxnOps for transaction ops check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
76a3659
to
66b29a4
Compare
--max-txn-ops allows users to define the maximum transaction operations for each txn request. it defaults at 128. Fixes etcd-io#7826
66b29a4
to
ae7ddfb
Compare
All fixed. PTAL |
2479cb9
to
34b8bad
Compare
fixed CI breakage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after fixing last few nits
etcdserver/api/v3rpc/key.go
Outdated
func checkTxnRequest(r *pb.TxnRequest) error { | ||
if len(r.Compare) > MaxOpsPerTxn || len(r.Success) > MaxOpsPerTxn || len(r.Failure) > MaxOpsPerTxn { | ||
func checkTxnRequest(r *pb.TxnRequest, maxTxnOps int) error { | ||
plog.Infof("maxTxnOps %v", maxTxnOps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
etcdmain/help.go
Outdated
@@ -66,6 +66,8 @@ member flags: | |||
comma-separated whitelist of origins for CORS (cross-origin resource sharing). | |||
--quota-backend-bytes '0' | |||
raise alarms when backend size exceeds the given quota (0 defaults to low space quota). | |||
--max-txn-ops '128' | |||
maximum operations per txn that etcd server allows; defaults to 128. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default is already given in the line above, don't restate
maximum number of operations permitted in a transaction
etcdmain/config.go
Outdated
@@ -138,6 +138,7 @@ func newConfig() *config { | |||
fs.UintVar(&cfg.TickMs, "heartbeat-interval", cfg.TickMs, "Time (in milliseconds) of a heartbeat interval.") | |||
fs.UintVar(&cfg.ElectionMs, "election-timeout", cfg.ElectionMs, "Time (in milliseconds) for an election to timeout.") | |||
fs.Int64Var(&cfg.QuotaBackendBytes, "quota-backend-bytes", cfg.QuotaBackendBytes, "Raise alarms when backend size exceeds the given quota. 0 means use the default quota.") | |||
fs.UintVar(&cfg.MaxTxnOps, "max-txn-ops", cfg.MaxTxnOps, "Maximum operations per txn that etcd server allows; defaults to 128.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default should already show up in --help
, don't bother restating here
Maximum number of operations permitted in a transaction.
34b8bad
to
e9f464d
Compare
All fixed. |
Fixes #7826