// SPDX-License-Identifier: GPL-3.0-or-later
#include "replication.h"
#include "Judy.h"
#define STREAMING_START_MAX_SENDER_BUFFER_PERCENTAGE_ALLOWED 50
#define MAX_SENDER_BUFFER_PERCENTAGE_ALLOWED 50
#define MIN_SENDER_BUFFER_PERCENTAGE_ALLOWED 10
#define WORKER_JOB_FIND_NEXT 1
#define WORKER_JOB_QUERYING 2
#define WORKER_JOB_DELETE_ENTRY 3
#define WORKER_JOB_FIND_CHART 4
#define WORKER_JOB_CHECK_CONSISTENCY 5
#define WORKER_JOB_BUFFER_COMMIT 6
#define WORKER_JOB_CLEANUP 7
#define WORKER_JOB_WAIT 8
// master thread worker jobs
#define WORKER_JOB_STATISTICS 9
#define WORKER_JOB_CUSTOM_METRIC_PENDING_REQUESTS 10
#define WORKER_JOB_CUSTOM_METRIC_SKIPPED_NO_ROOM 11
#define WORKER_JOB_CUSTOM_METRIC_COMPLETION 12
#define WORKER_JOB_CUSTOM_METRIC_ADDED 13
#define WORKER_JOB_CUSTOM_METRIC_DONE 14
#define WORKER_JOB_CUSTOM_METRIC_SENDER_RESETS 15
#define WORKER_JOB_CUSTOM_METRIC_SENDER_FULL 16
#define ITERATIONS_IDLE_WITHOUT_PENDING_TO_RUN_SENDER_VERIFICATION 30
#define SECONDS_TO_RESET_POINT_IN_TIME 10
static struct replication_query_statistics replication_queries = {
.spinlock = NETDATA_SPINLOCK_INITIALIZER,
.queries_started = 0,
.queries_finished = 0,
.points_read = 0,
.points_generated =