-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Rollback must invalidate mmap'd pages #2186
Comments
I forgot to mention i am on a Amazon linux instance (Centos 6.x)
|
Try this after the rollback: |
@alexfouche This is a cache coherence issue. Basically, mmap() currently goes through the page cache and rollback does not invalidate it. The double caching between ARC and the page cache is a hack that we inherited from Solaris. The plan is to kill it in a future release, but the future release that sees this happen could be several months away. In the mean time, @maxximino's suggestion might help, although you probably want to run that both before and after rollback to be safe. Also, echoing 3 into drop_caches is unnecessary. Echoing 1 into drop_caches is sufficient to flush the second page. A second possibility is to try to configure mongodb to avoid That being said, let me make a note to other contributors. We should be able to modify ZFS rollback to attempt to invalidate the page cache on any unmapped open files until mmap() has been reworked to use ARC directly. That should tackle the coherence issue. Also, it would be interesting to know if this affects other ZFS platforms. This bug might not be exclusive to us. |
I retested and indeed doing a |
@ryao |
Closing. The solution mentioned above is recommended and things have been further improved by commit 8614ddf. |
Hi there, I have encountered a problem with a similar situation with a memory-mapped file, where the app could still find non-rolled back data in memory, and this solution worked out. I am using the ubuntu 20 version:
Is there a way to create zfs pools/vols that mandatory invalidate caches specifically for the volumes/pools in question for this reason? if this could be a property that will bring peace of mind for most problems like this. Or, is there any version on the v2 stream that has this sorted =) and I can give it a try. Cheers |
@alexfouche This is a super late reply, but all of the dirty data is safely in ARC, so there is no safety issue from invalidating the page cache. @4Ykw Please file a new issue for the regression. It will not get much attention in an old closed issue. |
It already invalidates as needed. In the new issue, please include information on how to reproduce this. |
This may be related to #13608 |
Rollback does not always rollback
Using MongoDB (i believe it is mmaped), i update some records, then fsync+lock, then issue a
zfs snapshot
, then unlock DB. I also tried with process stop and restart instead of fsync+lock. Repeat multiple timesWhen i issue a
zfs rollback
with or without-r
depending of the rollback i try to restore, i can still see the newer DB records. DB file mdate also shows files are not restored. When i look into.zfs/snapshot/...
DB files, i can see that they are correct for the point in time the snapshot was made.If instead i was not using MongoDB, but simply touching or overwriting some files from shell commands, rollback works fine. But if at some point i start MongoDB, stop it, and try to rollback, then rollback does not rollback. Filesystem is not busy (tested with lsof), and
zfs rollback -r
shows no errorI tried with explicitely unmounting the zfs filesystem, then rollback, then mounting, and this works. I believe then the issue is about auto-remount when restoring a snapshot. In my case, there was never anything keeping the filesystem busy (tested with
lsof
), yet restored snapshot would not showMaybe this is related to #1214.
Here are steps to reproduce:
The text was updated successfully, but these errors were encountered: