Skip to content

db: genericize rangeDel{Cache,Frags} into keySpan{Cache,Frags}#1356

Merged
jbowens merged 1 commit intocockroachdb:masterfrom
jbowens:keySpanCache
Nov 1, 2021
Merged

db: genericize rangeDel{Cache,Frags} into keySpan{Cache,Frags}#1356
jbowens merged 1 commit intocockroachdb:masterfrom
jbowens:keySpanCache

Conversation

@jbowens
Copy link
Copy Markdown
Contributor

@jbowens jbowens commented Oct 28, 2021

Rename the memtable's rangeDelCache and rangeDelFrags types to
keySpanCache and keySpanFrags so they may be used for caching range
key fragments too.

In addition to the pure renames, I made a small refactor to decouple the
dependency on memTable.tombstones by adding a pointer to the skiplist
in a keySpanCache field.

@jbowens jbowens requested a review from sumeerbhola October 28, 2021 16:28
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jbowens)


mem_table.go, line 371 at r1 (raw file):

		return nil
	}
	return frags.get(c.skl, c.cmp, c.formatKey)

Can't the code in this method extract these from m like the callee used to do, and then call frags.get. I am trying to understand why we need the member variables in keySpanCache.

Or is this just the first step in the refactor and get will eventually not take a memTable parameter. Should it be removed now itself, since it is unused?

Rename the memtable's `rangeDelCache` and `rangeDelFrags` types to
`keySpanCache` and `keySpanFrags` so they may be used for caching range
key fragments too.

In addition to the pure renames, I made a small refactor to decouple the
dependency on `memTable.tombstones` by adding a pointer to the skiplist
to a `keySpanCache` field.
Copy link
Copy Markdown
Contributor Author

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @sumeerbhola)


mem_table.go, line 371 at r1 (raw file):

Previously, sumeerbhola wrote…

Can't the code in this method extract these from m like the callee used to do, and then call frags.get. I am trying to understand why we need the member variables in keySpanCache.

Or is this just the first step in the refactor and get will eventually not take a memTable parameter. Should it be removed now itself, since it is unused?

Oops, yeah, I forgot to remove the memTable parameter when extracting this change from another branch. Thanks :)

Copy link
Copy Markdown
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sumeerbhola)

Copy link
Copy Markdown
Contributor Author

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sumeerbhola)

@jbowens jbowens merged commit 7369c45 into cockroachdb:master Nov 1, 2021
@jbowens jbowens deleted the keySpanCache branch November 1, 2021 15:16
@jbowens jbowens mentioned this pull request Nov 30, 2021
29 tasks
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