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

feat: make scripts table work again #2420

Merged

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Sep 17, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

The final PR to make the scripts table work again.

Main changes:

  • Create scripts table in the public schema for every catalog
  • Create scripts table lazily only when inserting or executing scripts by HTTP APIs.
  • Create or insert scripts by the new APIs instead of table APIs.
  • Changed the scripts table schema, remove gmt_created and set schema, name, engine as primary key.

todo:

  • We need a hook that will be executed after table regions are all opened. The script manager will recompile and register all scripts as SQL UDF in that hook. cc @waynexia

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@killme2008 killme2008 marked this pull request as ready for review September 17, 2023 08:10
@killme2008 killme2008 changed the title feat: make scripts table working again feat: make scripts table work again Sep 17, 2023
@killme2008 killme2008 force-pushed the feature/distributed-scripts-table branch 2 times, most recently from cc5fbf2 to 30fcc11 Compare September 17, 2023 08:22
@killme2008 killme2008 force-pushed the feature/distributed-scripts-table branch from 30fcc11 to 1579f08 Compare September 17, 2023 08:30
@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Merging #2420 (fe703a4) into develop (542e863) will increase coverage by 0.10%.
Report is 13 commits behind head on develop.
The diff coverage is 62.84%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2420      +/-   ##
===========================================
+ Coverage    77.52%   77.63%   +0.10%     
===========================================
  Files          721      727       +6     
  Lines       113723   114386     +663     
===========================================
+ Hits         88167    88801     +634     
- Misses       25556    25585      +29     

@waynexia
Copy link
Member

We need a hook that will be executed after table regions are all opened. The script manager will recompile and register all scripts as SQL UDF in that hook. cc @waynexia

This kind of hook isn't viable, the region is opened in datanode while recompilation happened in frontend. After discussing with @killme2008 we think we need to add a "specific initialize" interface to frontend. Only initialized database (catalog/schema) are available in that instance.

src/servers/src/http/script.rs Show resolved Hide resolved
src/script/src/manager.rs Outdated Show resolved Hide resolved
src/script/src/manager.rs Show resolved Hide resolved
src/table/src/metadata.rs Outdated Show resolved Hide resolved
@killme2008
Copy link
Contributor Author

@MichaelScofield PTAL

Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

@fengjiachun fengjiachun added this pull request to the merge queue Sep 18, 2023
Merged via the queue into GreptimeTeam:develop with commit 5566f34 Sep 18, 2023
11 checks passed
@killme2008 killme2008 deleted the feature/distributed-scripts-table branch September 18, 2023 11:53
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: make scripts table work again

* chore: typo

* fix: license header

* Update src/table/src/metadata.rs

Co-authored-by: Ruihang Xia <[email protected]>

* chore: cr comments

---------

Co-authored-by: Ruihang Xia <[email protected]>
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.

5 participants