Skip to content

No global vars#51

Merged
Ngalstyan4 merged 10 commits intomainfrom
feature/narek-no-global-vars
Aug 20, 2023
Merged

No global vars#51
Ngalstyan4 merged 10 commits intomainfrom
feature/narek-no-global-vars

Conversation

@Ngalstyan4
Copy link
Copy Markdown
Contributor

@Ngalstyan4 Ngalstyan4 commented Aug 14, 2023

  • Update usearch API to take a postgres context and pass it to all external retrievers(the context is initialized and passed to usearch iv usearch_init, and it is passed back to postgress in all retriever calls).
  • Move extra_dirtied page tracking to per-index-operation context
  • Move dirtied header to per-index-operation context and get rid of that last global variable
  • Rethink variables names and, generally, cleanup external_index.c (cleaned up a little, needs more work but let's do that later)

Incorporates the commit from #67 and closes #67

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 14, 2023

Codecov Report

Merging #51 (3655eb4) into main (969cc91) will increase coverage by 0.24%.
The diff coverage is 89.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   82.86%   83.10%   +0.24%     
==========================================
  Files           9       11       +2     
  Lines         887      876      -11     
  Branches      179      165      -14     
==========================================
- Hits          735      728       -7     
+ Misses         71       67       -4     
  Partials       81       81              
Files Changed Coverage Δ
src/hnsw/build.c 86.73% <75.00%> (-1.15%) ⬇️
src/hnsw/retriever.c 83.33% <83.33%> (ø)
src/hnsw/extra_dirtied.c 86.11% <86.11%> (ø)
src/hnsw/external_index.c 86.22% <89.15%> (+1.19%) ⬆️
src/hnsw.c 84.11% <100.00%> (+0.14%) ⬆️
src/hnsw/insert.c 84.41% <100.00%> (-0.40%) ⬇️
src/hnsw/scan.c 76.47% <100.00%> (+0.28%) ⬆️

uint32 vector_dim;
uint32 num_vectors;
BlockNumber last_data_block;
uint32 blockno_index_start;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this one as well. Maybe in separate PR though

return ed;
}

void extra_dirtied_add(ExtraDirtiedBufs *ed, BlockNumber blockno, Buffer buf, Page page)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe not good suggestion, but I'd rather pass the context and then get the buffers from the context here

@Ngalstyan4 Ngalstyan4 force-pushed the feature/narek-no-global-vars branch from 7116a05 to f92da5c Compare August 18, 2023 04:36
Copy link
Copy Markdown
Contributor

@davkhech davkhech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Ngalstyan4 Ngalstyan4 force-pushed the feature/narek-no-global-vars branch 3 times, most recently from a5922de to 2836a03 Compare August 20, 2023 04:29
@Ngalstyan4 Ngalstyan4 changed the title [WIP] no global vars No global vars Aug 20, 2023
@Ngalstyan4 Ngalstyan4 requested a review from davkhech August 20, 2023 04:35
@Ngalstyan4 Ngalstyan4 marked this pull request as ready for review August 20, 2023 04:35
@Ngalstyan4 Ngalstyan4 requested review from var77 and removed request for davkhech August 20, 2023 04:36
@Ngalstyan4 Ngalstyan4 force-pushed the feature/narek-no-global-vars branch 2 times, most recently from 4fa5175 to 65ead0b Compare August 20, 2023 05:25
TMP_OUTDIR=$TMP_ROOT/tmp_output
FILTER="${FILTER:-}"
DB_USER="${DB_USER:-}"
DB_USER="${DB_USER:-postgres}"
Copy link
Copy Markdown
Collaborator

@var77 var77 Aug 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can set default to os user

Suggested change
DB_USER="${DB_USER:-postgres}"
DB_USER="${DB_USER:-$USER}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! fixed, and also made sure to use "postgres" in place of "root" when root is the user.
This is useful for when we are in docker containers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty file

@Ngalstyan4 Ngalstyan4 force-pushed the feature/narek-no-global-vars branch from eb7db07 to 28ea3a7 Compare August 20, 2023 22:03
* if the user is root, this is typically in docker and the
database is usually under postgres user
* if the user is something else, typically a psql user exists
for the user so we attempt to use that.
* we set the user once in run_all_tests instead of running the same
logic again in test_runner
Now when usearch external retriever is initialized, an opeque
is passed in which then is passed back in retrievers.
This way, we no longer need to have global variables to manage memory
on which external index nodes live.
Get rid of num_blocks in index header

Cleanup and format
@Ngalstyan4 Ngalstyan4 force-pushed the feature/narek-no-global-vars branch from 28ea3a7 to 81fff45 Compare August 20, 2023 22:11
@Ngalstyan4 Ngalstyan4 merged commit c2ea66d into main Aug 20, 2023
@Ngalstyan4 Ngalstyan4 deleted the feature/narek-no-global-vars branch August 20, 2023 22:23
var77 added a commit that referenced this pull request Oct 8, 2024
…51)

* Cancel running embedding job with tokio tasks

* Gracefully exit ongoing embedding job if the job is canceled from db

* Delete collected insert rows on job cancel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants