Page MenuHomeSoftware Heritage

cassandra: Deduplicate table names
ClosedPublic

Authored by vlorentz on Apr 22 2021, 12:21 PM.

Details

Summary

This removes all table names from cassandra/cql.py, and gets them from
cassandra/schema.py instead.

When possible, this uses existing constants (BaseRow.TABLE), otherwise
it uses a function to compute these names.

This is needed to support schema migrations, as updating a table's
primary key requires creating a new table with a different name.

Prerequisite for T2602.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5574 (id=19921)

Rebasing onto a1fc5fb714...

Current branch diff-target is up to date.
Changes applied before test
commit 3822922749f6e43721d9dba7afcbbcbe3559fff7
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Apr 22 12:21:22 2021 +0200

    cassandra: Deduplicate table names
    
    This removes all table names from cassandra/cql.py, and gets them from
    cassandra/schema.py instead.
    
    When possible, this uses existing constants (BaseRow.TABLE), otherwise
    it uses a function to compute these names.
    
    This is needed to support schema migrations, as updating a table's
    primary key requires creating a new table with a different name.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1263/ for more details.

ardumont added inline comments.
swh/storage/cassandra/model.py
39
This revision is now accepted and ready to land.Apr 22 2021, 3:56 PM
This revision was landed with ongoing or failed builds.Apr 22 2021, 5:22 PM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D5574 (id=19931)

Rebasing onto eb8c147a54...

First, rewinding head to replay your work on top of it...
Fast-forwarded diff-target to base-revision-1264-D5574.
Changes applied before test

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1264/ for more details.