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

Calling "statusSettingsFromAddr" function failed in MySQL innodb memcached plugin #1

Closed
wants to merge 1 commit into from

Conversation

gywndi
Copy link

@gywndi gywndi commented Sep 19, 2019

Hi,

When using memcached with the MySQL InnoDB memcached plugin, a "stats settings" failure occurs.

memcache: unexpected stats line format "STAT logger standard error

The "stats settings" result in the MySQL InnoDB memcached plugin is shown below.

stats settings
STAT maxbytes 67108864
STAT maxconns 1000
..skip ..
STAT item_size_max 1048576
STAT topkeys 0
STAT logger standard error
END

The problem occurs in a four-word case in STAT logger standard error.

stats := map[string]string{}
for err == nil && !bytes.Equal(line, resultEnd) {
	s := bytes.Split(line, []byte(" "))
	if len(s) != 3 || !bytes.HasPrefix(s[0], resultStatPrefix) {
		return fmt.Errorf("memcache: unexpected stats line format %q", line)
	}
	stats[string(s[1])] = string(bytes.TrimSpace(s[2]))
	line, err = rw.ReadSlice('\n')
	if err != nil {
		return err
	}
}

If it is not three words at the bottom, it is the part that returns as an error. So I changed it to parse up to four words: And the problem is gone. In order to use the MySQL InnoDB memcached plugin well, please check this.

stats := map[string]string{}
for err == nil && !bytes.Equal(line, resultEnd) {
	s := bytes.Split(line, []byte(" "))
	if len(s) == 3 {
		stats[string(s[1])] = string(bytes.TrimSpace(s[2]))
	} else if len(s) == 4 {
		stats[string(s[1])] = string(bytes.TrimSpace(s[2])) + "-" + string(bytes.TrimSpace(s[2]))
	} else {
		return fmt.Errorf("memcache: unexpected stats line format %q", line)
	}
	line, err = rw.ReadSlice('\n')
	if err != nil {
		return err
	}
}

Best Regards,
Chan.

mysql memcaced plugin monitoring
@grobie
Copy link
Owner

grobie commented May 3, 2020

Hey @gywndi

thanks for your pull request and apologies for the late response. I'm generally fine being less strict about the format and providing support for InnoDB. It would be good to add a test explaining and ensuring the desired behavior though. Ideally we could start a docker container to test against a real innodb instance in an integration test, or at least a simple fixture file to test the parser alone. What do you think?

@gywndi
Copy link
Author

gywndi commented May 20, 2020

Hi @grobie
I checked this reply so late, sorry. :-)
Do you mean you need docker image file to test InnoDB memcached plugin?

@jonathanhartley
Copy link

Can this be merged, having the same issue with MySQL Cluster memcached plugin

@grobie grobie closed this in 08d7c80 Dec 4, 2020
@grobie
Copy link
Owner

grobie commented Dec 4, 2020

Fixed this in a separate commit with a simpler implementation. Will release a new memcached_exporter next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants