Rev 343: paraoid check for empty db on attach in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Fri May 25 08:48:50 GMT 2007
------------------------------------------------------------
revno: 343
revision-id: tridge at samba.org-20070525084849-chpdtiih9av0o5ji
parent: tridge at samba.org-20070525071650-qvhjv520xjvzhubs
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Fri 2007-05-25 18:48:49 +1000
message:
paraoid check for empty db on attach
modified:
common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c 2007-05-19 03:45:24 +0000
+++ b/common/ctdb_ltdb.c 2007-05-25 08:48:49 +0000
@@ -318,6 +318,20 @@
/*
+ paraoid check to see if the db is empty
+ */
+static void ctdb_check_db_empty(struct ctdb_db_context *ctdb_db)
+{
+ struct tdb_context *tdb = ctdb_db->ltdb->tdb;
+ int count = tdb_traverse_read(tdb, NULL, NULL);
+ if (count != 0) {
+ DEBUG(0,(__location__ " tdb '%s' not empty on attach! aborting\n",
+ ctdb_db->db_path));
+ ctdb_fatal(ctdb_db->ctdb, "database not empty on attach");
+ }
+}
+
+/*
a client has asked to attach a new database
*/
int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
@@ -384,6 +398,8 @@
return -1;
}
+ ctdb_check_db_empty(ctdb_db);
+
DLIST_ADD(ctdb->db_list, ctdb_db);
/*
More information about the samba-cvs
mailing list