Skip to content

Commit

Permalink
Relocate buffers only for vbucket distribution
Browse files Browse the repository at this point in the history
Change-Id: I9d07a32502cb91c4d9b29c65f4c7068b770f9cc8
Reviewed-on: http://review.couchbase.org/12699
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
  • Loading branch information
avsej committed Feb 5, 2012
1 parent c3b3a60 commit 75c0f54
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/instance.c
Expand Up @@ -317,17 +317,25 @@ static void libcouchbase_update_serverlist(libcouchbase_t instance)
if (curr_config) {
diff = vbucket_compare(curr_config, next_config);
if (diff && (diff->sequence_changed || diff->n_vb_changes > 0)) {
VBUCKET_DISTRIBUTION_TYPE dist_t = vbucket_config_get_distribution_type(next_config);
nservers = instance->nservers;
servers = instance->servers;
apply_vbucket_config(instance, next_config);
for (ii = 0; ii < nservers; ++ii) {
ss = servers + ii;
/* commands that were failed to be sent */
relocate_packets(&ss->cmd_log, &ss->output_cookies, instance);
/* commands that are going to be sent */
relocate_packets(&ss->output, &ss->output_cookies, instance);
/* commands that are pending because of delayed socket connection */
relocate_packets(&ss->pending, &ss->pending_cookies, instance);
if (dist_t == VBUCKET_DISTRIBUTION_VBUCKET) {
/* commands that were failed to be sent */
relocate_packets(&ss->cmd_log, &ss->output_cookies, instance);
/* commands that are going to be sent */
relocate_packets(&ss->output, &ss->output_cookies, instance);
/* commands that are pending because of delayed socket connection */
relocate_packets(&ss->pending, &ss->pending_cookies, instance);
} else {
/* other distribution types (ketama) are relying on
* hashing key, therefore return TMPFAIL and force users
* to retry */
libcouchbase_failout_server(ss, LIBCOUCHBASE_ETMPFAIL);
}
libcouchbase_server_destroy(ss);
}

Expand Down

0 comments on commit 75c0f54

Please sign in to comment.