mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
only add mutations can change configuration (#6760)
This commit is contained in:
parent
dcfb6ee520
commit
ce33366396
@ -660,6 +660,11 @@ void DatabaseConfiguration::applyMutation(MutationRef m) {
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseConfiguration::involveMutation(MutationRef m) {
|
||||
return (m.type == MutationRef::SetValue && m.param1.startsWith(configKeysPrefix)) ||
|
||||
(m.type == MutationRef::ClearRange && KeyRangeRef(m.param1, m.param2).intersects(configKeys));
|
||||
}
|
||||
|
||||
bool DatabaseConfiguration::set(KeyRef key, ValueRef value) {
|
||||
makeConfigurationMutable();
|
||||
mutableConfiguration.get()[key.toString()] = value.toString();
|
||||
|
@ -104,6 +104,8 @@ struct DatabaseConfiguration {
|
||||
DatabaseConfiguration();
|
||||
|
||||
void applyMutation(MutationRef mutation);
|
||||
// return true if mutation will cause configuration changes
|
||||
bool involveMutation(MutationRef mutation);
|
||||
bool set(KeyRef key,
|
||||
ValueRef value); // Returns true if a configuration option that requires recovery to take effect is changed
|
||||
bool clear(KeyRangeRef keys);
|
||||
|
@ -869,7 +869,8 @@ ACTOR Future<Standalone<CommitTransactionRef>> provisionalMaster(Reference<Clust
|
||||
.detail("MType", m->type)
|
||||
.detail("Param1", m->param1)
|
||||
.detail("Param2", m->param2);
|
||||
if (isMetadataMutation(*m)) {
|
||||
// emergency transaction only mean to do configuration change
|
||||
if (parent->configuration.involveMutation(*m)) {
|
||||
// We keep the mutations and write conflict ranges from this transaction, but not its read
|
||||
// conflict ranges
|
||||
Standalone<CommitTransactionRef> out;
|
||||
|
Loading…
x
Reference in New Issue
Block a user