[PATCH] Changes to indexing to handle maximum key lengths.
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Fri Mar 2 04:45:31 UTC 2018
On 01/03/18 17:27, Andrew Bartlett via samba-technical wrote:
> On Tue, 2018-02-27 at 17:20 +1300, Andrew Bartlett via samba-technical
> wrote:
>> On Tue, 2018-02-27 at 13:08 +1300, Gary Lockyer wrote:
>>> Updated patch set attached.
>>
>> Thanks Gary.
>
> Thanks again for your great work this week. I've taken the liberty to
> tidy up your branch into something I really think we can land tomorrow.
>
> Here is the patch-set.
I have reviewed all but the last patch (the 1222 line python test), at
which point I began to feel very tired. I'll get back to it sometime
soon. My mostly reviewed branch is here:
http://git.catalyst.net.nz/gitweb?p=samba.git;a=shortlog;h=refs/heads/gary-lvl1-cu-douglas-review-in-progress
where I have made the following changes squashed into in various
patches. Most changes are in comments, and probably the only one that
might need explanation is this which occurs twice:
- if (ret != LDB_SUCCESS &&
- ret != LDB_ERR_NO_SUCH_OBJECT) {
+ if (ret != LDB_SUCCESS) {
This immediately follows a
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
continue;
}
and I thought the "&& ret != LDB_ERR_NO_SUCH_OBJECT" here redundant.
Douglas
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index c243b7e29f3..870a112ac51 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -507,8 +507,8 @@ int ltdb_key_dn_from_idx(struct ldb_module *module,
if (list->count > 0 && truncation == KEY_TRUNCATED) {
/*
- * DN key has been truncated, need to inspect the actual records to locate
- * the actual DN
+ * DN key has been truncated, need to inspect the actual
+ * records to locate the actual DN
*/
int i;
index = -1;
@@ -547,8 +547,7 @@ int ltdb_key_dn_from_idx(struct ldb_module *module,
continue;
}
- if (ret != LDB_SUCCESS &&
- ret != LDB_ERR_NO_SUCH_OBJECT) {
+ if (ret != LDB_SUCCESS) {
/* an internal error */
TALLOC_FREE(rec);
TALLOC_FREE(list);
@@ -923,10 +922,10 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
frmt_len = vstr_len - excess;
*truncation = KEY_TRUNCATED;
/*
- * Note: the double hash "##" is not a typo and
- * indicates that the following value is base64 encoded
* Truncated keys are placed in a separate key space
* from the non truncated keys
+ * Note: the double hash "##" is not a typo and
+ * indicates that the following value is base64 encoded
*/
ret = ldb_dn_new_fmt(ldb, ldb, "%s#%s##%.*s",
LTDB_INDEX, attr_for_dn,
@@ -1710,7 +1709,7 @@ static int ltdb_index_filter(struct ltdb_private *ltdb,
* otherwise we would send the same entry back more
* than once.
*
- * This is needed as in the truncated DN case, or if a
+ * This is needed in the truncated DN case, or if a
* duplicate was forced in via
* LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK
*/
@@ -1949,8 +1948,8 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
*
* If this changes, then the index code above would need to
* pass up a flag to say if any index was truncated during
- * processing as the truncation here refers only to the SCOPE_BASE
- * index.
+ * processing as the truncation here refers only to the
+ * SCOPE_ONELEVEL index.
*/
ret = ltdb_index_filter(ltdb, dn_list, ac, match_count,
scope_one_truncation);
@@ -2091,7 +2090,7 @@ static int ltdb_index_add1(struct ldb_module *module,
continue;
}
- if (ret != LDB_SUCCESS && ret != LDB_ERR_NO_SUCH_OBJECT) {
+ if (ret != LDB_SUCCESS) {
/* an internal error */
TALLOC_FREE(rec);
TALLOC_FREE(list);
More information about the samba-technical
mailing list