ldb_kv_index: Add a giant comment in regards to index_format_fn
authorGarming Sam <garming@catalyst.net.nz>
Thu, 4 Apr 2019 02:02:15 +0000 (15:02 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 8 Apr 2019 02:07:22 +0000 (02:07 +0000)
The reason we needed it in the first place was that the original
canonicalize is being used for non-index functions and it never produced
the right order originally (at least for integers).

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_key_value/ldb_kv_index.c

index 8580db1c778141d3264ba59faed767bb8676db4c..2627d79d5fd540e5aa0bb390e1e0d2f9c4d012ad 100644 (file)
@@ -1770,6 +1770,20 @@ static int traverse_range_index(struct ldb_kv_private *ldb_kv,
        return LDB_SUCCESS;
 }
 
+/*
+ * >= and <= indexing implemented using lexicographically sorted keys
+ *
+ * We only run this in GUID indexing mode and when there is no write
+ * transaction (only implicit read locks are being held). Otherwise, we would
+ * have to deal with the in-memory index cache.
+ *
+ * We rely on the implementation of index_format_fn on a schema syntax which
+ * will can help us to construct keys which can be ordered correctly, and we
+ * terminate using schema agnostic start and end keys.
+ *
+ * index_format_fn must output values which can be memcmp-able to produce the
+ * correct ordering as defined by the schema syntax class.
+ */
 static int ldb_kv_index_dn_ordered(struct ldb_module *module,
                                   struct ldb_kv_private *ldb_kv,
                                   const struct ldb_parse_tree *tree,