fix(scheduler): downgrade routine EEXIST resync log, dedup hash_string
xce_core_push_events() WARNed on every JOBS_PUSH resync redelivery (sched_add_job rc=-EEXIST), which is the expected outcome under on_scheduler_join()'s full resync or the array-push dedup race (bug-1734/bug-1714) and flooded operational logs. Only that case now logs via a new DBG() macro (utils.h); any other add_rc (e.g. -ENOMEM) still WARNs. DBG is named to avoid colliding with the build's own -DDEBUG command-line define (debug/asan buildtypes). Also collapsed hash_string()'s duplicated djb2 loop to delegate to hash_block(), which already implements the same RUN_HASH loop. Logged as bug-1809 in .wolf/buglog.json. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
868c6427c8
commit
b7250c2ec6
7 changed files with 115 additions and 19 deletions
|
|
@ -141,6 +141,12 @@
|
|||
|
||||
#define TRACE(...) tlog_debug3(__VA_ARGS__)
|
||||
|
||||
/* Named DBG, not DEBUG -- DEBUG is a bare command-line macro (-DDEBUG,
|
||||
* src/meson.build) defined for both the debug and asan buildtypes, so
|
||||
* `#define DEBUG(...)` here would trigger a "DEBUG redefined" warning in
|
||||
* every translation unit that includes this header under either profile. */
|
||||
#define DBG(...) tlog_debug(__VA_ARGS__)
|
||||
|
||||
#define INFO(...) tlog_info(__VA_ARGS__)
|
||||
|
||||
#define ERROR(...) tlog_error(__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -802,12 +802,5 @@ uint32_t hash_block(char* buf, size_t len)
|
|||
|
||||
uint32_t hash_string(const char* key)
|
||||
{
|
||||
uint32_t hc = 5381;
|
||||
int c;
|
||||
|
||||
while ((c = *key++)) {
|
||||
hc = RUN_HASH(hc, c);
|
||||
}
|
||||
|
||||
return hc;
|
||||
return hash_block((char*)key, strlen(key));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -842,10 +842,30 @@ int xce_core_push_events(xce_sched_core_t* core, xce_core_event_t* events,
|
|||
* fmt_jobid(), referenced at each other call site below),
|
||||
* instead of a raw numeric jobid. */
|
||||
fmt_jobid(jobidStr, sizeof(jobidStr), job->jobid);
|
||||
WARN("%s JOBS_PUSH: sched_add_job failed for jobid %s "
|
||||
"(rc=%d), merging state into existing tracked job "
|
||||
"instead of discarding",
|
||||
__func__, jobidStr, add_rc);
|
||||
|
||||
/* bug-1809 follow-up: -EEXIST here is the expected,
|
||||
* routine shape of a resync redelivery (on_scheduler_
|
||||
* join()'s full resync, or the array-push dedup race
|
||||
* bug-1714 documents) -- not an anomaly -- so it is
|
||||
* logged at DBG (utils.h's tlog_debug() wrapper -- named
|
||||
* DBG rather than DEBUG to avoid colliding with the
|
||||
* build's own -DDEBUG command-line define) instead of
|
||||
* WARN, to stop it from flooding operational logs under
|
||||
* the reconnect-storm conditions bug-1734/bug-1714 both
|
||||
* captured live. Any OTHER negative add_rc (e.g. -ENOMEM
|
||||
* from key_add()'s allocation path) is a genuine anomaly
|
||||
* and still WARNs. */
|
||||
if (add_rc == -EEXIST) {
|
||||
DBG("%s JOBS_PUSH: sched_add_job failed for jobid %s "
|
||||
"(rc=%d), merging state into existing tracked "
|
||||
"job instead of discarding",
|
||||
__func__, jobidStr, add_rc);
|
||||
} else {
|
||||
WARN("%s JOBS_PUSH: sched_add_job failed for jobid %s "
|
||||
"(rc=%d), merging state into existing tracked "
|
||||
"job instead of discarding",
|
||||
__func__, jobidStr, add_rc);
|
||||
}
|
||||
|
||||
if ((existing != NULL) && (existing->state != job->state)) {
|
||||
/* bug-1738: never let a resync redelivery regress an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue