Skip to content

Commit

Permalink
avoid loop at DocTable_Set (#1498)
Browse files Browse the repository at this point in the history
* avoid loop at DocTable_Set
  • Loading branch information
ashtul committed Oct 14, 2020
1 parent e300e2c commit 06f52bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/doc_table.c
Expand Up @@ -94,10 +94,10 @@ static inline void DocTable_Set(DocTable *t, t_docId docId, RSDocumentMetadata *
t->cap = MIN(t->cap, t->maxSize); // make sure we do not excised maxSize
t->cap = MAX(t->cap, bucket + 1); // docs[bucket] needs to be valid, so t->cap > bucket
t->buckets = rm_realloc(t->buckets, t->cap * sizeof(DMDChain));
for (; oldcap < t->cap; oldcap++) {
t->buckets[oldcap].lroot.head = NULL;
t->buckets[oldcap].lroot.tail = NULL;
}

// We clear new extra allocation to Null all list pointers
size_t memsetSize = (t->cap - oldcap) * sizeof(DMDChain);
memset(&t->buckets[oldcap], 0, memsetSize);
}

DMDChain *chain = &t->buckets[bucket];
Expand Down
1 change: 0 additions & 1 deletion tests/pytests/test_config.py
Expand Up @@ -34,7 +34,6 @@ def testGetConfigOptions(env):
assert env.expect('ft.config', 'get', 'FORK_GC_RETRY_INTERVAL').res[0][0] =='FORK_GC_RETRY_INTERVAL'
assert env.expect('ft.config', 'get', '_MAX_RESULTS_TO_UNSORTED_MODE').res[0][0] =='_MAX_RESULTS_TO_UNSORTED_MODE'
assert env.expect('ft.config', 'get', 'PARTIAL_INDEXED_DOCS').res[0][0] =='PARTIAL_INDEXED_DOCS'

'''
Config options test. TODO : Fix 'Success (not an error)' parsing wrong error.
Expand Down

0 comments on commit 06f52bf

Please sign in to comment.