Page MenuHomeSoftware Heritage

indexer: Migrate away from temporary table
ClosedPublic

Authored by ardumont on Jun 11 2018, 2:31 PM.

Details

Reviewers
olasd
Group Reviewers
Reviewers
Maniphest Tasks
T1095: indexer: Remove temporary table usage for read-only queries
Commits
rDCIDX6311e37236f3: swh.indexer.storage: Fix typo in invariable name metadata
rDCIDX1f7ffaf4fb9d: swh.indexer.storage: Remove no longer used endpoints
rDCIDX6b97d704003a: swh.indexer.storage.db: Refactor using a `get from list` pattern
rDCIDXf4f2febbb196: swh.indexer.storage.db: Refactor using a `missing from list` pattern
rDCIDX59be2043e91c: swh.indexer.storage: Update docstrings information and format
rDCIDXa898cf5e04cf: swh.indexer.storage: Remove usused import
rDCIDXedb02b574f86: storage: revision_metadata_missing: Migrate away from temp table
rDCIDXc3d1c41f9c1b: swh.indexer.storage: Remove dead entry points origin_metadata*
rDCIDXf4d034a35f48: storage: revision_metadata_get: Migrate away from temp table
rDCIDX557c8e8b8120: storage: content_metadata_get: Migrate away from temp table
rDCIDXe6f7a58b060b: storage: content_metadata_missing: Migrate away from temp table
rDCIDXfd985db8c6a5: storage: c_fossology_license_get: Migrate away from temp table
rDCIDX1f775de94b42: storage: content_ctags_missing: Migrate away from temp table
rDCIDX2ea969f1f144: storage: content_ctags_get: Migrate away from temp table
rDCIDX09787cc0e518: storage: content_language_get: Migrate away from temp table
rDCIDX7f39bb2f9aec: storage: content_mimetype_get: Migrate away from temp table
rDCIDX6c0ed97ac4de: storage: content_language_missing: Migrate away from temp table
rDCIDX740d0fe8f6d3: storage: content_mimetype_missing: Migrate away from temp table
Summary

To permit to deploy and use indexer storage service on azure (plugged to a replica db).

Closes T1095
Related T1094

Separated commits:
storage: content_mimetype_missing: Migrate away from temp table
storage: content_mimetype_get: Migrate away from temp table
storage: content_language_missing: Migrate away from temp table
storage: content_language_get: Migrate away from temp table
storage: content_language_get: Migrate away from temp table
storage: content_ctags_missing: Migrate away from temp table
storage: content_ctags_get: Migrate away from temp table
storage: c_fossology_license_get: Migrate away from temp table
storage: content_metadata_missing: Migrate away from temp table
storage: content_metadata_get: Migrate away from temp table
swh.indexer.storage: Update docstrings information and format
storage: revision_metadata_missing: Migrate away from temp table
storage: revision_metadata_get: Migrate away from temp table
swh.indexer.storage: Remove dead entry points origin_metadata*

Test Plan

Tests ok

Diff Detail

Repository
rDCIDX Metadata indexer
Branch
migrate-away-from-temp-table-in-read-only-queries
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1249
Build 1593: arc lint + arc unit

Event Timeline

ardumont retitled this revision from indexer: Migrate away from temporary table To permit to use the indexer storage service (on azure) plugged to a replica db. Closes T1095 Related T1094 to indexer: Migrate away from temporary table.Jun 11 2018, 2:34 PM
ardumont edited the summary of this revision. (Show Details)

Remove no longer needed code

  • swh.indexer.storage: Remove usused import
  • swh.indexer.storage: Remove no longer used endpoints

Refactoring

  • swh.indexer.storage.db: Refactor using a missing from list pattern
  • swh.indexer.storage.db: Refactor using a get from list pattern
  • swh.indexer.storage: Fix typo in invariable name metadata

I get a test failure in content_ctags_get (both remote and local). It seems that the order of returned lists of ctags has changed and the assertEqual should be an assertCountEqual (compare lists regardless of order). This might warrant a review of other tests.

In D343#6715, @olasd wrote:

I get a test failure in content_ctags_get (both remote and local). It seems that the order of returned lists of ctags has changed and the assertEqual should be an assertCountEqual (compare lists regardless of order).

You are right.

I see that an order by line got dropped in the transition (fortunately, i have independent commits for each stored procedure, so it's apparent).

What worries me is that i cannot reproduce that failure... No matter how many times i trigger the tests.

This might warrant a review of other tests.

Well, the commits first.

Fix and rebase work

  • storage: content_language_get: Migrate away from temp table
  • storage: content_ctags_missing: Migrate away from temp table
  • storage: content_ctags_get: Migrate away from temp table
  • storage: c_fossology_license_get: Migrate away from temp table
  • storage: content_metadata_missing: Migrate away from temp table
  • storage: content_metadata_get: Migrate away from temp table
  • swh.indexer.storage: Update docstrings information and format
  • storage: revision_metadata_missing: Migrate away from temp table
  • storage: revision_metadata_get: Migrate away from temp table
  • swh.indexer.storage: Remove dead entry points origin_metadata*
  • swh.indexer.storage: Remove usused import
  • swh.indexer.storage: Remove no longer used endpoints
  • swh.indexer.storage.db: Refactor using a missing from list pattern
  • swh.indexer.storage.db: Refactor using a get from list pattern
  • swh.indexer.storage: Fix typo in invariable name metadata

I see that an order by line got dropped in the transition (fortunately, i have independent commits for each stored procedure, so it's apparent).

There, fixed.
Thanks for the heads up on this.

This might warrant a review of other tests.

Well, the commits first.

Done. Checked all endpoints (missing, get).
No other incongruities of the sort.

What worries me is that i cannot reproduce that failure... No matter how many times i trigger the tests.

I still don't get that though.

sql/swh-func.sql
361

This got dropped during the transition.
It's now back.

swh/indexer/storage/db.py
165

Back where it belonged.

Because, as usual, as soon as i said "everything is fine", a typo (; wrongly placed in a query) slided into it...

  • storage: content_ctags_get: Migrate away from temp table
  • storage: c_fossology_license_get: Migrate away from temp table
  • storage: content_metadata_missing: Migrate away from temp table
  • storage: content_metadata_get: Migrate away from temp table
  • swh.indexer.storage: Update docstrings information and format
  • storage: revision_metadata_missing: Migrate away from temp table
  • storage: revision_metadata_get: Migrate away from temp table
  • swh.indexer.storage: Remove dead entry points origin_metadata*
  • swh.indexer.storage: Remove usused import
  • swh.indexer.storage: Remove no longer used endpoints
  • swh.indexer.storage.db: Refactor using a missing from list pattern
  • swh.indexer.storage.db: Refactor using a get from list pattern
  • swh.indexer.storage: Fix typo in invariable name metadata
This revision is now accepted and ready to land.Jun 13 2018, 10:46 AM
This revision was automatically updated to reflect the committed changes.