Skip to content

Conversation

@rafiss
Copy link
Collaborator

@rafiss rafiss commented Jan 4, 2026

Previously, the descs.Collection tracked uncommitted comments and zone configs in two separate structs (uncommittedComments and uncommittedZoneConfigs), each with their own map-based storage and cache tracking.

This commit consolidates both into a single uncommittedMetadata struct backed by nstree.MutableCatalog. This approach was suggested in PR #105981 because MutableCatalog already provides:

  • Built-in lazy initialization
  • Memory tracking via byteSize
  • Unified storage for comments and zone configs

The new design uses MutableCatalog for value storage and separate "absent" sets to track entries that have been looked up and found to be deleted or non-existent. This maintains the same three-state cache semantics (not cached, cached-absent, cached-with-value) while consolidating the implementation.

Note: AddUncommittedComment now returns an error to properly propagate validation errors from MutableCatalog.UpsertComment.

fixes #106151
Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Jan 4, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, the `descs.Collection` tracked uncommitted comments and zone
configs in two separate structs (`uncommittedComments` and
`uncommittedZoneConfigs`), each with their own map-based storage and
cache tracking.

This commit consolidates both into a single `uncommittedMetadata` struct
backed by `nstree.MutableCatalog`. This approach was suggested in
PR cockroachdb#105981 because MutableCatalog already provides:
- Built-in lazy initialization
- Memory tracking via byteSize
- Unified storage for comments and zone configs

The new design uses MutableCatalog for value storage and separate
"absent" sets to track entries that have been looked up and found to be
deleted or non-existent. This maintains the same three-state cache
semantics (not cached, cached-absent, cached-with-value) while
consolidating the implementation.

Note: `AddUncommittedComment` now returns an error to properly propagate
validation errors from `MutableCatalog.UpsertComment`.

Release note: None
@rafiss rafiss force-pushed the uncommitted-metadata-catalog branch from b4d326b to 5eeec95 Compare January 5, 2026 04:16
@rafiss rafiss marked this pull request as ready for review January 5, 2026 16:16
@rafiss rafiss requested a review from a team as a code owner January 5, 2026 16:16
@rafiss rafiss requested a review from fqazi January 5, 2026 16:16
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

:lgtm:

@fqazi reviewed 6 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rafiss).

@rafiss
Copy link
Collaborator Author

rafiss commented Jan 6, 2026

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 6, 2026

@craig craig bot merged commit 3c9a12c into cockroachdb:master Jan 6, 2026
26 checks passed
@rafiss rafiss deleted the uncommitted-metadata-catalog branch January 7, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

descs: use nstree.MutableCatalog for uncommitted layer

3 participants