diff options
author | Madelyn Olson <34459052+madolson@users.noreply.github.com> | 2022-04-26 03:25:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 13:25:33 +0300 |
commit | 6fa8e4f7afcbd14748c736c38e5fbc117eaef7ba (patch) | |
tree | e74b7ddf889b99daadd615cbee5ca069e14c82bb /src/server.h | |
parent | efcd1bf394668e418df1a93cd28cf9e8b0c09ce5 (diff) | |
download | redis-6fa8e4f7afcbd14748c736c38e5fbc117eaef7ba.tar.gz |
Set replicas to panic on disk errors, and optionally panic on replication errors (#10504)
* Till now, replicas that were unable to persist, would still execute the commands
they got from the master, now they'll panic by default, and we add a new
`replica-ignore-disk-errors` config to change that.
* Till now, when a command failed on a replica or AOF-loading, it only logged a
warning and a stat, we add a new `propagation-error-behavior` config to allow
panicking in that state (may become the default one day)
Note that commands that fail on the replica can either indicate a bug that could
cause data inconsistency between the replica and the master, or they could be
in some cases (specifically in previous versions), a result of a command (e.g. EVAL)
that failed on the master, but still had to be propagated to fail on the replica as well.
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server.h b/src/server.h index ef0215fe0..b26ec7b3b 100644 --- a/src/server.h +++ b/src/server.h @@ -1325,6 +1325,15 @@ struct redisMemOverhead { } *db; }; +/* Replication error behavior determines the replica behavior + * when it receives an error over the replication stream. In + * either case the error is logged. */ +enum { + PROPAGATION_ERR_BEHAVIOR_IGNORE = 0, + PROPAGATION_ERR_BEHAVIOR_PANIC, + PROPAGATION_ERR_BEHAVIOR_PANIC_ON_REPLICAS +} replicationErrorBehavior; + /* This structure can be optionally passed to RDB save/load functions in * order to implement additional functionalities, by storing and loading * metadata to the RDB file. @@ -1772,6 +1781,10 @@ struct redisServer { int replica_announced; /* If true, replica is announced by Sentinel */ int slave_announce_port; /* Give the master this listening port. */ char *slave_announce_ip; /* Give the master this ip address. */ + int propagation_error_behavior; /* Configures the behavior of the replica + * when it receives an error on the replication stream */ + int repl_ignore_disk_write_error; /* Configures whether replicas panic when unable to + * persist writes to AOF. */ /* The following two fields is where we store master PSYNC replid/offset * while the PSYNC is in progress. At the end we'll copy the fields into * the server->master client structure. */ |