Skip to content

Commit

Permalink
cluster: Fix the setting method of innodb_buffer_pool_instances param…
Browse files Browse the repository at this point in the history
…eter. #244
  • Loading branch information
runkecheng committed Oct 28, 2021
1 parent b893ebf commit 40965db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mysqlcluster/mysqlcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (c *MysqlCluster) EnsureMysqlConf() {
var defaultSize, maxSize, innodbBufferPoolSize uint64
innodbBufferPoolSize = 128 * mb
mem := uint64(c.Spec.MysqlOpts.Resources.Requests.Memory().Value())
cpu := c.Spec.PodPolicy.DefaultResources.Limits.Cpu().MilliValue()
cpu := c.Spec.MysqlOpts.Resources.Limits.Cpu().MilliValue()
if mem <= 1*gb {
defaultSize = uint64(0.45 * float64(mem))
maxSize = uint64(0.6 * float64(mem))
Expand Down
12 changes: 4 additions & 8 deletions mysqlcluster/mysqlcluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,19 +480,15 @@ func TestEnsureMysqlConf(t *testing.T) {
LimitCpucorev1s := resource.NewQuantity(1, resource.DecimalSI)
testMysql := mysqlCluster
testMysql.Spec = mysqlv1alpha1.MysqlClusterSpec{
PodPolicy: mysqlv1alpha1.PodPolicy{
DefaultResources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": *LimitCpucorev1s,
},
},
},
MysqlOpts: mysqlv1alpha1.MysqlOpts{
MysqlConf: mysqlv1alpha1.MysqlConf{},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
"memory": *requestsMemory,
},
Limits: corev1.ResourceList{
"cpu": *LimitCpucorev1s,
},
},
},
}
Expand Down Expand Up @@ -575,7 +571,7 @@ func TestEnsureMysqlConf(t *testing.T) {
memoryCase := resource.NewQuantity(16*gb, resource.BinarySI)
limitCpucorev1sCase := resource.NewQuantity(4, resource.DecimalSI)
testMysqlCase := testMysql
testMysqlCase.Spec.PodPolicy.DefaultResources.Limits["cpu"] = *limitCpucorev1sCase
testMysqlCase.Spec.MysqlOpts.Resources.Limits["cpu"] = *limitCpucorev1sCase
testMysqlCase.Spec.MysqlOpts.Resources.Requests["memory"] = *memoryCase
testCase := MysqlCluster{
&testMysqlCase,
Expand Down

0 comments on commit 40965db

Please sign in to comment.