Skip to content
Snippets Groups Projects

Winery settings refactorings

Merged Nicolas Dandrimont requested to merge olasd/swh-objstorage:mr/winery-config into master
4 unresolved threads

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

Pipeline #13998 passed

Pipeline passed for 198abe69 on olasd:mr/winery-config

Approved by

Merged by Nicolas DandrimontNicolas Dandrimont 1 month ago (Mar 14, 2025 5:29pm UTC)

Merge details

  • Changes merged into master with 198abe69.
  • Did not delete the source branch.

Pipeline #14013 passed

Pipeline passed for 198abe69 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • David Douard
    David Douard @douardda started a thread on commit 1a7e444b
  • 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):
    • I think I would prefer these types to be explicitly names XXXSettings (here PackerSettings) so it's clear what it is when manipulated outside of this settings module.

    • Author Maintainer

      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 like settings.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.

    • Please register or sign in to reply
  • David Douard
    David Douard @douardda started a thread on commit 1a7e444b
  • 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 a dict-based one (aka use attr instead of TypedDict 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).

    • Author Maintainer

      That, too, was my first instinct. I was concerned that it would make typing annoying for the polyglot shards pool RBDShardsPool/DirectoryShardsPool, so I went with the lighterweight TypedDict instead.

      I yearn for a typed config parser with a sensible interface, but...

    • Please register or sign in to reply
  • David Douard
  • David Douard
  • David Douard
    David Douard @douardda started a thread on an outdated change in commit bef4d9a6
  • 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).
  • David Douard
    David Douard @douardda started a thread on an outdated change in commit bef4d9a6
  • 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.
  • David Douard approved this merge request

    approved this merge request

  • Thanks a lot for this

  • 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

    Compare with previous version

  • Jenkins job DOBJS/gitlab-builds #329 succeeded in 4 min 28 sec.
    See Console Output, Blue Ocean and Coverage Report for more details.

  • added 2 commits

    • 67a32cc2 - winery: bring documentation up to date with respect to the reality of the code
    • 198abe69 - winery: improve typing and documentation of SharedBase

    Compare with previous version

  • Jenkins job DOBJS/gitlab-builds #330 succeeded in 3 min 25 sec.
    See Console Output, Blue Ocean and Coverage Report for more details.

  • merged manually

  • Please register or sign in to reply
    Loading