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

fix: stream inserts when copying from external file #1338

Merged
merged 3 commits into from
Apr 10, 2023

Conversation

v0y4g3r
Copy link
Contributor

@v0y4g3r v0y4g3r commented Apr 6, 2023

I hereby agree to the terms of the GreptimeDB CLA

This PR changes the behavior when copying data from external file into tables.

Instead of reading all rows from all files into memory and writing them into tables at a time, now rows are written into tables as soon as memory consumption reaches a predefined threshold.

This may helps to reduce memory consumption when importing a large file like in this thread.

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)

@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Merging #1338 (f3a8684) into develop (2458b4e) will decrease coverage by 0.40%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #1338      +/-   ##
===========================================
- Coverage    85.82%   85.42%   -0.40%     
===========================================
  Files          504      506       +2     
  Lines        76288    76904     +616     
===========================================
+ Hits         65473    65697     +224     
- Misses       10815    11207     +392     

@v0y4g3r v0y4g3r requested a review from MichaelScofield April 6, 2023 13:49
src/datanode/src/sql/copy_table_from.rs Outdated Show resolved Hide resolved
Co-authored-by: LFC <bayinamine@gmail.com>
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@killme2008 killme2008 merged commit c850e96 into GreptimeTeam:develop Apr 10, 2023
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* fix: stream inserts when copying from external file

* fix: reset pending bytes once insertion succeeds

* Update src/datanode/src/sql/copy_table_from.rs

Co-authored-by: LFC <bayinamine@gmail.com>

---------

Co-authored-by: LFC <bayinamine@gmail.com>
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