cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.95k stars 3.79k forks source link

changefeedccl: use show jobs age filter for show changefeed jobs #124882

Closed rharding6373 closed 1 week ago

rharding6373 commented 4 months ago

Both SHOW JOBS and SHOW CHANGEFEED JOBS list jobs that may have failed or been canceled. However, SHOW JOBS only shows jobs from the last 12 hours by default and SHOW CHANGEFEED JOBS shows the last 14 days by default. We should have SHOW CHANGEFEED JOBS mirror the SHOW JOBS behavior. If users want to show more jobs, they can query the jobs table directly.

Jira issue: CRDB-39125

blathers-crl[bot] commented 4 months ago

cc @cockroachdb/cdc

leorporat commented 3 months ago

I'm interested in working on this issue -- is it possible to take a look at it?

rharding6373 commented 3 months ago

Thanks for your interest! Please feel free to work on this issue, and include me in the reviewers when you're ready. If you haven't seen it yet, here is some helpful guidance on how to submit a PR to cockroachdb: https://cockroachlabs.atlassian.net/wiki/spaces/CRDB/pages/181469476/Submitting+your+contribution

XiaochenCui commented 3 months ago

Hi, @rharding6373:

I would like to work on this issue, but I don't have access to the issue page on jira (cockroachlabs.atlassian.net), can you help me with that? Thanks a lot!

asg0451 commented 3 months ago

Hey @XiaochenCui, stepping in here since Rachael is out. Our JIRA issues are identical to our Github issues, so you're not missing any information by not having access to it. Everything is mirrored in this issue. If you have any questions or need any help please let me know!

XiaochenCui commented 3 months ago

Hi @asg0451, Thank you for the information!

jonathanc-n commented 3 months ago

Hello, I'm trying to create a test for my implementation, I am trying to insert new jobs using a specific timestamp and querying to check if it is returning the correct value. Where do I find the schema for the job tables?

asg0451 commented 3 months ago

Hey @jonathanc-n, you don't create changefeeds by inserting into the jobs table, you do it by executing a CREATE CHANGEFEED command. See the documentation here: https://www.cockroachlabs.com/docs/stable/create-changefeed

jonathanc-n commented 3 months ago

Hello @asg0451 . When running the test it says, 'kv.rangefeed.enabled is only settable by the operator'. I couldn't find any thing in the documentation to change the way I am enabling the kv.rangefeed. Do you know of a way to fix this?

asg0451 commented 3 months ago

@jonathanc-n which test are you running that's running into this? are you running this manually against cockroach cloud serverless? if so, you don't need to set that option as it's already enabled.

jonathanc-n commented 3 months ago

@asg0451 it is happening in my own test that i created in show_changefeed_jobs_test.go. I originally didn't set it, but had to set it as it was logged in terminal when i tried running the test (I then assumed i would need it).

asg0451 commented 3 months ago

@jonathanc-n if you're using the cdctest test helpers you shouldnt need to set that setting. like this test here: https://github.com/asg0451/cockroach/blob/1d3c0cd070c5ab047ccaf987403cb1c5cc295e70/pkg/ccl/changefeedccl/show_changefeed_jobs_test.go#L116

Can you link the code that you're having the trouble with?

jonathanc-n commented 3 months ago

@asg0451 I made my own test case so I'm not able to link it. This is the error: error executing query="SET CLUSTER SETTING kv.rangefeed.enabled = true" args=[]: pq: setting kv.rangefeed.enabled is only settable by the operator

I am writing the tests in the same code file that you sent. How do you make sure you are using the cdc test helpers?

asg0451 commented 3 months ago

what if you don't run that query? what's the error then?

jonathanc-n commented 3 months ago

@asg0451 error executing query="CREATE CHANGEFEED FOR TABLE foo" args=[]: pq: rangefeeds require the kv.rangefeed.enabled setting. See https://www.cockroachlabs.com/docs/dev/create-and-configure-changefeeds.html#enable-rangefeeds

this is the error I receive when i don't enable it

asg0451 commented 3 months ago

Strange. I don't think I can help you debug this much further without actually seeing the code. Can you link it here?

jonathanc-n commented 3 months ago

@asg0451 Test file (bottom): https://github.com/jonathanc-n/cockroach/blob/master/pkg/ccl/changefeedccl/show_changefeed_jobs_test.go

Set up a simple test case for the change in this file: https://github.com/jonathanc-n/cockroach/blob/master/pkg/sql/delegate/show_changefeed_jobs.go

asg0451 commented 3 months ago

Ah I see. There is a way to fix this issue in the approach you've taken there. however, i recommend following the examples of the other tests in this file, such as this one https://github.com/jonathanc-n/cockroach/blob/master/pkg/ccl/changefeedccl/show_changefeed_jobs_test.go#L63

make a testfFn and call cdcTest(), etc

ritikBhandari commented 2 months ago

hi @asg0451, i see there was some work going on for this issue, would like to ask if this is fixed? if not, i can work on it if you dont mind.

rharding6373 commented 2 months ago

We haven't received a PR for this issue, so you're welcome to work on it.