Leave sequence number alone when merely migrating records.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 12 Feb 2010 06:32:56 +0000 (17:02 +1030)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 16 Feb 2010 00:02:25 +0000 (11:02 +1100)
commit9ed2f8b2fcb7e3f0d795eef22cfa317066490709
treeab0cf496a5c685f6e08073db5439e8d3f48562ec
parentf8994790e65baebb81bbfad646cdda6234b6d29a
Leave sequence number alone when merely migrating records.

(Based on earlier version from Ronnie which modified tdb; this one
is standalone).

When storing records in a tdb that has "automatic seqnum updates"
also check if the actual data for the record has changed or not.

If it has not changed at all, except for possibly the header,
this is likely just a dmaster migration operation in which case
we want to write the record to the tdb but we do not want the tdb
sequence number to be increased.

This resolves the problem of notify.tdb being thrashed under load:
the heuristic in smbd to only reread this when the sequence number
increases (rarely) breaks down.

Before, running nbench --num-progs=512 across 4 nodes, we saw numbers like:
 512      1496  118.33 MB/sec  execute 60 sec  latency 0.00 msec
And turning on latency tracking, this was typical in the logs:
 ctdbd: High latency 9380914.000000s for operation lockwait on database notify.tdb

After this commit:
  512      2451  143.85 MB/sec  execute 60 sec  latency 0.00 msec
And no more latency messages...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
common/ctdb_ltdb.c