~d-ci/libmemcached/pushtest

« back to all changes in this revision

Viewing changes to libmemcached/hosts.cc

  • Committer: Continuous Integration
  • Date: 2013-06-14 17:10:51 UTC
  • mfrom: (1104.1.7 libmemcached)
  • Revision ID: ci@tangent.org-20130614171051-3bz9urmntb38uaou
Merge lp:~brianaker/libmemcached/update-1.2 Build: jenkins-Libmemcached-312

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
        float pct= (float)list[host_index].weight / (float)total_weight;
222
222
        pointer_per_server= (uint32_t) ((::floor((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
223
223
        pointer_per_hash= 4;
 
224
#if defined(DEBUG) && DEBUG
224
225
        if (DEBUG)
225
226
        {
226
227
          printf("ketama_weighted:%s|%d|%llu|%u\n",
229
230
                 (unsigned long long)list[host_index].weight,
230
231
                 pointer_per_server);
231
232
        }
 
233
#endif
232
234
    }
233
235
 
234
236
 
255
257
                                     memcached_literal_param("snprintf(sizeof(sort_host))"));
256
258
        }
257
259
 
 
260
#if defined(DEBUG) && DEBUG
258
261
        if (DEBUG)
259
262
        {
260
263
          fprintf(stdout, "update_continuum: key is %s\n", sort_host);
261
264
        }
 
265
#endif
262
266
 
263
267
        if (memcached_is_weighted_ketama(ptr))
264
268
        {
335
339
  ptr->ketama.continuum_points_counter= pointer_counter;
336
340
  qsort(ptr->ketama.continuum, ptr->ketama.continuum_points_counter, sizeof(memcached_continuum_item_st), continuum_item_cmp);
337
341
 
 
342
#if defined(DEBUG) && DEBUG
338
343
  if (DEBUG)
339
344
  {
340
345
    for (uint32_t pointer_index= 0; memcached_server_count(ptr) && pointer_index < ((live_servers * MEMCACHED_POINTS_PER_SERVER) - 1); pointer_index++)
342
347
      WATCHPOINT_ASSERT(ptr->ketama.continuum[pointer_index].value <= ptr->ketama.continuum[pointer_index + 1].value);
343
348
    }
344
349
  }
 
350
#endif
345
351
 
346
352
  return MEMCACHED_SUCCESS;
347
353
}