-
Notifications
You must be signed in to change notification settings - Fork 12
lbp: rack awareness #195
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
lbp: rack awareness #195
Changes from all commits
a411584
db87056
c834f6b
8ed8d15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1087,6 +1087,50 @@ cass_execution_profile_set_load_balance_dc_aware_n(CassExecProfile* profile, | |
unsigned used_hosts_per_remote_dc, | ||
cass_bool_t allow_remote_dcs_for_local_cl); | ||
|
||
|
||
/** | ||
* Configures the execution profile to use Rack-aware load balancing. | ||
* For each query, all live nodes in a primary 'local' rack are tried first, | ||
* followed by nodes from local DC and then nodes from other DCs. | ||
* | ||
* <b>Note:</b> Profile-based load balancing policy is disabled by default. | ||
* cluster load balancing policy is used when profile does not contain a policy. | ||
muzarski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* @public @memberof CassExecProfile | ||
* | ||
* @param[in] profile | ||
* @param[in] local_dc The primary data center to try first | ||
* @param[in] local_rack The primary rack to try first | ||
* @return CASS_OK if successful, otherwise an error occurred | ||
*/ | ||
CASS_EXPORT CassError | ||
cass_execution_profile_set_load_balance_rack_aware(CassExecProfile* profile, | ||
const char* local_dc, | ||
const char* local_rack); | ||
|
||
|
||
/** | ||
* Same as cass_execution_profile_set_load_balance_rack_aware(), but with lengths for string | ||
* parameters. | ||
* | ||
* @public @memberof CassExecProfile | ||
* | ||
* @param[in] profile | ||
* @param[in] local_dc | ||
* @param[in] local_dc_length | ||
* @return same cass_execution_profile_set_load_balance_rack_aware() | ||
* | ||
* @see cass_execution_profile_set_load_balance_rack_aware() | ||
* @see cass_cluster_set_load_balance_rack_aware_n() | ||
*/ | ||
CASS_EXPORT CassError | ||
cass_execution_profile_set_load_balance_rack_aware_n(CassExecProfile* profile, | ||
const char* local_dc, | ||
size_t local_dc_length, | ||
const char* local_rack, | ||
size_t local_rack_length); | ||
|
||
|
||
/** | ||
* Configures the execution profile to use token-aware request routing or not. | ||
* | ||
|
@@ -2176,13 +2220,6 @@ cass_cluster_set_load_balance_round_robin(CassCluster* cluster); | |
* For each query, all live nodes in a primary 'local' DC are tried first, | ||
* followed by any node from other DCs. | ||
* | ||
* <b>Note:</b> This is the default, and does not need to be called unless | ||
* switching an existing from another policy or changing settings. | ||
* Without further configuration, a default local_dc is chosen from the | ||
* first connected contact point, and no remote hosts are considered in | ||
* query plans. If relying on this mechanism, be sure to use only contact | ||
* points from the local DC. | ||
* | ||
* @deprecated The remote DC settings for DC-aware are not suitable for most | ||
* scenarios that require DC failover. There is also unhandled gap between | ||
* replication factor number of nodes failing and the full cluster failing. Only | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I generally dislike the machanism of using first contact point DC as local DC (/rack), but I wonder if this won't cause compatibility issues. We could probably implement it by, in case dc name is empty, following mechanism:
let handle = session.get_default_execution_profile_handle().clone();
let new_profile = handle.pointee_to_builder().load_balancing_policy(...).build();
handle.map_to_another_profile(new_profile); I'm not sure preserving this mechanism is worth introducing such trickery - probably not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow! Is it going to be the first time when profile mapping feature is actually useful (and used by anyone!) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said, I'm not convinced we should do this - actually, I'm more and more convinced that we shouldn't. So unfortunately it won't :( |
||
|
@@ -2233,6 +2270,46 @@ cass_cluster_set_load_balance_dc_aware_n(CassCluster* cluster, | |
unsigned used_hosts_per_remote_dc, | ||
cass_bool_t allow_remote_dcs_for_local_cl); | ||
|
||
|
||
/** | ||
* Configures the cluster to use Rack-aware load balancing. | ||
* For each query, all live nodes in a primary 'local' rack are tried first, | ||
* followed by nodes from local DC and then nodes from other DCs. | ||
* | ||
* @public @memberof CassCluster | ||
* | ||
* @param[in] cluster | ||
* @param[in] local_dc The primary data center to try first | ||
* @param[in] local_rack The primary rack to try first | ||
* @return CASS_OK if successful, otherwise an error occurred | ||
*/ | ||
CASS_EXPORT CassError | ||
cass_cluster_set_load_balance_rack_aware(CassCluster* cluster, | ||
const char* local_dc, | ||
const char* local_rack); | ||
|
||
|
||
/** | ||
muzarski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Same as cass_cluster_set_load_balance_rack_aware(), but with lengths for string | ||
* parameters. | ||
* | ||
* @public @memberof CassCluster | ||
* | ||
* @param[in] cluster | ||
* @param[in] local_dc | ||
* @param[in] local_dc_length | ||
* @return same as cass_cluster_set_load_balance_dc_aware() | ||
* | ||
* @see cass_cluster_set_load_balance_dc_aware() | ||
*/ | ||
CASS_EXPORT CassError | ||
cass_cluster_set_load_balance_rack_aware_n(CassCluster* cluster, | ||
const char* local_dc, | ||
size_t local_dc_length, | ||
const char* local_rack, | ||
size_t local_rack_length); | ||
|
||
|
||
/** | ||
* Configures the cluster to use token-aware request routing or not. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit: " cluster: define and implement cass_cluster_set_load_balance_rack_aware[_n]"
Nit: First line of commit message is too long which causes GH to display it badly. I think you can drop "define and".
After reading the commit message, I wonder - do we handle DC aware like cpp-driver? Meaning that we treat first contact point as local DC. If not, should we even try? Or just remove this from docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see you removed it in the third commit. Maybe we should have an issue to discuss this? I'm generally all for improving weird behavior of cpp-driver, even if the change would be slightly breaking. In this case I wonder if it isn't too breaking. Isn't this something that users could depend on?
I guess providing a migration guide could be an option? That would still benefit from an issue so we don't forget about this incompatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue: #204