diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 7abc6a80e9..2169967f6f 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -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) diff --git a/pkg/object/statussynccontroller/statussynccontroller.go b/pkg/object/statussynccontroller/statussynccontroller.go index c7747657d6..3e91ce8cdf 100644 --- a/pkg/object/statussynccontroller/statussynccontroller.go +++ b/pkg/object/statussynccontroller/statussynccontroller.go @@ -208,13 +208,13 @@ func (ssc *StatusSyncController) syncStatusToCluster(statuses map[string]string) for k, v := range statuses { k = ssc.superSpec.Super().Cluster().Layout().StatusObjectKey(k) - value := v - kvs[k] = &value + kvs[k] = &v } err := ssc.superSpec.Super().Cluster().PutAndDeleteUnderLease(kvs) if err != nil { - logger.Errorf("sync status failed: %v", err) + logger.Errorf("sync status failed. If the message size is too large, "+ + "please increase the value of cluster.MaxCallSendMsgSize in configuration: %v", err) } } diff --git a/pkg/option/option.go b/pkg/option/option.go index 0bb2a45ca6..40c3fc8d0e 100644 --- a/pkg/option/option.go +++ b/pkg/option/option.go @@ -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. @@ -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.