Re: iprop: Problem forcing complete database sync
Harald Barth <[email protected]> Fri, 06 Oct 2017 11:56:22 +0200 (CEST)
| Newsgroups | gmane.comp.encryption.kerberos.heimdal.general |
|---|---|
| Message-ID | <[email protected]> |
> From what I can tell iprop has no way to differentiate between "I have no
> database, therefore I consider myself at version 0" and "I have a database, in
> sync with version 0".
I think (and hope) that a database is never at version 0 as it should
be created at version 1. So after the send_complete() which was
triggered by (current_version == 0 || s->version == 0) the
current_version will be 1 or greater and I don't think looping will
happen.
> There used to be code early in send_diffs() which called send_complete()
> if the slave was at version 0, but it was removed in commit
> 539ba5fb8751d7c8741c89e99645775f131ba4fe. Checking out heimdal-1-5-branch will
> show the following snippet:
> ===
> 475 /* if slave is a fresh client, starting over */
> 476 if (s->version == 0) {
> 477 krb5_warnx(context, "sending complete log to fresh slave %s",
> 478 s->name);
> 479 return send_complete (context, s, database, current_version);
> 480 }
> ===
Removing that without putting something else in place (and I would say
not only s->version == 0 but even current_version == 0 should trigger
a send_complete) was probably a bad idea.
I would try to add something like this at ipropd_master.c:685:
if (s->version == 0 && current_version > 0) {
krb5_warnx(context, "sending coplete database to fresh slave %s", s->name);
write_dump(context, s, database, current_version);
return send_complete (context, s, database, current_version, 0);
}
if (current_version == 0) {
/* What to do here ? */
}
problem with this snipplet is that it only works if current_version
has not been reset to 0. So how can we recover the real current version
of the database so that we can do something like:
if (current_version == 0) {
current_version = recover_current_version(database);
write_dump(context, s, database, current_version);
return send_complete (context, s, database, current_version, 0);
}
> From what I can tell iprop has no way to differentiate between "I have no
> database, therefore I consider myself at version 0" and "I have a database, in
> sync with version 0".
I think the log can be at version 0 (which means "invalid, please
recover") but the database should not be able to be at version 0.
> Unless I am missing something this would mean that if something like the code
> above was added back, truncating the log to version 0 would make all slaves
> fetch the complete database over and over again until a modification bumps the
> version at the master.
That would be unfortunate ;-)
Harald.