Skip to content

Conversation

@mgetz
Copy link

@mgetz mgetz commented Sep 16, 2015

There is a small window of value size just under the max value size that causes a SERVER_ERROR. That window is the key length + the length of meta data stored with the key value pair. When the value size is over the max value length, the driver nicely throws an error back to the client without causing the SERVER_ERROR. This closes that small window that is left.

I hardcoded in the size of the metadata that I found on my system but I am not sure that is correct for all systems. The places where I found the meta data length mentioned cited a shorter length for most systems so hopefully this takes care of those systems as well with only a few bytes of unusable space.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment explaining the logic behind this (and the magic constant that is 71) would be appreciated :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation I found said that 71 is the length of the metadata that memcache uses to store information about each key value pair. That may need to be adjusted or set as a system variable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to keep in mind is that memcache clients can also talk to Couchbase servers. I don't know what the limitations are there? In any case, I think a code comment or well chosen constant name would be nice.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the tips. We use it with both memcached and couchbase ourselves. I will do a bit more research and tweak the code accordingly.
Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants