Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single primary cluster file per cluster #2229

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

iwalther
Copy link

Description

Follow up of: #2200
Follow up of: #2204
Follow up of:#2216

Keep a single, long-lived cluster file per cluster UID that is once written and then only managed by the FDB client library.

The problem is that multiple entities are writing the cluster file, concurrently without synchronization, leading to races:

  • The FDB client library through the golang binding - the golang binding maintains a singleton per cluster file.
  • Each fdbcli instance that FDB operator spawns, on notification from the cluster about a generation change,
  • the kubernetes operator itself e.g. when trying connection options.

To decouple the fdbcli invocations, this change will write a temporary cluster file per fdbcli invocation, synthesized from the current connection string as indicated by the FDB client library. We discard the file immediately after use.

To remove the race with trying connection options, we adjust the lifecycle of the FDB admin client. We create a singleton instance per cluster UID, maintained by a singleton database provider. The initial connection always uses the seed connection string, afterwards we only poll the FDB client library for updates to the connection string.

With that, the FDB client library can exclusively manage the cluster file.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Discussion

n/a

Testing

Unit tests pass but I still didn't manage to run the e2e tests.

Documentation

n/a

Follow-up

Not sure if there are still races with the lock client accessing the same cluster file.

The go fdb binding and fdbcli were writing to the same cluster file
concurrently without synchronization. This change decouples fdbcli
invocations from the library's cluster file and from each other by
writing a private temporary cluster file for each fdbcli invocation.
The admin client is initialized only once when used the first time,
using the seed connection string. After that, we can ask the cluster for
the latest connection string. In particualr, we no longer overwrite the
cluster file, which is maintained by the FDB client library.
If a cluster file already exists, it is managed and kept up-to-date by
the FoundationDB library. We do not overwrite it if the content differs
from the cached connection string. Instead, we'll update the cached
connection string as part of the next reconciliation.
It is a no-op and the admin client is now a singleton that should never
be closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant