From c27594431dce5b5c666e75bf1d3805a681a4c97f Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Fri, 22 Sep 2017 13:08:51 +0200 Subject: [PATCH] validator: raise the quorum for 'suspicious' results to ensure validation --- sched/validate_util2.cpp | 10 ++++++++++ sched/validator.cpp | 1 + sched/validator.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/sched/validate_util2.cpp b/sched/validate_util2.cpp index 5e1ab83c41..975a335814 100644 --- a/sched/validate_util2.cpp +++ b/sched/validate_util2.cpp @@ -116,6 +116,16 @@ int check_set( good_results += suspicious_results; } + // if there are "suspicious" results and min_quorum < g_app->target_nresults + // (i.e. adaptive replication), raise min_quorum to g_app->target_nresults + // the abs() is there for Einstein@Home-specific use of app->target_nresults, + // please leave it in there. + // + if (suspicious_results && wu.min_quorum < abs(g_app->target_nresults)) { + log_messages.printf(MSG_NORMAL, "suspicious result - raising quorum\n"); + wu.min_quorum = abs(g_app->target_nresults); + } + if (good_results < wu.min_quorum) goto cleanup; // Compare results diff --git a/sched/validator.cpp b/sched/validator.cpp index 169041c684..ce638d3af8 100644 --- a/sched/validator.cpp +++ b/sched/validator.cpp @@ -91,6 +91,7 @@ typedef enum { char app_name[256]; DB_APP app; +DB_APP* g_app = &app; int wu_id_modulus=0; int wu_id_remainder=0; int wu_id_min=0; diff --git a/sched/validator.h b/sched/validator.h index ab03556d7b..47ad84ef5b 100644 --- a/sched/validator.h +++ b/sched/validator.h @@ -24,3 +24,6 @@ extern WORKUNIT* g_wup; // A pointer to the WU currently being processed; // you can access this in your init_result() etc. functions // (which are passed RESULT but not WORKUNIT) + +extern DB_APP* g_app; + // a pointer to the app (similar to above)