mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +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) {
|
bool DatabaseConfiguration::set(KeyRef key, ValueRef value) {
|
||||||
makeConfigurationMutable();
|
makeConfigurationMutable();
|
||||||
mutableConfiguration.get()[key.toString()] = value.toString();
|
mutableConfiguration.get()[key.toString()] = value.toString();
|
||||||
|
@ -104,6 +104,8 @@ struct DatabaseConfiguration {
|
|||||||
DatabaseConfiguration();
|
DatabaseConfiguration();
|
||||||
|
|
||||||
void applyMutation(MutationRef mutation);
|
void applyMutation(MutationRef mutation);
|
||||||
|
// return true if mutation will cause configuration changes
|
||||||
|
bool involveMutation(MutationRef mutation);
|
||||||
bool set(KeyRef key,
|
bool set(KeyRef key,
|
||||||
ValueRef value); // Returns true if a configuration option that requires recovery to take effect is changed
|
ValueRef value); // Returns true if a configuration option that requires recovery to take effect is changed
|
||||||
bool clear(KeyRangeRef keys);
|
bool clear(KeyRangeRef keys);
|
||||||
|
@ -869,7 +869,8 @@ ACTOR Future<Standalone<CommitTransactionRef>> provisionalMaster(Reference<Clust
|
|||||||
.detail("MType", m->type)
|
.detail("MType", m->type)
|
||||||
.detail("Param1", m->param1)
|
.detail("Param1", m->param1)
|
||||||
.detail("Param2", m->param2);
|
.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
|
// We keep the mutations and write conflict ranges from this transaction, but not its read
|
||||||
// conflict ranges
|
// conflict ranges
|
||||||
Standalone<CommitTransactionRef> out;
|
Standalone<CommitTransactionRef> out;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user