Page MenuHomeSoftware Heritage

Add a check_dbversion() method to the Db class
ClosedPublic

Authored by douardda on Aug 20 2020, 12:10 PM.

Details

Summary

This method compares the version stored in the database in the dbversion
table with the currently declared version.

This current version is declared as a simple current_version attribute
on the Db class. It must be updated jointly in 30-swh-schema.sql when
modifying the db schema. Note that if this is forgotten, the added test
test_dbversion should fail.

Related to T2525.

Also:

  • Code cleanup: fix import statements swh.storage.common content has been moved to swh.core.db.common a while ago.
  • Fix pytest_plugin's database janitor: do not truncate the dbversion table

Diff Detail

Event Timeline

Build has FAILED

Patch application report for D3814 (id=13428)

Rebasing onto 6a53cb3ef3...

Current branch diff-target is up to date.
Changes applied before test
commit 70294c0a364d25d16ea2230a71bd242fd38a81c8
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 418a8f0f9548f7d735473d0d893b653b10758a34
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

commit 79428520e23aa00e20960071c342b8279f406f22
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:57:22 2020 +0200

    Code cleanup: fix import statements
    
    `swh.storage.common` content has been moved to `swh.core.db.common` a while ago.

Link to build: https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/830/
See console output for more information: https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/830/console

as said in the commit message, It must be updated jointly in 30-swh-schema.sql
(including after a rebase...)

Build is green

Patch application report for D3814 (id=13430)

Rebasing onto 6a53cb3ef3...

Current branch diff-target is up to date.
Changes applied before test
commit 9e29879a30067bcabdd97ec721db5d627f658f14
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 418a8f0f9548f7d735473d0d893b653b10758a34
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

commit 79428520e23aa00e20960071c342b8279f406f22
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:57:22 2020 +0200

    Code cleanup: fix import statements
    
    `swh.storage.common` content has been moved to `swh.core.db.common` a while ago.

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

Build is green

Patch application report for D3814 (id=13451)

Rebasing onto 3ac332ecbf...

Current branch diff-target is up to date.
Changes applied before test
commit fcf09599f3462050a592b4b93c4a60a7eb5ab0cd
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 2f0dff41a9237c9e01413df37fbeef04697166f2
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

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

Build is green

Patch application report for D3814 (id=13461)

Rebasing onto d1f19e97c3...

Current branch diff-target is up to date.
Changes applied before test
commit cba6959b163ce0711b3b490201dd6f414843396e
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 346ad9c4197e57d377fed351b2353e14af486995
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

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

This revision is now accepted and ready to land.Aug 21 2020, 11:47 PM
ardumont added inline comments.
swh/storage/postgresql/db.py
1337

black did play some trick ;)
also the f is no longer needed (this should say something, shouldn't it?)

a string which got realigned can be merged into 1
but otherwise, fine ;)

swh/storage/postgresql/db.py
1337

:-)

fix failed black magic as ween by ardumont

Build is green

Patch application report for D3814 (id=13489)

Rebasing onto f570f9336c...

First, rewinding head to replay your work on top of it...
Applying: Fix pytest_plugin's database janitor: do not truncate the dbversion table
Applying: Add a check_dbversion() method to the Db class
Changes applied before test
commit e9347f25df37ca7a8a21a44761b7496d4b1e5b1b
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 652e03fc16de599921597910b2b504a371aaa0d9
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

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

pick the correct commit to be stashed...

Build is green

Patch application report for D3814 (id=13493)

Rebasing onto f570f9336c...

First, rewinding head to replay your work on top of it...
Applying: Fix pytest_plugin's database janitor: do not truncate the dbversion table
Applying: Add a check_dbversion() method to the Db class
Changes applied before test
commit e164157f7e89c47b018d5143c9ff2c3b2cceb446
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 77986148fb6d8caf6671f950ff443db74c3ea357
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

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

Build is green

Patch application report for D3814 (id=13498)

Rebasing onto f570f9336c...

Current branch diff-target is up to date.
Changes applied before test
commit c16ff506ad52abb926c656cb6cd0872ebcf9bf58
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 12:00:37 2020 +0200

    Add a check_dbversion() method to the Db class
    
    This method compares the version stored in the database in the `dbversion`
    table with the currently declared version.
    
    This current version is declared as a simple `current_version` attribute
    on the Db class. **It must be updated jointly in 30-swh-schema.sql** when
    modifying the db schema. Note that if this is forgotten, the added test
    `test_dbversion` should fail.
    
    Related to T2525.

commit 629d2d10ee97ddca057858d5a2fe2d6b52f6edd7
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Aug 20 11:55:56 2020 +0200

    Fix pytest_plugin's database janitor: do not truncate the dbversion table

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