feat: filter lost_and_found sentinel from pushes; reset unavail host attrs

- create_lost_and_found(): provide hostattrs_t so makeWorker succeeds
- collect_queues/collect_workers (dataex.c): skip lost_and_found sentinel
  so it is never pushed to apiserver or scheduler
- mark_worker_unavail(): reset hosttype/hostmodel to "unknown" and zero
  all numeric attrs, then update resvals and slots — prevents stale
  capacity from being visible while the host is down
- restore_worker(): apply the same attr reset on WAL recovery so
  restored-but-unavailable workers advertise no capacity until reconnect;
  also remove dead calloc() that was immediately overwritten by makeWorker
- Extract reset_hostattrs_unknown() helper to eliminate copy-paste
- Define XCE_LOST_AND_FOUND_NAME constant in config_repl.h; replace all
  six raw "lost_and_found" string literals across config_repl.c and dataex.c
This commit is contained in:
Rongsong Shen 2026-05-14 08:44:55 +00:00
parent 2e2aaea78c
commit 1599d06bc4
6 changed files with 79 additions and 56 deletions

View file

@ -1,6 +1,7 @@
#include <errno.h>
#include "cluster.h"
#include "config_repl.h"
#include "request.h"
#include "xce/cluster_def.h"
#include "xce/types.h"
@ -235,6 +236,10 @@ void collect_queues(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
if (q == NULL) {
continue;
}
if (q->queue.queue != NULL
&& strcmp(q->queue.queue, XCE_LOST_AND_FOUND_NAME) == 0) {
continue;
}
if ((fn == NULL) || fn(q)) {
reference(q);
xlist_store(l, &(q->queue));
@ -350,6 +355,11 @@ void collect_workers(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
continue;
}
if (w->host.name != NULL
&& strcmp(w->host.name, XCE_LOST_AND_FOUND_NAME) == 0) {
continue;
}
if ((fn == NULL) || (fn(w))) {
reference(w);
xlist_store(l, &(w->host));