From: Paul Clements <hidden> Date: 2006-07-25 06:30:07
This patch (tested against 2.6.18-rc1-mm1) adds a new sysfs interface that allows the bitmap of an array to be dirtied. The interface is write-only, and is used as follows:
echo "1000" > /sys/block/md2/md/bitmap
(dirty the bit for chunk 1000 [offset 0] in the in-memory and on-disk bitmaps of array md2)
echo "1000-2000" > /sys/block/md1/md/bitmap
(dirty the bits for chunks 1000-2000 in md1's bitmap)
This is useful, for example, in cluster environments where you may need to combine two disjoint bitmaps into one (following a server failure, after a secondary server has taken over the array). By combining the bitmaps on the two servers, a full resync can be avoided (This was discussed on the list back on March 18, 2005, "[PATCH 1/2] md bitmap bug fixes" thread).
Thanks,
Paul
From: Mike Snitzer <hidden> Date: 2006-07-26 21:30:26
On 7/25/06, Paul Clements [off-list ref] wrote:
This patch (tested against 2.6.18-rc1-mm1) adds a new sysfs interface
that allows the bitmap of an array to be dirtied. The interface is
write-only, and is used as follows:
echo "1000" > /sys/block/md2/md/bitmap
(dirty the bit for chunk 1000 [offset 0] in the in-memory and on-disk
bitmaps of array md2)
echo "1000-2000" > /sys/block/md1/md/bitmap
(dirty the bits for chunks 1000-2000 in md1's bitmap)
This is useful, for example, in cluster environments where you may need
to combine two disjoint bitmaps into one (following a server failure,
after a secondary server has taken over the array). By combining the
bitmaps on the two servers, a full resync can be avoided (This was
discussed on the list back on March 18, 2005, "[PATCH 1/2] md bitmap bug
fixes" thread).
Hi Paul,
I tracked down the thread you referenced and these posts (by you)
seems to summarize things well:
http://marc.theaimsgroup.com/?l=linux-raid&m=111116563016418&w=2http://marc.theaimsgroup.com/?l=linux-raid&m=111117515400864&w=2
But for clarity's sake, could you elaborate on the negative
implications of not merging the bitmaps on the secondary server? Will
the previous primary's dirty blocks get dropped on the floor because
the secondary (now the primary) doesn't have awareness of the previous
primary's dirty blocks once it activates the raid1?
Also, what is the interface one should use to collect dirty bits from
the primary's bitmap?
This bitmap merge can't happen until the primary's dirty bits can be
collected right? Waiting for the failed server to come back to
harvest the dirty bits it has seems wrong (why failover at all?); so I
must be missing something.
please advise, thanks.
Mike
From: Paul Clements <hidden> Date: 2006-07-27 02:27:23
Mike Snitzer wrote:
I tracked down the thread you referenced and these posts (by you)
seems to summarize things well:
http://marc.theaimsgroup.com/?l=linux-raid&m=111116563016418&w=2http://marc.theaimsgroup.com/?l=linux-raid&m=111117515400864&w=2
But for clarity's sake, could you elaborate on the negative
implications of not merging the bitmaps on the secondary server? Will
the previous primary's dirty blocks get dropped on the floor because
the secondary (now the primary) doesn't have awareness of the previous
primary's dirty blocks once it activates the raid1?
Right. At the time of the failover, there were (probably) blocks that were out of sync between the primary and secondary. Now, after you've failed over to the secondary, you've got to overwrite those blocks with data from the secondary in order to make the primary disk consistent again. This requires that either you do a full resync from secondary to primary (if you don't know what differs), or you merge the two bitmaps and resync just that data.
Also, what is the interface one should use to collect dirty bits from
the primary's bitmap?
Whatever you'd like. scp the bitmap file over or collect the ranges into a file and scp that over, or something similar.
This bitmap merge can't happen until the primary's dirty bits can be
collected right? Waiting for the failed server to come back to
Right. So, when the primary fails, you start the array on the secondary with a _clean_ bitmap, and just its local disk component. Now, whatever gets written while the primary is down gets put into the bitmap on the secondary. When the primary comes back up, you take the dirty bits from it and add them into the secondary's bitmap. Then, you insert the primary's disk (via nbd or similar) back into the array, and begin a resync.
That's the whole reason for this interface. We have to modify the bitmap while the array is active (modifying the bitmap while the array is down is trivial, and certainly doesn't require sysfs :).
harvest the dirty bits it has seems wrong (why failover at all?); so I
must be missing something.
We fail over immediately. We wait until later to combine the bitmaps and resync the data.
Hope that helps.
--
Paul
From: Mike Snitzer <hidden> Date: 2006-07-27 03:36:28
On 7/26/06, Paul Clements [off-list ref] wrote:
Mike Snitzer wrote:
quoted
I tracked down the thread you referenced and these posts (by you)
seems to summarize things well:
http://marc.theaimsgroup.com/?l=linux-raid&m=111116563016418&w=2http://marc.theaimsgroup.com/?l=linux-raid&m=111117515400864&w=2
But for clarity's sake, could you elaborate on the negative
implications of not merging the bitmaps on the secondary server? Will
the previous primary's dirty blocks get dropped on the floor because
the secondary (now the primary) doesn't have awareness of the previous
primary's dirty blocks once it activates the raid1?
Right. At the time of the failover, there were (probably) blocks that
were out of sync between the primary and secondary. Now, after you've
failed over to the secondary, you've got to overwrite those blocks with
data from the secondary in order to make the primary disk consistent
again. This requires that either you do a full resync from secondary to
primary (if you don't know what differs), or you merge the two bitmaps
and resync just that data.
I took more time to read the later posts in the original thread; that
coupled with your detailed response has helped a lot. thanks.
quoted
Also, what is the interface one should use to collect dirty bits from
the primary's bitmap?
Whatever you'd like. scp the bitmap file over or collect the ranges into
a file and scp that over, or something similar.
OK, so regardless of whether you are using an external or internal
bitmap; how does one collect the ranges from an array's bitmap?
Generally speaking I think others would have the same (naive) question
given that we need to know what to use as input for the sysfs
interface you've kindly provided. If it is left as an exercise to
the user that is fine; I'd imagine neilb will get our backs with a
nifty new mdadm flag if need be.
thanks again,
Mike
From: Paul Clements <hidden> Date: 2006-07-27 14:07:06
Mike Snitzer wrote:
On 7/26/06, Paul Clements [off-list ref] wrote:
quoted
Mike Snitzer wrote:
quoted
quoted
Also, what is the interface one should use to collect dirty bits from
the primary's bitmap?
Whatever you'd like. scp the bitmap file over or collect the ranges into
a file and scp that over, or something similar.
OK, so regardless of whether you are using an external or internal
bitmap; how does one collect the ranges from an array's bitmap?
Well, with an internal bitmap you don't need this interface. The bitmap is located on all the component disks. The reason we don't use internal bitmaps in a configuration where one of the disks is located remotely (over a LAN or SAN, or possibly a WAN) is that the bitmap updates (which are synchronous and occur fairly often) would be too costly.
So reading the bits out of a file is fairly simple. The bitmap file is laid out one bit per chunk, with a 256 byte superblock at the front. You just need a perl script (for example) that reads the file and keeps track of which bits are dirty, and then prints those numbers out.
--
Paul
From: Mike Snitzer <hidden> Date: 2006-07-27 14:28:54
On 7/26/06, Paul Clements [off-list ref] wrote:
Mike Snitzer wrote:
quoted
I tracked down the thread you referenced and these posts (by you)
seems to summarize things well:
http://marc.theaimsgroup.com/?l=linux-raid&m=111116563016418&w=2http://marc.theaimsgroup.com/?l=linux-raid&m=111117515400864&w=2
But for clarity's sake, could you elaborate on the negative
implications of not merging the bitmaps on the secondary server? Will
the previous primary's dirty blocks get dropped on the floor because
the secondary (now the primary) doesn't have awareness of the previous
primary's dirty blocks once it activates the raid1?
Right. At the time of the failover, there were (probably) blocks that
were out of sync between the primary and secondary.
OK, so now that I understand the need to merge the bitmaps... the
various scenarios that create this (potential) inconsistency are still
unclear to me when you consider the different flavors of raid1. Is
this inconsistency only possible if using async (aka write-behind)
raid1?
If not, how would this difference in committed blocks occur with
normal (sync) raid1 given MD's endio acknowledges writes after they
are submitted to all raid members? Is it merely that the bitmap is
left with dangling bits set that don't reflect reality (blocks weren't
actually changed anywhere) when a crash occurs? Is there real
potential for inconsistent data on disk(s) when using sync raid1 (does
having an nbd member increase the likelihood)?
regards,
Mike
From: Paul Clements <hidden> Date: 2006-07-27 14:55:32
Mike Snitzer wrote:
On 7/26/06, Paul Clements [off-list ref] wrote:
quoted
Right. At the time of the failover, there were (probably) blocks that
were out of sync between the primary and secondary.
OK, so now that I understand the need to merge the bitmaps... the
various scenarios that create this (potential) inconsistency are still
unclear to me when you consider the different flavors of raid1. Is
this inconsistency only possible if using async (aka write-behind)
raid1?
No. Even with a synchronous (normal) raid1, you will probably have blocks that are out of sync when one disk (or server) fails. This is true even of raid1's using internal disks. That's why you resync the array after a failure (of the system or of one of the disks). That's exactly what the bitmap is for -- to optimize that resync.
--
Paul