Skip to content

borges: check if siva file is empty when it shouldn't#366

Merged
jfontan merged 2 commits intosrc-d:masterfrom
jfontan:improvement/fail-if-siva-is-missing
Nov 13, 2018
Merged

borges: check if siva file is empty when it shouldn't#366
jfontan merged 2 commits intosrc-d:masterfrom
jfontan:improvement/fail-if-siva-is-missing

Conversation

@jfontan
Copy link
Contributor

@jfontan jfontan commented Nov 8, 2018

If there are mentions to the init commit in any reference it checks that
the siva is not empty (contains at least one commit).

To do this two new functions are added to RepositoryStore interface:

  • GetRefsByInit: Gets all references that have the provided init commit.
    Still not used but will be needed soon to fix problems with missing or
    broken siva files.
  • InitHasRefs: Returns true if there's a reference with an specific init
    commit. Similar to GetRefsByInit but faster because it only check that
    at least one reference has it and does not retrieve repository data.

Note: we need an index in Reference.Init

Fixes: #365

If there are mentions to the init commit in any reference it checks that
the siva is not empty (contains at least one commit).

To do this two new functions are added to RepositoryStore interface:

* GetRefsByInit: Gets all references that have the provided init commit.
Still not used but will be needed soon to fix problems with missing or
broken siva files.
* InitHasRefs: Returns true if there's a reference with an specific init
commit. Similar to GetRefsByInit but faster because it only check that
at least one reference has it and does not retrieve repository data.

Note: we need an index in Reference.Init

Signed-off-by: Javi Fontan <jfontan@gmail.com>
@jfontan jfontan requested a review from a team November 8, 2018 12:02
@ajnavarro
Copy link
Contributor

@jfontan check the CI, codecov is not executed.

Signed-off-by: Javi Fontan <jfontan@gmail.com>
@jfontan
Copy link
Contributor Author

jfontan commented Nov 8, 2018

@ajnavarro now coverage is sent. It was disabled after updating to ci v1. Previously this was done by test-coverage. Now it is done in codecov.

@ajnavarro
Copy link
Contributor

Just to do not forget. If we need an index, we should add it here: https://github.com/src-d/core-retrieval/blob/master/schema/sql/schema.sql

@jfontan
Copy link
Contributor Author

jfontan commented Nov 8, 2018

I've just checked and there's already an index in init:

CREATE INDEX IF NOT EXISTS idx_references_init ON "repository_references" ("init");

@jfontan jfontan merged commit 4b25805 into src-d:master Nov 13, 2018
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.

Make repository fail if a packfile is not found and should be there.

3 participants