-
Notifications
You must be signed in to change notification settings - Fork 37
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
use a waitgroup to wait for reserve holders of MFiles before unmapping #876
Conversation
17e4d7a
to
c4df472
Compare
Two things that we probably must remove
|
I don't know, both call lavinmq/src/lavinmq/amqp/queue/message_store.cr Lines 231 to 237 in c8ca36a
|
Isn't it possible that a segment that isn't yet fully replicated is unmapped? If it's a large message I think the unmap may occur in the middle of the lz4 compression. Will these unmaps be necessary if we handle unmapping properly, which this PR hopefully solves? |
True, there's a chance for that, if the unmap is triggered just when we're rolling over to a new segment. And yes, shouldn't be needed anymore. |
also started to tinker with a ref counter as you did, but yes, it fast gets messy, as we return a class MFile
@counter = 0
@counter_lock = Mutex.new(:unchecked)
def borrow : self
@counter_lock.synchronize do
counter = @counter
if counter.zero?
mmap
end
@counter = counter + 1
end
self
end
def unborrow : Nil
@counter_lock.synchronize do
counter = @counter -= 1
if counter.zero?
unmap
end
end
end
end |
I'm starting to long for the io_uring implementation, then we could skip mmap:ings all together.. |
Yes! But I think this PR is working pretty well? I've done some runs without crashes. |
4be79af
to
97a0493
Compare
Can cause seg faults if a follower is still trying to replicate it.
Add a random delay to the stream queue GC loops, so that not all loops are executing at the same time.
97a0493
to
e13e7af
Compare
To mmap a file and then calcululating the hash of it has a negligible performance benefit.
Do we need this unmap? Why not let a file be mapped as long as it's opened? I.e. only unmap in |
You can't mmap unlimited number of files, eg. in linux you're limited by |
This is not a problem anymore, now that |
WHAT is this pull request doing?
Please fill me in.
HOW can this pull request be tested?
Specs? Manual steps? Please fill me in.