Winery settings refactorings
The final goal of this series of refactorings is to make the shards pool configurable (between a RBD-based pool and a file-based pool).
As all the winery components had been written to take a bunch of indiscriminate kwargs and picking through them, adding more settings would be a pain, so I went ahead and moved settings to a clearer (I hope) hierarchy, with the aim of reducing the number of kwargs passed around.
Eventually this should allow performing the "file-based pool" refactoring.
This only makes sense in a commit-by-commit review, I think...
Merge request reports
Activity
Jenkins job DOBJS/gitlab-builds #325 succeeded in 3 min 43 sec.
See Console Output, Blue Ocean and Coverage Report for more details.Jenkins job DOBJS/gitlab-builds #326 succeeded in 4 min 10 sec.
See Console Output, Blue Ocean and Coverage Report for more details.b04bddf6 - winery: Make the directory-based shards pool usable
is a bit of a mess, but the mocking of the ceph pool in the tests was really tangled with the rest of the code, so I didn't manage to unpick the "moving of the code" and the "making it available through configuration", unfortunately.Jenkins job DOBJS/gitlab-builds #327 succeeded in 2 min 44 sec.
See Console Output, Blue Ocean and Coverage Report for more details.added 1 commit
- bef4d9a6 - winery: bring documentation up to date with respect to the reality of the code
Jenkins job DOBJS/gitlab-builds #328 succeeded in 4 min 17 sec.
See Console Output, Blue Ocean and Coverage Report for more details.- Resolved by Nicolas Dandrimont
- swh/objstorage/backends/winery/settings.py 0 → 100644
1 # Copyright (C) 2025 The Software Heritage developers 2 # See the AUTHORS file at the top-level directory of this distribution 3 # License: GNU General Public License version 3, or any later version 4 # See top-level LICENSE file for more information 5 6 from typing import Any, Dict, Literal, NotRequired, Optional, Tuple, TypedDict 7 8 # This would be used for image features that are not supported by the kernel RBD 9 # driver, e.g. exclusive-lock, object-map and fast-diff for kernels < 5.3 10 DEFAULT_IMAGE_FEATURES_UNSUPPORTED: Tuple[str, ...] = () 11 12 13 class Packer(TypedDict): So, that's what I did first.
But then I ended up having to import 25 names from the settings module (especially in objstorage), so I moved to
from . import settings
, which made everything look likesettings.FooSettings
, which annoyed me.from .settings import *
made pylance highlight everything as "maybe this is an unbound variable" which annoyed me too.I'm happy to defer to your opinion either way, I agree these names aren't very satisfactory.
- swh/objstorage/backends/winery/settings.py 0 → 100644
1 # Copyright (C) 2025 The Software Heritage developers 2 # See the AUTHORS file at the top-level directory of this distribution 3 # License: GNU General Public License version 3, or any later version 4 # See top-level LICENSE file for more information 5 6 from typing import Any, Dict, Literal, NotRequired, Optional, Tuple, TypedDict 7 8 # This would be used for image features that are not supported by the kernel RBD 9 # driver, e.g. exclusive-lock, object-map and fast-diff for kernels < 5.3 10 DEFAULT_IMAGE_FEATURES_UNSUPPORTED: Tuple[str, ...] = () 11 12 13 class Packer(TypedDict): Reading some of the following commits in this MR, I wonder if I would not go to an
object-based
api for settings rather than adict-based
one (aka useattr
instead ofTypedDict
I suppose)...It could make things a bit more elegant as well (get rid of the
xxx_settings_with_defaults
which I find not so pretty).
- Resolved by Nicolas Dandrimont
- Resolved by Nicolas Dandrimont
17 17 Implementation notes 18 18 -------------------- 19 19 20 The `sharedstorage.py` file contains the global index implementation that associates every object id to the shard it contains. A list of shard (either writable or readonly) is stored in a table, with a numeric id to save space. The name of the shard is used to create a database (for write shards) or a RBD image (for read shards). 20 The `sharedbase.py` file contains the global index implementation that associates every object id to the shard it contains. A list of shard (either writable or readonly) is stored in a table, with a numeric id to save space. The name of the shard is used to create a database (for write shards) or a RBD image (for read shards). changed this line in version 6 of the diff
17 17 Implementation notes 18 18 -------------------- 19 19 20 The `sharedstorage.py` file contains the global index implementation that associates every object id to the shard it contains. A list of shard (either writable or readonly) is stored in a table, with a numeric id to save space. The name of the shard is used to create a database (for write shards) or a RBD image (for read shards). 20 The `sharedbase.py` file contains the global index implementation that associates every object id to the shard it contains. A list of shard (either writable or readonly) is stored in a table, with a numeric id to save space. The name of the shard is used to create a database (for write shards) or a RBD image (for read shards). 21 21 22 22 The `roshard.py` file contain the lookup function for a read shard and is a thin layer on top of swh-perfect hash. changed this line in version 6 of the diff
added 11 commits
- a8b2e459 - 1 earlier commit
- c156e5b5 - winery: make throttler optional
- 914a2259 - winery: move RBD settings to the new settings framework
- ec5f9e05 - winery: make RBD shard manager a function rather than a method of the pool
- f7927dae - winery: Make the directory-based shards pool usable
- 1eafb823 - winery: close read-only (and read-write) shards on shutdown
- 6337570a - winery: On shutdown, ensure that packer processes are waited for
- 1f90aae1 - winery: in storage fixture, use rbd_pool_name
- 2a42ea79 - winery: run deletion tests on both pool backends
- a714ab06 - winery settings: remove legacy kwargs
- 77f139bd - winery: bring documentation up to date with respect to the reality of the code
Toggle commit listJenkins job DOBJS/gitlab-builds #329 succeeded in 4 min 28 sec.
See Console Output, Blue Ocean and Coverage Report for more details.Jenkins job DOBJS/gitlab-builds #330 succeeded in 3 min 25 sec.
See Console Output, Blue Ocean and Coverage Report for more details.