-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor: reduce catalog locks when getting chunks #25896
Conversation
The main refactor was to change the ChunkContainer trait to use the DatabaseSchema and TableDefinition types directly in the signature, vs. the names, which then required an additional catalog lock and lookups for both entities. This was already handled upstream in the QueryTable, so there was no need to do the lookups again. This required the addition of a test helper in influxdb3_write::test_helpers that provides convenience methods for getting record batches from the WriteBuffer. We have been implementing such a method manually in several places, so this is nice to have it unified. This provides a blanket impl so that anything implementing WriteBuffer gets the method. Some other house cleaning was included.
4cc402a
to
57d5ab9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole, it looks good - the read lock I guess is held to lookup DatabaseSchema
by name in order to create Database
? - just wanted to confirm if that's the one you were referring to in PR comment.
Yep, that is correct. I am referring to the read lock when calling I am going to hold off on merging this for a bit as I reason through some downstream changes needed in enterprise (see https://github.com/influxdata/influxdb_pro/issues/451#issuecomment-2607704757). I need to make sure this doesn't break things for that work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The main refactor was to change the
ChunkContainer
trait to use theDatabaseSchema
andTableDefinition
types directly in the signature, vs. their names; using their names led to an additional catalog lock and lookups for both entities, because there was already a catalog lock/lookup upstream in theQueryTable
.However, using the names in the
ChunkContainer::get_table_chunks
was convenient, specifically for tests, so I included a test helper trait ininfluxdb3_write::test_helpers
calledWriteBufferTester
that provides convenience methods for getting record batches from aWriteBuffer
implementation. Alongside the definition ofWriteBufferTester
is a blanketimpl
on that anyT
that implementsWriteBuffer
.We have been implementing similar methods manually in several places when testing in Enterprise, so this should give us a unified implementation for that.
Some other house cleaning was included 🧹
influxdb3_wal::TableDefinition
toWalTableDefinition
to reduce naming conflicts.BufferFilter
toChunkFilter
, and within that,BufferGuarantee
was changed toHashedLiteralGuarantee
table_buffer
code