Add mapsize to the header just before sending the packet.

Before it could change later and we were sending invalid mapsize.
Some time ago I added optimization where when nodes are connected for the
first time and there were no writes to them yet, there is no initial full
synchronization. This bug prevented it from working.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2011-03-25 20:19:15 +00:00
parent 7d4df5cd0b
commit 54987cacfd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220007

View File

@ -201,7 +201,6 @@ init_remote(struct hast_resource *res, struct nv *nvin)
"Unable to allocate memory (%zu bytes) for activemap.",
mapsize);
}
nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize");
/*
* When we work as primary and secondary is missing we will increase
* localcnt in our metadata. When secondary is connected and synced
@ -339,6 +338,7 @@ init_remote(struct hast_resource *res, struct nv *nvin)
(uintmax_t)res->hr_secondary_localcnt,
(uintmax_t)res->hr_secondary_remotecnt);
}
nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize");
if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) {
pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s",
res->hr_remoteaddr);