Make names even across change and add lowest-compatible-version to status json

This commit is contained in:
Bharadwaj V.R 2022-04-15 13:57:58 -07:00
parent ce5bcc0261
commit 11f2827c82
4 changed files with 42 additions and 23 deletions

View File

@ -695,7 +695,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
}, },
"cluster_controller_timestamp":1415650089, "cluster_controller_timestamp":1415650089,
"protocol_version":"fdb00a400050001", "protocol_version":"fdb00a400050001",
"latest_server_version":"fdb00a500040001", "newest_protocol_version":"fdb00a500040001",
"lowest_compatible_protocol_version":"fdb00a500040001",
"connection_string":"a:a@127.0.0.1:4000", "connection_string":"a:a@127.0.0.1:4000",
"full_replication":true, "full_replication":true,
"maintenance_zone":"0ccb4e0fdbdb5583010f6b77d9d10ece", "maintenance_zone":"0ccb4e0fdbdb5583010f6b77d9d10ece",

View File

@ -1408,8 +1408,8 @@ ACTOR Future<Void> clusterRecoveryCore(Reference<ClusterRecoveryData> self) {
wait(self->cstate.read()); wait(self->cstate.read());
if (self->cstate.prevDBState.lowestCompatibleServerVersion > currentProtocolVersion) { if (self->cstate.prevDBState.lowestCompatibleProtocolVersion > currentProtocolVersion) {
TraceEvent(SevWarnAlways, "IncompatibleServerVersion", self->dbgid).log(); TraceEvent(SevWarnAlways, "IncompatibleProtocolVersion", self->dbgid).log();
throw internal_error(); throw internal_error();
} }
@ -1469,18 +1469,18 @@ ACTOR Future<Void> clusterRecoveryCore(Reference<ClusterRecoveryData> self) {
DBCoreState newState = self->cstate.myDBState; DBCoreState newState = self->cstate.myDBState;
newState.recoveryCount++; newState.recoveryCount++;
newState.recoveryCount++; newState.recoveryCount++;
if (self->cstate.prevDBState.newestServerVersion.isInvalidMagic() || if (self->cstate.prevDBState.newestProtocolVersion.isInvalidMagic() ||
self->cstate.prevDBState.newestServerVersion < currentProtocolVersion) { self->cstate.prevDBState.newestProtocolVersion < currentProtocolVersion) {
ASSERT(self->cstate.myDBState.lowestCompatibleServerVersion.isInvalidMagic() || ASSERT(self->cstate.myDBState.lowestCompatibleProtocolVersion.isInvalidMagic() ||
!self->cstate.myDBState.newestServerVersion.isInvalidMagic()); !self->cstate.myDBState.newestProtocolVersion.isInvalidMagic());
newState.newestServerVersion = currentProtocolVersion; newState.newestProtocolVersion = currentProtocolVersion;
newState.lowestCompatibleServerVersion = minCompatibleProtocolVersion; newState.lowestCompatibleProtocolVersion = minCompatibleProtocolVersion;
} }
wait(self->cstate.write(newState) || recoverAndEndEpoch); wait(self->cstate.write(newState) || recoverAndEndEpoch);
TraceEvent("SWVersionCompatibilityChecked", self->dbgid) TraceEvent("ProtocolVersionCompatibilityChecked", self->dbgid)
.detail("NewestServerVersion", self->cstate.myDBState.newestServerVersion) .detail("NewestProtocolVersion", self->cstate.myDBState.newestProtocolVersion)
.detail("LowestCompatibleVersion", self->cstate.myDBState.lowestCompatibleServerVersion) .detail("LowestCompatibleProtocolVersion", self->cstate.myDBState.lowestCompatibleProtocolVersion)
.trackLatest(self->swVersionCheckedEventHolder->trackingKey); .trackLatest(self->swVersionCheckedEventHolder->trackingKey);
self->recoveryState = RecoveryState::RECRUITING; self->recoveryState = RecoveryState::RECRUITING;

View File

@ -141,13 +141,13 @@ struct DBCoreState {
DBRecoveryCount recoveryCount; // Increases with sequential successful recoveries. DBRecoveryCount recoveryCount; // Increases with sequential successful recoveries.
LogSystemType logSystemType; LogSystemType logSystemType;
std::set<int8_t> pseudoLocalities; std::set<int8_t> pseudoLocalities;
ProtocolVersion newestServerVersion; ProtocolVersion newestProtocolVersion;
ProtocolVersion lowestCompatibleServerVersion; ProtocolVersion lowestCompatibleProtocolVersion;
DBCoreState() DBCoreState()
: logRouterTags(0), txsTags(0), recoveryCount(0), logSystemType(LogSystemType::empty), : logRouterTags(0), txsTags(0), recoveryCount(0), logSystemType(LogSystemType::empty),
newestServerVersion(ProtocolVersion::invalidProtocolVersion), newestProtocolVersion(ProtocolVersion::invalidProtocolVersion),
lowestCompatibleServerVersion(ProtocolVersion::invalidProtocolVersion) {} lowestCompatibleProtocolVersion(ProtocolVersion::invalidProtocolVersion) {}
std::vector<UID> getPriorCommittedLogServers() { std::vector<UID> getPriorCommittedLogServers() {
std::vector<UID> priorCommittedLogServers; std::vector<UID> priorCommittedLogServers;
@ -186,7 +186,7 @@ struct DBCoreState {
serializer(ar, txsTags); serializer(ar, txsTags);
} }
if (ar.protocolVersion().hasSWVersionTracking()) { if (ar.protocolVersion().hasSWVersionTracking()) {
serializer(ar, newestServerVersion, lowestCompatibleServerVersion); serializer(ar, newestProtocolVersion, lowestCompatibleProtocolVersion);
} }
} else if (ar.isDeserializing) { } else if (ar.isDeserializing) {
tLogs.push_back(CoreTLogSet()); tLogs.push_back(CoreTLogSet());

View File

@ -1528,7 +1528,20 @@ ACTOR static Future<Void> logRangeWarningFetcher(Database cx,
return Void(); return Void();
} }
ACTOR Future<ProtocolVersion> getNewestProtocolVersion(Database cx, WorkerDetails ccWorker) { struct ProtocolVersionData {
ProtocolVersion runningProtocolVersion;
ProtocolVersion newestProtocolVersion;
ProtocolVersion lowestCompatibleProtocolVersion;
ProtocolVersionData()
: runningProtocolVersion(currentProtocolVersion), newestProtocolVersion(ProtocolVersion()),
lowestCompatibleProtocolVersion(ProtocolVersion()) {}
ProtocolVersionData(uint64_t newestProtocolVersionValue, uint64_t lowestCompatibleProtocolVersionValue)
: runningProtocolVersion(currentProtocolVersion), newestProtocolVersion(newestProtocolVersionValue),
lowestCompatibleProtocolVersion(lowestCompatibleProtocolVersionValue) {}
};
ACTOR Future<ProtocolVersionData> getNewestProtocolVersion(Database cx, WorkerDetails ccWorker) {
try { try {
state Future<TraceEventFields> swVersionF = timeoutError( state Future<TraceEventFields> swVersionF = timeoutError(
@ -1537,15 +1550,18 @@ ACTOR Future<ProtocolVersion> getNewestProtocolVersion(Database cx, WorkerDetail
wait(success(swVersionF)); wait(success(swVersionF));
const TraceEventFields& swVersionTrace = swVersionF.get(); const TraceEventFields& swVersionTrace = swVersionF.get();
int64_t newestProtocolVersionValue = int64_t newestProtocolVersionValue =
std::stoull(swVersionTrace.getValue("NewestServerVersion").c_str(), nullptr, 16); std::stoull(swVersionTrace.getValue("NewestProtocolVersion").c_str(), nullptr, 16);
return ProtocolVersion(newestProtocolVersionValue); int64_t lowestCompatibleProtocolVersionValue =
std::stoull(swVersionTrace.getValue("LowestCompatibleProtocolVersion").c_str(), nullptr, 16);
return ProtocolVersionData(newestProtocolVersionValue, lowestCompatibleProtocolVersionValue);
} catch (Error& e) { } catch (Error& e) {
if (e.code() == error_code_actor_cancelled) if (e.code() == error_code_actor_cancelled)
throw; throw;
TraceEvent(SevWarnAlways, "SWVersionStatusFailed").error(e); TraceEvent(SevWarnAlways, "SWVersionStatusFailed").error(e);
return ProtocolVersion();
return ProtocolVersionData();
} }
} }
@ -2902,7 +2918,7 @@ ACTOR Future<StatusReply> clusterGetStatus(
messages.push_back(message); messages.push_back(message);
} }
state ProtocolVersion newestProtocolVersion = wait(getNewestProtocolVersion(cx, ccWorker)); state ProtocolVersionData protocolVersion = wait(getNewestProtocolVersion(cx, ccWorker));
// construct status information for cluster subsections // construct status information for cluster subsections
state int statusCode = (int)RecoveryStatus::END; state int statusCode = (int)RecoveryStatus::END;
@ -2941,7 +2957,9 @@ ACTOR Future<StatusReply> clusterGetStatus(
statusObj["protocol_version"] = format("%" PRIx64, g_network->protocolVersion().version()); statusObj["protocol_version"] = format("%" PRIx64, g_network->protocolVersion().version());
statusObj["connection_string"] = coordinators.ccr->getConnectionString().toString(); statusObj["connection_string"] = coordinators.ccr->getConnectionString().toString();
statusObj["bounce_impact"] = getBounceImpactInfo(statusCode); statusObj["bounce_impact"] = getBounceImpactInfo(statusCode);
statusObj["latest_server_version"] = format("%" PRIx64, newestProtocolVersion.version()); statusObj["newest_protocol_version"] = format("%" PRIx64, protocolVersion.newestProtocolVersion.version());
statusObj["lowest_compatible_protocol_version"] =
format("%" PRIx64, protocolVersion.lowestCompatibleProtocolVersion.version());
state Optional<DatabaseConfiguration> configuration; state Optional<DatabaseConfiguration> configuration;
state Optional<LoadConfigurationResult> loadResult; state Optional<LoadConfigurationResult> loadResult;