-
Notifications
You must be signed in to change notification settings - Fork 338
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
reduce_runs
may execute too long time
#5030
Comments
Where is |
Right now I do a quick and dirty walkaround by taking the first 1024 of combinations, like this: ...
runs.into_iter()
.combinations(k)
.take(1024) // here
.map(|runs_to_merge| merge_all_runs(runs_to_merge))
... It may produce not minimal |
Normally the combination number won't be that large, |
@v0y4g3r The ssts were ingested directly, from early days before this |
Looks like ingesting large number of files with overlapping time ranges is not the original use case of any existing compaction strategies that expect overlappping files gradually get merged into one or serveral files as they age. We should come up with a simpler strategy that always merge them into one if theire size does not exceed some threshold. |
Only early greptimedb that don't do compaction after ingesting ssts are affected, not a big issue. |
What type of bug is this?
Performance issue
What subsystems are affected?
Datanode
Minimal reproduce step
The method
reduce_runs
(ingreptimedb/src/mito2/src/compaction/run.rs
Line 250 in 027284e
runs: Vec<SortedRun<T>>
onlet k = runs.len() + 1 - target;
. The time complexity of calculating combinations isC(n, k)
, which could be very time consuming to run. For example,C(10, 4) = 330791175
. Upon iterating this large combinations, the codes may execute too long time.I've observed this situation in one of our customers. He has too many sst files that are time ranges overlapped. The
runs
passed toreduce_runs
are large. See this log (not in our codes but I temporarily added for debugging) right before executingreduce_runs
:So the combinations in his
sorted_runs
areC(2883, 5) = 1653997252262256
, which is too big to iterate. The code's execution acts like hanging forever.What did you expect to see?
code execution proceeded
What did you see instead?
code execution hang
What operating system did you use?
ubuntu
What version of GreptimeDB did you use?
main
Relevant log output and stack trace
No response
The text was updated successfully, but these errors were encountered: