-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GC discardStat fallback mechanism #1784
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
Conversation
|
It's an expensive operation to calculate the GC for the value log in this manner. We used to do this before, but it burnt a lot of CPU cycles. And given the scenario the OP has (small number of keys), they'd be better off just increasing the value threshold, to avoid value log usage as much as possible. This shouldn't have been merged. |
|
@manishrjain Yes, I understand this is not a cheap operation. But what is the reason to
|
|
Also, this fallback mechanism takes place only in case it was no calculated discardState available. This means no compactions have been done, which means not a lot of keys have been written |
|
I'm experiencing deadlocks which I believe this commit introduced. I've cherry-picked this commit onto
I don't know enough about badger to know how to fix this. I believe the call to |
|
@lithp Thankyou for bringing this up. We are taking a look into this. Meanwhile, we wanted to understand a few things from you -
|
|
@lithp Thank you for the detailed analysis. Do you have a stack trace available to share, when the deadlock occurs? |
|
@lithp , Thanks again for sharing your observations that helped us do the preliminary analysis. After further verifying the change you recommended, we plan on remediating this issue as soon as we can. |
|
Thank you for looking at this! I just checked my notes and unfortunately I did not save the original stacktraces. I can't tell from your last comment, @joshua-goldstein, would you still like a stack trace? I can try to reproduce the deadlock. |
|
I reproduced the deadlock and have some stack traces for you. This is the goroutine which runs in the background and takes out a lock on This is the goroutine which attempts to perform a transaction and waits for the background thread to perform the writes: This is the |
This PR aims to fix the GC issue described here
https://discuss.dgraph.io/t/gc-may-not-work-in-some-cases/17197
The idea is to calculate discardStat directly on vlog in case discard data is not available. Because current discardStat calculation only done on compaction it may be not available until memtables got full. Check the issue on forum for the reproduction steps.
Also during the tests I've found out that value log rewrite doesn't work well when the key was removed so I've tried to fix this at the line 238-240