Commit 3002afbf authored by Nils Goroll's avatar Nils Goroll

cleanup, comments

parent b351e28f
......@@ -50,6 +50,7 @@ typedef int (*compar)( const void*, const void* );
struct vslp_state {
struct vslpdir *vslpd;
struct vbitmap *picklist;
/* start index in the hashcircle for our key */
int idx;
const struct vrt_ctx *ctx;
};
......@@ -391,6 +392,9 @@ vslpdir_any_healthy(struct vslpdir *vslpd)
* >=1 : choose backend number n_retry (1= first)
* altsrv_p : use altsrv_p to use next backend
* healthy : consider only healthy backends
*
* - find best backend based on health state
* - then apply rampup / altsrv_p
*/
VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
const struct vrt_ctx *ctx, uint32_t hash,
......@@ -402,12 +406,15 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
unsigned picklist_sz = VBITMAP_SZ(vslpd->n_backend);
char picklist_spc[picklist_sz];
state.picklist = vbit_init(picklist_spc, picklist_sz);
AN(state.picklist);
CHECK_OBJ_NOTNULL(vslpd, VSLPDIR_MAGIC);
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(ctx->vsl);
state.vslpd = vslpd;
state.ctx = ctx;
state.picklist = vbit_init(picklist_spc, picklist_sz);
AN(state.picklist);
if(altsrv_p)
be_choice = (scalbn(random(), -31) > vslpd->altsrv_p);
......@@ -423,9 +430,6 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
n_retry--;
}
state.vslpd = vslpd;
state.ctx = ctx;
if(vslpd->hashcircle == NULL)
WRONG("Incomplete VSLP hashcircle");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment