[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Aug 2 02:30:02 UTC 2019


The branch, master has been updated
       via  81186651eeb ldb: skip indexes on full_search
      from  4b88e1d997c tests/dcerpc/raw_protocol: Add more tests for DCERPC_AUTH_LEVEL_PACKET

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 81186651eebf20e1ed7baf0116d5dbbc16d3d995
Author: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Date:   Wed Jul 24 11:46:01 2019 +1200

    ldb: skip indexes on full_search
    
    Use iterate_range kv op to skip the index section of the database when
    running a full search. Quick local testing showed 18% improved throughput
    on a full search with no results on a 50k database. With more results,
    improvement is smaller but still noticeable.
    
    Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Aug  2 02:29:42 UTC 2019 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/ldb_key_value/ldb_kv_search.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ldb_key_value/ldb_kv_search.c b/lib/ldb/ldb_key_value/ldb_kv_search.c
index f2d96198151..a0e1762bc90 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_search.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_search.c
@@ -408,6 +408,18 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv,
 	return 0;
 }
 
+/*
+ * Key pointing to just before the first GUID indexed record for
+ * iterate_range
+ */
+struct ldb_val start_of_db_key = {.data=discard_const_p(uint8_t, "GUID<"),
+				  .length=6};
+/*
+ * Key pointing to just after the last GUID indexed record for
+ * iterate_range
+ */
+struct ldb_val end_of_db_key = {.data=discard_const_p(uint8_t, "GUID>"),
+				.length=6};
 
 /*
   search the database with a LDAP-like expression.
@@ -420,8 +432,23 @@ static int ldb_kv_search_full(struct ldb_kv_context *ctx)
 	    talloc_get_type(data, struct ldb_kv_private);
 	int ret;
 
+	/*
+	 * If the backend has an iterate_range op, use it to start the search
+	 * at the first GUID indexed record, skipping the indexes section.
+	 */
 	ctx->error = LDB_SUCCESS;
-	ret = ldb_kv->kv_ops->iterate(ldb_kv, search_func, ctx);
+	ret = ldb_kv->kv_ops->iterate_range(ldb_kv,
+					    start_of_db_key,
+					    end_of_db_key,
+					    search_func,
+					    ctx);
+	if (ret == LDB_ERR_OPERATIONS_ERROR) {
+		/*
+		 * If iterate_range isn't defined, it'll return an error,
+		 * so just iterate over the whole DB.
+		 */
+		ret = ldb_kv->kv_ops->iterate(ldb_kv, search_func, ctx);
+	}
 
 	if (ret < 0) {
 		return LDB_ERR_OPERATIONS_ERROR;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list