Guard CD's cross cluster check behind a KNOB controlled flag and disable it by default.

This commit is contained in:
Xin Dong 2021-02-01 14:39:30 -08:00
parent 4e81b9275b
commit 1cc8c1d8ec
3 changed files with 15 additions and 11 deletions

View File

@ -475,8 +475,7 @@ struct LeaderRegisterCollection {
return Optional<LeaderInfo>();
if (t != forwardStartTime.end()) {
double forwardTime = t->value;
if (SERVER_KNOBS->FORWARD_REQUEST_TOO_OLD > 0 &&
now() - forwardTime > SERVER_KNOBS->FORWARD_REQUEST_TOO_OLD) {
if (now() - forwardTime > SERVER_KNOBS->FORWARD_REQUEST_TOO_OLD) {
TraceEvent(SevWarnAlways, "AccessOldForward")
.detail("ForwardSetSecondsAgo", now() - forwardTime)
.detail("ForwardClusterKey", key);
@ -552,8 +551,9 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
info.forward = forward.get().serializedInfo;
req.reply.send( CachedSerialization<ClientDBInfo>(info) );
} else {
if (ccf->getConnectionString().clusterKey() != req.clusterKey ||
ccf->getConnectionString().coordinators() != req.coordinators) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT &&
(ccf->getConnectionString().clusterKey() != req.clusterKey ||
ccf->getConnectionString().coordinators() != req.coordinators)) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "OpenDatabaseCoordRequest")
.detail("LocalCS", ccf->getConnectionString().toString())
@ -570,8 +570,9 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
if( forward.present() ) {
req.reply.send( forward.get() );
} else {
if (ccf->getConnectionString().clusterKey() != req.key ||
ccf->getConnectionString().coordinators() != req.coordinators) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT &&
(ccf->getConnectionString().clusterKey() != req.key ||
ccf->getConnectionString().coordinators() != req.coordinators)) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "ElectionResultRequest")
.detail("LocalCS", ccf->getConnectionString().toString())
@ -588,7 +589,7 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
if( forward.present() )
req.reply.send( forward.get() );
else {
if (ccf->getConnectionString().clusterKey() != req.key) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT && ccf->getConnectionString().clusterKey() != req.key) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "GetLeaderRequest")
.detail("LocalCS", ccf->getConnectionString().toString())
@ -604,7 +605,7 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
if( forward.present() )
req.reply.send( forward.get() );
else {
if (ccf->getConnectionString().clusterKey() != req.key) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT && ccf->getConnectionString().clusterKey() != req.key) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "CandidacyRequest")
.detail("LocalCS", ccf->getConnectionString().toString())
@ -620,7 +621,7 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
if( forward.present() )
req.reply.send(LeaderHeartbeatReply{ false });
else {
if (ccf->getConnectionString().clusterKey() != req.key) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT && ccf->getConnectionString().clusterKey() != req.key) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "LeaderHeartbeatRequest")
.detail("LocalCS", ccf->getConnectionString().toString())
@ -636,7 +637,7 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
if( forward.present() )
req.reply.send( Void() );
else {
if (ccf->getConnectionString().clusterKey() != req.key) {
if (SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT && ccf->getConnectionString().clusterKey() != req.key) {
TraceEvent(SevWarnAlways, "CCFMismatch")
.detail("RequestType", "ForwardRequest")
.detail("LocalCS", ccf->getConnectionString().toString())

View File

@ -606,7 +606,8 @@ void ServerKnobs::initialize(bool randomize, ClientKnobs* clientKnobs, bool isSi
// Coordination
init( COORDINATED_STATE_ONCONFLICT_POLL_INTERVAL, 1.0 ); if( randomize && BUGGIFY ) COORDINATED_STATE_ONCONFLICT_POLL_INTERVAL = 10.0;
init( FORWARD_REQUEST_TOO_OLD, 600.0); if( randomize && BUGGIFY ) FORWARD_REQUEST_TOO_OLD = 60.0; // Set this to -1 to disable the expiry check.
init( FORWARD_REQUEST_TOO_OLD, 600.0); if( randomize && BUGGIFY ) FORWARD_REQUEST_TOO_OLD = 60.0;
init( ENABLE_CROSS_CLUSTER_SUPPORT, false); if( randomize && BUGGIFY ) ENABLE_CROSS_CLUSTER_SUPPORT = true;
// Buggification
init( BUGGIFIED_EVENTUAL_CONSISTENCY, 1.0 );

View File

@ -536,6 +536,8 @@ public:
// Coordination
double COORDINATED_STATE_ONCONFLICT_POLL_INTERVAL;
double FORWARD_REQUEST_TOO_OLD;
bool ENABLE_CROSS_CLUSTER_SUPPORT; // Allow a coordinator to serve requests whose connection string does not match
// the local copy
// Buggification
double BUGGIFIED_EVENTUAL_CONSISTENCY;