Fix iprop against legacy master with full log

When the master's log has all entries from version 1 to now, and no
uber entry (legacy master), then new slaves will not pull version 1,
because their uber record has version 1.

The fix is to force the uber version to 0 always, and avoid adding a
truncate nop when doing a full prop.  The uber record now records the
database version even in the absence of any other log entries so that
we know what to pull going forward.
This commit is contained in:
Viktor Dukhovni
2016-06-08 21:26:43 +00:00
parent 7d9fcb46b9
commit ffd0dda237
5 changed files with 110 additions and 55 deletions

View File

@@ -157,7 +157,7 @@ init(struct init_options *opt, int argc, char **argv)
krb5_warn(context, ret, "hdb_open");
return 0;
}
ret = kadm5_log_reinit(kadm_handle);
ret = kadm5_log_reinit(kadm_handle, 0);
if (ret)
krb5_err(context, 1, ret, "Failed iprop log initialization");
kadm5_log_end(kadm_handle);

View File

@@ -362,7 +362,7 @@ parse_extensions(char *str, HDB_extensions **e)
static int
doit(const char *filename, int mergep)
{
krb5_error_code ret;
krb5_error_code ret = 0;
FILE *f;
char s[8192]; /* XXX should fix this properly */
char *p;
@@ -378,13 +378,18 @@ doit(const char *filename, int mergep)
return 1;
}
/*
* We don't have a version number in the dump, so we don't know
* which iprop log entries to keep, if any. We throw the log away.
* We don't have a version number in the dump, so we don't know which iprop
* log entries to keep, if any. We throw the log away.
*
* We could merge the ipropd-master/slave dump/load here as an
* option, in which case we would first load the dump.
* We could merge the ipropd-master/slave dump/load here as an option, in
* which case we would first load the dump.
*
* If we're merging, first recover unconfirmed records in the existing log.
*/
ret = kadm5_log_reinit(kadm_handle);
if (mergep)
ret = kadm5_log_init(kadm_handle);
if (ret == 0)
ret = kadm5_log_reinit(kadm_handle, 0);
if (ret) {
fclose (f);
krb5_warn(context, ret, "kadm5_log_reinit");