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

prototype int8range #129233

Draft
wants to merge 45 commits into
base: master
Choose a base branch
from
Draft

prototype int8range #129233

wants to merge 45 commits into from

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Aug 19, 2024

We're building a prototype of range types for breather week! Starting with int8range.

Informs: #27791

craig[bot] and others added 3 commits August 19, 2024 06:24
128400: sqlstats/insights: fix mem leaks on session close r=xinhaoz a=xinhaoz

insights: ensure releasing to Insight pool clears slice

Ensure that when we return objects into the Insight pool
that we release the statmeents in the slice. This fixes
an issue in the logic that returned this object to the pool
which did not nil the `Statements` slice, making it possible
for these slices to grow in capacity in the node's lifetime,
holding onto garbage Statement objects.

This is a lead up to cockroachdb#128199 which will likely remove
this pool and reuse the existing statmentBuf pool.

Epic: none
Release note: None

insights: add testing knobs

Add insights specific testing knobs. We'll add some
knobs in later commts.

Epic: none
Release note: None

sqlstats/insights: free memory allocated per session on session close

The insights locking registry buffers statement insight objects
by session id until receiving a transaction insight, when the
buffer is emptied. These buffers can leak if the session is closed
midway through a transaction since the registry will never
receive a transaction event for the session. This commit ensures
we clear any memory allocated in insights for a session by
sending an event to clear the container's session entry, if it
exists, on session close.

A testing knob was added, OnCloseSession, which is called
when the locking registry clears a session.

Epic: none
Fixes: cockroachdb#128213

Release note (bug fix): Fixes a memory leak where statement
insight objects may leak if the session is closed without
the transaction finishing.

insights: move insights testing knobs from sqlstats

Move some insights testing knobs that were on the
sqlstats testing knobs to insights pkg.

Epic: none

Release note: None

Co-authored-by: Xin Hao Zhang <[email protected]>
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@michae2
Copy link
Collaborator Author

michae2 commented Aug 19, 2024

@ZhouXing19 and @sambhav-jain-16, it's a bit of a hack, but I added you both as reviewers to this fake PR so that hopefully you'll get email notifications whenever someone pushes to the branch

@ZhouXing19 ZhouXing19 force-pushed the rangetypes branch 3 times, most recently from e31dd13 to 2d8489f Compare August 19, 2024 16:51
Copy link

blathers-crl bot commented Aug 19, 2024

It looks like your PR touches SQL parser code but doesn't add or edit parser tests. Please make sure you add or edit parser tests if you edit the parser.

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

Copy link

blathers-crl bot commented Aug 21, 2024

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

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

@michae2 michae2 changed the title Rangetypes prototype int8range Aug 22, 2024
ZhouXing19 and others added 4 commits August 22, 2024 17:55
You might see panic after a while after executing:

root@localhost:26259/defaultdb> CREATE TABLE ab (a INT PRIMARY KEY, b INT8RANGE);
CREATE TABLE

Time: 21ms total (execution 21ms / network 1ms)

root@localhost:26259/defaultdb> CREATE INDEX ON ab (b);
CREATE INDEX

Time: 652ms total (execution 652ms / network 0ms)

root@localhost:26259/defaultdb> INSERT INTO ab VALUES (1, '[2,3)'::int8range);
INSERT 0 1
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.

4 participants