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

[bug] innodb_buffer_pool_size cannot be set correctly when its size greater than int32 #125

Closed
runkecheng opened this issue Jun 28, 2021 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@runkecheng
Copy link
Collaborator

Describe the problem
innodb_buffer_pool_size is one of MysqlConf`s keys.

type MysqlConf map[string]intstr.IntOrString

The type of innodbBufferPoolSize is int32.

type IntOrString struct {
	Type   Type   `protobuf:"varint,1,opt,name=type,casttype=Type"`
	IntVal int32  `protobuf:"varint,2,opt,name=intVal"`
	StrVal string `protobuf:"bytes,3,opt,name=strVal"`
}

func (c *Cluster) EnsureMysqlConf() {
	...
	c.Spec.MysqlOpts.MysqlConf["innodb_buffer_pool_size"] = intstr.FromInt(int(innodbBufferPoolSize))
	c.Spec.MysqlOpts.MysqlConf["innodb_buffer_pool_instances"] = intstr.FromInt(int(instances))
}
func FromInt(val int) IntOrString {
	if val > math.MaxInt32 || val < math.MinInt32 {
		klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack())
	}
	return IntOrString{Type: Int, IntVal: int32(val)}
}

In fact, innodbBufferPoolSize is likely to overflows int32.
To Reproduce

Expected behavior

Use other data types to store InnodBufferPoolsize or change the unit of memory.

Environment:

  • RadonDB MySQL version: operator
@runkecheng runkecheng added the bug Something isn't working label Jun 28, 2021
@runkecheng runkecheng changed the title [bug] when the innodb_buffer_pool_size greater than the size of int32, memory will overflow [bug] innodb_buffer_pool_size cannot be set correctly when its size greater than int32 Jun 28, 2021
@zhyass
Copy link
Contributor

zhyass commented Jun 28, 2021

ACK

zhyass added a commit to zhyass/radondb-mysql-kubernetes that referenced this issue Jun 28, 2021
@zhyass zhyass self-assigned this Jun 28, 2021
zhyass added a commit to zhyass/radondb-mysql-kubernetes that referenced this issue Jun 28, 2021
@andyli029 andyli029 added this to the v1.3.0 milestone Jun 29, 2021
zhyass added a commit to zhyass/radondb-mysql-kubernetes that referenced this issue Jun 29, 2021
zhyass added a commit to zhyass/radondb-mysql-kubernetes that referenced this issue Jun 30, 2021
zhyass added a commit to zhyass/radondb-mysql-kubernetes that referenced this issue Jul 5, 2021
zhl003 pushed a commit to zhl003/radondb-mysql-kubernetes that referenced this issue Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants