[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recovering from corrupted database



joda@pdc.kth.se (Johan Danielsson) writes:

> [...] but you'd still have to hack replay_log to ignore versions
> older than that (we should fix this).

Something like this.

/Johan

--- replay_log.c	1999/12/04 19:51:11	1.7
+++ replay_log.c	2001/02/19 18:10:43	1.8
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997, 1998, 1999, 2001 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden). 
  * All rights reserved. 
  *
@@ -33,8 +33,11 @@
 
 #include "iprop.h"
 
-RCSID("$Id: replay_log.c,v 1.7 1999/12/04 19:51:11 assar Exp $");
+RCSID("$Id: replay_log.c,v 1.8 2001/02/19 18:10:43 joda Exp $");
 
+int start_version = -1;
+int end_version = -1;
+
 static void
 apply_entry(kadm5_server_context *server_context,
 	    u_int32_t ver,
@@ -45,6 +48,12 @@
 {
     krb5_error_code ret;
 
+    if((start_version != -1 && ver < start_version) ||
+       (end_version != -1 && ver > end_version)) {
+	/* XXX skip this entry */
+	(*sp->seek)(sp, len, SEEK_CUR);
+	return;
+    }
     printf ("ver %u... ", ver);
     fflush (stdout);
 
@@ -60,6 +69,8 @@
 int version_flag;
 int help_flag;
 struct getargs args[] = {
+    { "start-version", 0, arg_integer, &start_version, "start replay with this version" },
+    { "end-version", 0, arg_integer, &end_version, "end replay with this version" },
     { "version", 0, arg_flag, &version_flag },
     { "help", 0, arg_flag, &help_flag }
 };