save works

This commit is contained in:
Rongsong Shen 2026-03-02 12:14:30 +08:00
parent b748e30d20
commit f4b1ba4cd7
21 changed files with 373 additions and 324 deletions

View file

@ -515,26 +515,18 @@ int cluster_init(cluster_t* c)
kvmgr_params_t resmgr_params
= { .key_type = KVMGR_KEY_STRING,
.dynamic = 1,
.nslots = c->myconf->cluster_config->resmgr->nhash_slots,
.delta = c->myconf->cluster_config->resmgr->delta,
.datakiller = (destroy_fn_t)res_obj_killer };
kvmgr_params_t jobmgr_params
= { .key_type = KVMGR_KEY_INT,
.dynamic = 1,
.nslots = c->myconf->cluster_config->jobmgr->nhash_slots,
.delta = c->myconf->cluster_config->jobmgr->delta,
.datakiller = (destroy_fn_t)job_obj_killer };
kvmgr_params_t workermgr_params
= { .key_type = KVMGR_KEY_STRING,
.dynamic = 1,
.nslots = c->myconf->cluster_config->workermgr->nhash_slots,
.delta = c->myconf->cluster_config->workermgr->delta,
.datakiller = (destroy_fn_t)worker_obj_killer };
kvmgr_params_t qmgr_params
= { .key_type = KVMGR_KEY_STRING,
.dynamic = 0,
.nslots = c->myconf->cluster_config->qmgr->nhash_slots,
.delta = c->myconf->cluster_config->qmgr->delta,
.datakiller = (destroy_fn_t)queue_obj_killer };
if (c == NULL) {
@ -565,6 +557,15 @@ int cluster_init(cluster_t* c)
return -errno;
}
resmgr_params.nslots = c->myconf->cluster_config->resmgr->nhash_slots;
resmgr_params.delta = c->myconf->cluster_config->resmgr->delta;
jobmgr_params.nslots = c->myconf->cluster_config->jobmgr->nhash_slots;
jobmgr_params.delta = c->myconf->cluster_config->jobmgr->delta;
workermgr_params.nslots = c->myconf->cluster_config->workermgr->nhash_slots;
workermgr_params.delta = c->myconf->cluster_config->workermgr->delta;
qmgr_params.nslots = c->myconf->cluster_config->qmgr->nhash_slots;
qmgr_params.delta = c->myconf->cluster_config->qmgr->delta;
c->configmgr = makeInstance(&xkvmgr_type, &config_mgr_params);
objmgr_init(&(c->objmgr));
@ -644,13 +645,13 @@ static int check_worker_timeout_(cluster_t* c, worker_t* w)
if (now - ep->ts_last_in > timeout) {
TRACE("%s worker %s becomes UNAVAIL as heartbeat timeout", __func__,
w->host->name);
w->host.name);
mark_worker_unavail(c, w);
return 0;
} else {
if (IS_WORKER_UNAVAIL(w->host->status)) {
if (IS_WORKER_UNAVAIL(w->host.status)) {
mark_worker_back(c, w);
}
}
@ -659,13 +660,12 @@ static int check_worker_timeout_(cluster_t* c, worker_t* w)
if (DATAQ_EMPTY(&(ep->outq))) {
int rc = 0;
TRACE("%s send heartbeat to %s", __func__, w->host->name);
TRACE("%s send heartbeat to %s", __func__, w->host.name);
rc = make_heartbeat(c, ep);
if (rc < 0) {
ERROR("%s make_heartbeat to %s failed", __func__,
w->host->name);
ERROR("%s make_heartbeat to %s failed", __func__, w->host.name);
return rc;
}