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

[Enhancement] Dump a new snapshot if persistent index keep too many WAL #22140

Merged
merged 2 commits into from
May 10, 2023

Conversation

sevev
Copy link
Contributor

@sevev sevev commented Apr 21, 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes :

Fixes #

Problem Summary(Required) :

Persistent Index for the primary key table will append wal log into L0 index file if the following conditions are met:

  1. The memory usage of L0 is less than 10% of L1 usage
  2. The memory usage of L0 is greater than max snapshot size(default is 16MB)

So the L0 index file may keep growing, and keep appending WAL. And this PR(#12862) triggers flush or merge compaction if the L0 file size is greater than 200MB to avoid the growth of L0 index file.

However, if the file size of L1 is very large(e.g. 4GB) and the L0 memory usage is less than L1 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the L0 index file keep too many wal logs.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto backported to target branch
    • 3.0
    • 2.5
    • 2.4
    • 2.3

Signed-off-by: zhangqiang <[email protected]>
@sevev sevev changed the title [BugFix] Dump a new snapshot if persistent index keep too many WAL [Enhancement] Dump a new snapshot if persistent index keep too many WAL Apr 21, 2023
@mergify mergify bot assigned sevev Apr 21, 2023
be/src/common/config.h Outdated Show resolved Hide resolved
Signed-off-by: zhangqiang <[email protected]>
be/src/common/config.h Outdated Show resolved Hide resolved
be/src/storage/persistent_index.cpp Outdated Show resolved Hide resolved
@chaoyli chaoyli merged commit 817aa23 into StarRocks:main May 10, 2023
abc982627271 pushed a commit to abc982627271/starrocks that referenced this pull request May 11, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.
@sevev
Copy link
Contributor Author

sevev commented May 22, 2023

@mergify backport branch-3.0

@mergify
Copy link
Contributor

mergify bot commented May 22, 2023

backport branch-3.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 22, 2023
…AL (#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

(cherry picked from commit 817aa23)
@sevev
Copy link
Contributor Author

sevev commented May 22, 2023

@mergify backport branch-2.5

@mergify
Copy link
Contributor

mergify bot commented May 22, 2023

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 22, 2023
…AL (#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

(cherry picked from commit 817aa23)
sevev added a commit to sevev/starrocks that referenced this pull request May 23, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
sevev added a commit to sevev/starrocks that referenced this pull request May 23, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
sevev added a commit to sevev/starrocks that referenced this pull request May 23, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
sevev added a commit to sevev/starrocks that referenced this pull request May 23, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
Moonm3n pushed a commit to Moonm3n/starrocks that referenced this pull request May 23, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

Signed-off-by: Moonm3n <[email protected]>
decster pushed a commit that referenced this pull request May 25, 2023
…nt index keep too many WAL (#22140) (#23922)

Persistent Index for the primary key table will append wal log into `L0`
index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is
16MB)

So the `L0` index file may keep growing, and keep appending WAL. And
this PR(#12862) triggers
flush or merge compaction if the `L0` file size is greater than 200MB to
avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0`
memory usage is less than `L1` 10% usage but greater than 200MB(e.g.
256MB), we will always flush a new snapshot(about 256MB) even if we only
update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index
file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
decster pushed a commit that referenced this pull request May 25, 2023
…nt index keep too many WAL (#22140) (#23920)

Persistent Index for the primary key table will append wal log into `L0`
index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is
16MB)

So the `L0` index file may keep growing, and keep appending WAL. And
this PR(#12862) triggers
flush or merge compaction if the `L0` file size is greater than 200MB to
avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0`
memory usage is less than `L1` 10% usage but greater than 200MB(e.g.
256MB), we will always flush a new snapshot(about 256MB) even if we only
update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index
file keep too many wal logs.

Signed-off-by: zhangqiang <[email protected]>
numbernumberone pushed a commit to numbernumberone/starrocks that referenced this pull request May 31, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.
abc982627271 pushed a commit to abc982627271/starrocks that referenced this pull request Jun 5, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.
@sevev sevev deleted the dum_snapshot_if_too_many_wal branch August 7, 2023 01:52
southernriver pushed a commit to southernriver/starrocks that referenced this pull request Nov 28, 2023
…AL (StarRocks#22140)

Persistent Index for the primary key table will append wal log into `L0` index file if the following conditions are met:
1. The memory usage of `L0` is less than 10%  of `L1` usage
3. The memory usage of `L0` is greater than max snapshot size(default is 16MB)

So the `L0` index file may keep growing, and keep appending WAL. And this PR(StarRocks#12862) triggers flush or merge compaction if the `L0` file size is greater than 200MB to avoid the growth of `L0` index file.

However, if the file size of `L1` is very large(e.g. 4GB) and the `L0` memory usage is less than  `L1` 10% usage but greater than 200MB(e.g. 256MB), we will always flush a new snapshot(about 256MB) even if we only update one record which causes a lot of disk IO.

So this pr change the check and dump a new snapshot if the `L0` index file keep too many wal logs.

(cherry picked from commit 817aa23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants