-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Track the total number of compaction sorted runs inside BackgroundCallCompaction #13320
Draft
archang19
wants to merge
14
commits into
facebook:main
Choose a base branch
from
archang19:internal-stats-total-compaction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
87399e4
Add num-running-compaction-iterators stat
archang19 2c2ba95
Constructor inside dbimpl
archang19 1e15c3d
input iterators
archang19 e14d51a
Fix naming
archang19 010fdd4
Comment
archang19 6a71c06
Plenty of asserts
archang19 00f5c9a
Update one compaction stats unit test
archang19 9fec093
Assert mutex is held
archang19 f73c9eb
Add comment on precondition and another assertion
archang19 68ea158
Access stats directly in handler functions. Move output param to end
archang19 03dd23a
Handle trivial moves and deletion compactions
archang19 21fa2c2
Rename to number of compaction sorted runs
archang19 b8230f3
Update unreleased_history
archang19 cae1281
Fix one compaction test case
archang19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -950,13 +950,6 @@ class DBImpl : public DB { | |
return num_running_flushes_; | ||
} | ||
|
||
// Returns the number of currently running compactions. | ||
// REQUIREMENT: mutex_ must be held when calling this function. | ||
int num_running_compactions() { | ||
mutex_.AssertHeld(); | ||
return num_running_compactions_; | ||
} | ||
|
||
const WriteController& write_controller() { return write_controller_; } | ||
|
||
// hollow transactions shell used for recovery. | ||
|
@@ -2420,7 +2413,8 @@ class DBImpl : public DB { | |
Status BackgroundCompaction(bool* madeProgress, JobContext* job_context, | ||
LogBuffer* log_buffer, | ||
PrepickedCompaction* prepicked_compaction, | ||
Env::Priority thread_pri); | ||
Env::Priority thread_pri, | ||
int& num_compaction_sorted_runs_added); | ||
Status BackgroundFlush(bool* madeProgress, JobContext* job_context, | ||
LogBuffer* log_buffer, FlushReason* reason, | ||
bool* flush_rescheduled_to_retain_udt, | ||
|
@@ -2430,6 +2424,8 @@ class DBImpl : public DB { | |
const std::vector<CompactionInputFiles>& inputs, | ||
bool* sfm_bookkeeping, LogBuffer* log_buffer); | ||
|
||
size_t GetNumberCompactionSortedRuns(Compaction* c); | ||
|
||
// Request compaction tasks token from compaction thread limiter. | ||
// It always succeeds if force = true or limiter is disable. | ||
bool RequestCompactionToken(ColumnFamilyData* cfd, bool force, | ||
|
@@ -2963,6 +2959,10 @@ class DBImpl : public DB { | |
// stores the number of compactions are currently running | ||
int num_running_compactions_; | ||
|
||
// stores the number of sorted runs being processed by currently running | ||
// compactions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
int num_running_compaction_sorted_runs_; | ||
|
||
// number of background memtable flush jobs, submitted to the HIGH pool | ||
int bg_flush_scheduled_; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
unreleased_history/new_features/num_running_compaction_sorted_runs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add new statistic `num_running_compaction_sorted_runs` that tracks the number of sorted runs being processed by currently running compactions |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbi42 the check for
IsTrivialMove
inside myGetNumberCompactionSortedRuns
method messes up the count forInputCompressionMatchesOutput
. I did not dig into why the original test values were the way they are, but I do not think my PR would break this functionality. For those who do understand, I updated the expected value to be the original expected value plus what I determined was added byGetNumberCompactionSortedRuns
.Not sure if you had to work with this test case before. Let me know if this is problematic or the comments can be reworded