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

server: create new memdb table for storing system metadata #8703

Merged
merged 6 commits into from
Oct 6, 2020

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Sep 17, 2020

This adds a new very tiny memdb table and corresponding raft operation
for updating a very small effective map[string]string collection of
"system metadata". This can persistently record a fact about the Consul
state machine itself.

The first use of this feature will come in a later PR.

@rboyer rboyer requested review from mkeeler and a team September 17, 2020 19:54
@rboyer rboyer self-assigned this Sep 17, 2020
agent/consul/state/system_metadata.go Outdated Show resolved Hide resolved
agent/consul/state/system_metadata.go Outdated Show resolved Hide resolved
Op SystemMetadataOp

// Entries is the set of keys to modify.
Entries []*SystemMetadataEntry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this accepts a slice rather than a single entry?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not have a use case for multiple atomic updates at this time. It seemed somewhat cheap to make it possible to do multiple atomic updates in the future without having to resort to introducing either another raft operation integer code or to shim this into Txn.

Alternatively I could do it this way now:

type SystemMetadataRequest struct {
  Datacenter String
  Op SystemMetadataOp
  Entry *SystemMetadataEntry
  WriteRequest
}

And then should we need multi-write, we could just do it union style:

type SystemMetadataRequest struct {
  Datacenter String
  Op SystemMetadataOp

  // Only one of Entry or Entries may be specified.
  Entry *SystemMetadataEntry
  Entries []*SystemMetadataEntry

  WriteRequest
}

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is a possibility. I lean toward having a single entry per request and revisiting the txn path later.

agent/structs/system_metadata.go Outdated Show resolved Hide resolved
Copy link
Contributor

@freddygv freddygv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one last comment but will leave it up to you

rboyer and others added 6 commits October 6, 2020 09:59
This adds a new very tiny memdb table and corresponding raft operation
for updating a very small effective map[string]string collection of
"system metadata". This can persistently record a fact about the Consul
state machine itself.

The first use of this feature will come in a later PR.
Co-authored-by: Freddy <freddygv@users.noreply.github.com>
@rboyer rboyer merged commit 4998a08 into master Oct 6, 2020
@rboyer rboyer deleted the system-metadata branch October 6, 2020 15:08
kaxcode pushed a commit that referenced this pull request Oct 7, 2020
This adds a new very tiny memdb table and corresponding raft operation
for updating a very small effective map[string]string collection of
"system metadata". This can persistently record a fact about the Consul
state machine itself.

The first use of this feature will come in a later PR.
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.

3 participants