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

Expose max-sync-message-size in options #419

Merged
merged 9 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ func (c *cluster) getClient() (*clientv3.Client, error) {
DialKeepAliveTime: dialKeepAliveTime,
DialKeepAliveTimeout: dialKeepAliveTimeout,
LogConfig: logger.EtcdClientLoggerConfig(c.opt, logger.EtcdClientFilename),
MaxCallSendMsgSize: c.opt.Cluster.MaxCallSendMsgSize,
})
if err != nil {
return nil, fmt.Errorf("create client failed: %v", err)
Expand Down
7 changes: 7 additions & 0 deletions pkg/object/statussynccontroller/statussynccontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package statussynccontroller

import (
"runtime/debug"
"strings"
"sync"

"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -214,6 +215,12 @@ func (ssc *StatusSyncController) syncStatusToCluster(statuses map[string]string)

err := ssc.superSpec.Super().Cluster().PutAndDeleteUnderLease(kvs)
if err != nil {
resourceExhaustedErrMsg := "trying to send message larger than max "
if strings.Contains(err.Error(), resourceExhaustedErrMsg) {
logger.Errorf("Size of the Easegress objects is too large to be synchronized. " +
"Please reduce objects (output of 'egctl object list') or " +
"increase the value of cluster.MaxCallSendMsgSize in server configuration.")
}
samutamm marked this conversation as resolved.
Show resolved Hide resolved
logger.Errorf("sync status failed: %v", err)
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type ClusterOptions struct {
StateFlag string `yaml:"state-flag"`
// Secondary members define URLs to connect to cluster formed by primary members.
PrimaryListenPeerURLs []string `yaml:"primary-listen-peer-urls"`
MaxCallSendMsgSize int `yaml:"max-call-send-msg-size"`
}

// Options is the start-up options.
Expand Down Expand Up @@ -128,6 +129,7 @@ func addClusterVars(opt *Options) {
"primary-listen-peer-urls",
[]string{"http://localhost:2380"},
"List of peer URLs of primary members. Define this only, when cluster-role is secondary.")
opt.flags.IntVar(&opt.Cluster.MaxCallSendMsgSize, "max-call-send-msg-size", 10*1024*1024, "Maximum size in bytes for cluster synchronization messages.")
}

// New creates a default Options.
Expand Down