From 3d9f731d98f5ea1f884ab7016bb602caccde9b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 6 Aug 2007 02:18:13 +0000 Subject: [PATCH] - don't push whole database to the new client every time. - make slaves get the whole new database if they have a newer log the the master (and thus have them go back in time). git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21824 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/kadm5/ipropd_master.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/kadm5/ipropd_master.c b/lib/kadm5/ipropd_master.c index f704f9811..ae9c78def 100644 --- a/lib/kadm5/ipropd_master.c +++ b/lib/kadm5/ipropd_master.c @@ -444,7 +444,8 @@ send_diffs (krb5_context context, slave *s, int log_fd, int ret = 0; if (s->version == current_version) { - krb5_warnx(context, "slave %s in sync already", s->name); + krb5_warnx(context, "slave %s in sync already at version %ld", + s->name, (long)s->version); return 0; } @@ -550,12 +551,18 @@ process_msg (krb5_context context, slave *s, int log_fd, krb5_warnx (context, "process_msg: client send too I_HAVE data"); break; } - if (s->version > tmp) { - krb5_warnx (context, - "Slave claims to not have version we already sent to it"); - } else if (current_version == tmp) { - krb5_warnx (context, "Slave in sync with master at version %lu", - (unsigned long)tmp); + /* new started slave that have old log */ + if (s->version == 0 && tmp != 0) { + if (s->version < tmp) { + krb5_warnx (context, "Slave %s have later version the master " + "OUT OF SYNC", s->name); + } else { + s->version = tmp; + } + } + if (tmp < s->version) { + krb5_warnx (context, "Slave claims to not have " + "version we already sent to it"); } else { ret = send_diffs (context, s, log_fd, database, current_version); }