junneyang / zumastor

Automatically exported from code.google.com/p/zumastor
0 stars 1 forks source link

The current flush criteria is not enoug to prevent overwriting old journal blocks #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was testing ddsnap journal replay with different chunk sizes and found
the current journal flush criteria does not leave enough space to prevent
ddsnap from overwriting old un-flushed journal blocks. I decreased the
flush criteria from half of journal size to one third of journal size.
After that, my test passed. Here is my current fix. 

@@ -601,7 +620,7 @@ static void commit_transaction(struct su
        if (list_empty(&dirty_buffers) && !sb->defer.count)
                return;

-       if (sb->deferred_allocs >= sb->image.journal_size / 2 ||
journaled_count >= sb->image.journal_size / 2) {
+       if (sb->deferred_allocs >= sb->image.journal_size / 3 ||
journaled_count >= sb->image.journal_size / 2) {
                flush_journaled_buffers();
                flush_deferred_allocs(sb);
                barrier = 1;

I think a better approach is to keep track of last written commit barrier
to make sure we never overwrite any un-flushed journal blocks. 

Original issue reported on code.google.com by jiahotc...@gmail.com on 11 Jul 2008 at 12:46

GoogleCodeExporter commented 9 years ago
Good work.  (Again, can you create a short cbtb test that exposes this?)

Original comment by daniel.r...@gmail.com on 11 Jul 2008 at 1:00