Commit 5db69c7
committed
Implementing bb's standard db access pattern for last-N-failed builder
MTRLogObserver is deprecated starting with Buildbot 3.3.0.
Where possible, without breaking existing builders, we need to
move away from using MTR related classes and methods.
In this case, subclassing MTR was not even needed for getting the test failures.
This patch is implementing the standard db access pattern of Buildbot.
See:
https://buildbot.readthedocs.io/en/latest/developer/database.html#module-buildbot.db.pool
Although the recommended way is to retrieve data through the data api
our use case is special enough to make an exception, given that
the test_ table schemas will become in-house maintained when we migrate
to newer versions of buildbot.
**VERY IMPORTANT NOTE**:
After removing `MTR` as a parent class I observed that `tests_to_run` start to get populated on `buildbot.dev.mariadb.org`
Countless hours later, some debugging code revelead that `test_type` although sent correctly to get_tests_for_type is then replaced with None by the parent class `__init__`.
```
2026-02-02 16:11:40+0000 [-] [FetchTestData] master_branch: type=<class 'str'> len=5 repr='10.11'
2026-02-02 16:11:40+0000 [-] [FetchTestData] master_branch tail codepoints: [49, 48, 46, 49, 49]
2026-02-02 16:11:40+0000 [-] [FetchTestData] test_type: type=<class 'NoneType'> len=None repr=None
```
The only reason that on `buildbot.mariadb.org`, `tests_run_run` is sometimes populated is
because the failures are bumped with the default type as in:
```
tests += yield self.get_tests_for_type(
branch, "mtr", limit - len(tests)
)
```
The `mtr` type last appeared on `2025-01-28` as per cross-reference:
https://buildbot.mariadb.org/cr/?branch=&revision=&platform=&dt=&bbnum=&typ=MTR&info=&test_name=&test_variant=&info_text=&failure_text=&limit=5#
**So basically the `last-N-failed` builder never did what it was supposed to do.**
The source of this bug is setting `test_type` before invoking the `__init__` method of the parent class (`MTR`) in:
```
class FetchTestData(MTR):
def __init__(self, mtrDbPool, test_type, **kwargs):
self.mtrDbPool = mtrDbPool
self.test_type = test_type
super().__init__(dbpool=mtrDbPool, **kwargs)
```
Some will guess right, `MTR` defines `test_type` as `None` (the default).1 parent d98e784 commit 5db69c7
1 file changed
Lines changed: 41 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | | - | |
| 62 | + | |
60 | 63 | | |
61 | | - | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
71 | 78 | | |
72 | | - | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | | - | |
75 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
76 | 104 | | |
77 | 105 | | |
78 | 106 | | |
| |||
613 | 641 | | |
614 | 642 | | |
615 | 643 | | |
616 | | - | |
617 | 644 | | |
618 | 645 | | |
619 | 646 | | |
| |||
0 commit comments