s4-dsdb: added SAMDB_INDEXING_VERSION to @INDEXLIST
authorAndrew Tridgell <tridge@samba.org>
Tue, 9 Aug 2011 06:54:36 +0000 (16:54 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 9 Aug 2011 09:56:23 +0000 (11:56 +0200)
this can be used to force re-indexing of samdb when we change
something that affects index comparison, in this case the
canonicalisation of booleans

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/schema/schema_set.c

index 1c1e45ef78844bada9469f4181b5e9c7c606841e..c5ac6127d1d526b2ae59d18e6abfda7803fc69a0 100644 (file)
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "lib/util/tsort.h"
 
+/* change this when we change something in our schema code that
+ * requires a re-index of the database
+ */
+#define SAMDB_INDEXING_VERSION "2"
+
 /*
   override the name to attribute handler function
  */
@@ -95,6 +100,12 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
                goto op_error;
        }
 
+
+       ret = ldb_msg_add_string(msg_idx, "@IDXVERSION", SAMDB_INDEXING_VERSION);
+       if (ret != LDB_SUCCESS) {
+               goto op_error;
+       }
+
        for (attr = schema->attributes; attr; attr = attr->next) {
                const char *syntax = attr->syntax->ldb_syntax;