Fixes simulation failures

Fixes the following issues:

1. Use the right index when initializing the WriteOnlySet's vector of
   atomics. Also switch to std::atomic_init to initialize each atomic in
   the vector (cannot default construct the atomics in the vector
   because std::atomic does not have a copy constructor).
2. Add failure check for when items cannot be inserted into the
   WriteOnlySet due to capacity constraints. This situation occurs when
   `copy` is not called on the WriteOnlySet, such as when sampling is
   disabled. The `copy` function is what clears the WriteOnlySet.
3. Remove a global config feature I added to update the ClientDBInfo
   object used by the global config listener function. This needs more
   investigation, but the effect of this change could be that global
   config changes are not correctly recognized on fdbserver processes.
4. Add various ASSERTs to verify data in WriteOnlySet.
This commit is contained in:
Lukas Joswiak 2021-05-01 15:20:49 -07:00
parent 5c1279ceb7
commit cf4218dfd1
7 changed files with 9 additions and 18 deletions

View File

@ -35,6 +35,9 @@ struct AnnotateActor {
AnnotateActor(Reference<ActorLineage> lineage) : set(true) {
index = g_network->getActorLineageSet().insert(lineage);
if (index == ActorLineageSet::npos) {
set = false;
}
}
AnnotateActor(const AnnotateActor& other) = delete;

View File

@ -48,10 +48,6 @@ void GlobalConfig::create(DatabaseContext* cx, Reference<AsyncVar<ClientDBInfo>>
}
}
void GlobalConfig::updateDBInfo(Reference<AsyncVar<ClientDBInfo>> dbInfo) {
_updater = updater(&GlobalConfig::globalConfig(), dbInfo);
}
GlobalConfig& GlobalConfig::globalConfig() {
void* res = g_network->global(INetwork::enGlobalConfig);
ASSERT(res);
@ -201,6 +197,7 @@ ACTOR Future<Void> GlobalConfig::refresh(GlobalConfig* self) {
// Applies updates to the local copy of the global configuration when this
// process receives an updated history.
ACTOR Future<Void> GlobalConfig::updater(GlobalConfig* self, Reference<AsyncVar<ClientDBInfo>> dbInfo) {
// wait(self->cx->onConnected());
wait(self->migrate(self));
wait(self->refresh(self));

View File

@ -83,14 +83,6 @@ public:
// For example, given "config/a", returns "\xff\xff/global_config/config/a".
static Key prefixedKey(KeyRef key);
// Update the ClientDBInfo object used internally to check for updates to
// global configuration. The ClientDBInfo reference must be the same one
// used in the cluster controller, but fdbserver requires initial creation
// of the GlobalConfig class before the cluster controller is initialized.
// This function allows the ClientDBInfo object to be updated after create
// was called.
void updateDBInfo(Reference<AsyncVar<ClientDBInfo>> dbInfo);
// Get a value from the framework. Values are returned as a ConfigValue
// reference which also contains the arena holding the object. As long as
// the caller keeps the ConfigValue reference, the value is guaranteed to

View File

@ -244,6 +244,7 @@ public:
auto& actorLineageSet = IAsyncFileSystem::filesystem()->getActorLineageSet();
auto index = actorLineageSet.insert(currentLineage);
ASSERT(index != ActorLineageSet::npos);
Future<Void> res = success(result);
actorLineageSet.erase(index);
return res;

View File

@ -135,9 +135,7 @@ public:
true,
TaskPriority::DefaultEndpoint,
true)) // SOMEDAY: Locality!
{
GlobalConfig::globalConfig().updateDBInfo(clientInfo);
}
{}
void setDistributor(const DataDistributorInterface& interf) {
auto newInfo = serverInfo->get();

View File

@ -62,6 +62,7 @@ bool WriteOnlySet<T, IndexType, CAPACITY>::eraseImpl(Index idx) {
template <class T, class IndexType, IndexType CAPACITY>
bool WriteOnlySet<T, IndexType, CAPACITY>::erase(Index idx) {
ASSERT(idx >= 0 && idx < CAPACITY);
auto res = eraseImpl(idx);
ASSERT(freeQueue.push(idx));
return res;
@ -86,7 +87,6 @@ bool WriteOnlySet<T, IndexType, CAPACITY>::replace(Index idx, const Reference<T>
if (ptr) {
reinterpret_cast<T*>(ptr)->delref();
}
_set[idx].store(lineagePtr);
return ptr != 0;
}
}
@ -98,7 +98,7 @@ WriteOnlySet<T, IndexType, CAPACITY>::WriteOnlySet() : _set(CAPACITY) {
// insert the free indexes in reverse order
for (unsigned i = CAPACITY; i > 0; --i) {
freeQueue.push(i - 1);
_set[i] = uintptr_t(0);
std::atomic_init(&_set[i - 1], uintptr_t(0));
}
}

View File

@ -31,7 +31,7 @@ WriteOnlyVariable<ActorLineage, unsigned> currentLineageThreadSafe;
LineagePropertiesBase::~LineagePropertiesBase() {}
ActorLineage::ActorLineage() : parent(currentLineage) {}
ActorLineage::ActorLineage() : properties(), parent(currentLineage) {}
ActorLineage::~ActorLineage() {
for (auto ptr : properties) {