Page MenuHomeSoftware Heritage

journal_client: Fix date computations for (un)eventful visits
ClosedPublic

Authored by vsellier on Feb 9 2021, 3:04 PM.

Details

Summary

Fix a wrong computation when several messages (>=3) for the same
snapshot are received in the wrong order
For example, before the fix, the following occurs:

| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2021** | **2020**  | S2   |

as it should be:

| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2020** | **2022**  | S2   |

P945 for more scenario samples.

Related to T3000

Diff Detail

Repository
rDSCH Scheduling utilities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build has FAILED

Patch application report for D5047 (id=17996)

Rebasing onto 14feab9523...

Current branch diff-target is up to date.
Changes applied before test
commit 6999b3be99996457e7387f54cd487faa633e9d25
Author: Vincent SELLIER <vincent.sellier@softwareheritage.org>
Date:   Tue Feb 9 14:56:56 2021 +0100

    journal_client: Fix date computations for (un)eventful visits
    
    Fix a wrong computation when several messages (>=3) for the same
    snapshot are received in the wrong order
    For example, before the fix, the following occurs:
| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2021** | **2020**  | S2   |
```

as it should be:
```
| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2020** | **2022**  | S2   |
```

Related to T3000
Link to build: https://jenkins.softwareheritage.org/job/DSCH/job/tests-on-diff/299/
See console output for more information: https://jenkins.softwareheritage.org/job/DSCH/job/tests-on-diff/299/console
Harbormaster returned this revision to the author for changes because remote builds failed.Feb 9 2021, 3:07 PM
Harbormaster failed remote builds in B19117: Diff 17996!

Build is green

Patch application report for D5047 (id=18016)

Rebasing onto aa507ac51c...

Current branch diff-target is up to date.
Changes applied before test
commit cf32e37649207cabac4e960fc8d45ba5af480a24
Author: Vincent SELLIER <vincent.sellier@softwareheritage.org>
Date:   Tue Feb 9 14:56:56 2021 +0100

    journal_client: Fix date computations for (un)eventful visits
    
    Fix a wrong computation when several messages (>=3) for the same
    snapshot are received in the wrong order
    For example, before the fix, the following occurs:
| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2021** | **2020**  | S2   |
```

as it should be:
```
| date | snapshot |     | last_ev  | last_unev | Snap |
| ---- | -------- | --- | -------- | --------- | ---- |
| 2022 | S2       |     | 2022     |           | S2   |
| 2020 | S2       |     | 2020     | 2022      | S2   |
| 2021 | S2       |     | **2020** | **2022**  | S2   |
```

Related to T3000
See https://jenkins.softwareheritage.org/job/DSCH/job/tests-on-diff/300/ for more details.
vlorentz added a subscriber: vlorentz.

This code hurts my brain, but it looks correct

This revision is now accepted and ready to land.Feb 10 2021, 9:50 AM