Page MenuHomeSoftware Heritage

in_memory: Make origin-visit-status-add respect "on conflict ignore" policy
ClosedPublic

Authored by ardumont on Jun 13 2020, 8:42 AM.

Details

Summary

Prior to this commit, that behavior was not properly tested and inconsistent
between backends. All backends except in-memory were respecting it.

This commit aligns the in-memory backend implementation and test it.

It's the source of the current failure in D3273

Depends on D3277
Related to T2310

Test Plan

tox

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 D3278 (id=11620)

Could not rebase; Attempt merge onto 33efdb0dd4...

Updating 33efdb0..1d8a54b
Fast-forward
 swh/storage/in_memory.py          |  6 +++--
 swh/storage/tests/test_storage.py | 46 +++++++++++++++++++++++++++++----------
 swh/storage/validate.py           | 32 ++++++++++++++++++---------
 3 files changed, 60 insertions(+), 24 deletions(-)
Changes applied before test
commit 1d8a54ba8312d15c9fd843efe3754691576398af
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sat Jun 13 08:40:29 2020 +0200

    in_memory: Make origin-visit-status-add do on conflict ignore
    
    Aligning its behavior with the other backend.
    
    Related to T2310

commit 874da2dee1957ac5e9f5b17a81e11d9d9e8690f0
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sat Jun 13 08:37:57 2020 +0200

    Start migrating the validate proxy toward using BaseModel objects
    
    This will allow to progress incrementally towards removing it.
    
    When it allows to use BaseModel objects everywhere (and tests in test_storage
    are adapted to use this property), it will be time to remove it entirely (as
    it's only used in test).
    
    It's preparatory work for future diffs.

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

ardumont retitled this revision from in_memory: Make origin-visit-status-add do on conflict ignore to in_memory: Make origin-visit-status-add do respect "on conflict ignore" policy.Jun 13 2020, 8:58 AM
ardumont retitled this revision from in_memory: Make origin-visit-status-add do respect "on conflict ignore" policy to in_memory: Make origin-visit-status-add respect "on conflict ignore" policy.Jun 13 2020, 9:10 AM

Add test to ensure the behavior is consistent across backend implementations.

Depends on D3279

Build is green

Patch application report for D3278 (id=11629)

Could not rebase; Attempt merge onto 874da2dee1...

Updating 874da2d..12bc543
Fast-forward
 swh/storage/in_memory.py          |   6 +-
 swh/storage/tests/test_storage.py | 207 +++++++++++++++++---------------------
 2 files changed, 95 insertions(+), 118 deletions(-)
Changes applied before test
commit 12bc5434404c0710dd25b6c5376168af39916c4d
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 12:38:42 2020 +0200

    in_memory: Make origin-visit-status-add respect "on conflict ignore" policy
    
    Prior to this commit, that behavior was not properly tested and inconsistent
    between backends. All backends except in-memory were respecting it.
    
    This commit aligns the in-memory backend implementation and test it.
    
    Related to T2310

commit 46a78391ea46281619f6d39028b285e3450e9cde
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 10:44:10 2020 +0200

    test_storage: Add journal behavior coverage for origin-visit-*add
    
    This was missing some coverage on origin-visit-add and origin-visit-status-add
    for the journal part.
    
    Related to T2310

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

Separate main test from the the double insert test

Build was aborted

Patch application report for D3278 (id=11632)

Rebasing onto 46a78391ea...

Current branch diff-target is up to date.
Changes applied before test
commit 0b78dad1d79fe09baa563cfbc0ceb1d07c1987df
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 12:38:42 2020 +0200

    in_memory: Make origin-visit-status-add respect "on conflict ignore" policy
    
    Prior to this commit, that behavior was not properly tested and inconsistent
    between backends. All backends except in-memory were respecting it.
    
    This commit aligns the in-memory backend implementation and test it.
    
    Related to T2310

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

vlorentz added inline comments.
swh/storage/tests/test_storage.py
1822–1842

remove all this, it's already tested in the test above.

swh/storage/tests/test_storage.py
1822–1842

not the part about the "twice the message"

Build is green

Patch application report for D3278 (id=11633)

Rebasing onto 46a78391ea...

Current branch diff-target is up to date.
Changes applied before test
commit 0183fec91dead7ea49cc1f94382e9a3b19bde2f5
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 12:38:42 2020 +0200

    in_memory: Make origin-visit-status-add respect "on conflict ignore" policy
    
    Prior to this commit, that behavior was not properly tested and inconsistent
    between backends. All backends except in-memory were respecting it.
    
    This commit aligns the in-memory backend implementation and test it.
    
    Related to T2310

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

This revision is now accepted and ready to land.Jun 15 2020, 1:59 PM

for the record: ardumont and I noticed that the "on conflict ignore" behavior on the backends is inconsistent with what is written to kafka (the newest value overwrites the older one), but we'll change that in a later diff