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

Add INI setting to choose session consistent hash (ketama or ketama_weighted) #392

Merged
merged 1 commit into from
Apr 9, 2018

Conversation

sodabrew
Copy link
Contributor

Resolves #344

@sodabrew sodabrew added this to the 3.1.0 milestone Mar 30, 2018
@@ -202,7 +196,7 @@ zend_bool s_configure_from_ini_values(memcached_st *memc, zend_bool silent)
}

if (MEMC_SESS_INI(consistent_hash_enabled)) {
check_set_behavior(MEMCACHED_BEHAVIOR_KETAMA, 1);
check_set_behavior(MEMC_SESS_INI(consistent_hash_type), 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, the value of this macro is a randomly large number, when is should be "3" or "4". I haven't sorted out why it's not coming up correctly. printf in the OnUpdateConsistentHash function shows the expected value is set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figured out that I was calling OnUpdateString with the integer field as the target, so the value was the actual pointer value to the string. Added an extra field to hold the string value, and a different field to hold the parsed integer value. Same pattern as the compression type INI setting.

@sodabrew sodabrew merged commit 081f9cc into php-memcached-dev:master Apr 9, 2018
@sodabrew sodabrew deleted the session-ketama-type branch April 9, 2018 02:40
sodabrew added a commit that referenced this pull request Apr 9, 2018
…eighted) (#392)

Provides a new INI option to select the same consistent hash behavior as
older versions of php-memcached, to aid in migration from PHP 5.x to PHP
7.x. When `memcached_sess_consistent_hash_type` is set to `ketama` or
`ketama_weighted`, that sets either MEMCACHED_BEHAVIOR_KETAMA or
MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, respectively.

Resolves #344
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.

1 participant