Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage-manager): do not start when 'timestamping' is disabled #1219

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

J-Loudet
Copy link
Contributor

@J-Loudet J-Loudet commented Jul 5, 2024

All storage must have a timestamp associated with a Sample.

As it is possible to publish without adding a timestamp, it means that a Zenoh node must add this timestamp "at some point". Up until now, the default configuration of a router ('timestamping' enabled) combined with the fact that only routers could load plugins (and, thus, storage) made it so that a timestamp was (by default) always added.

Recent changes in Zenoh — namely the fact that not only routers can load plugins and that peers and client have, by default, the 'timestamping' configuration disabled — invalidate these assumptions.

We should then enforce at runtime, that the 'timestamping' configuration is enabled when attempting to load the storage manager.

This commit adds this check by verifying that there is an HLC associated with the Zenoh Session — the HLC is only created if 'timestamping' is enabled (see zenoh/zenoh/src/net/runtime/mod.rs::142).

  • plugins/zenoh-plugin-storage-manager/src/lib.rs: return an error if the storage manager is started while the configuration option 'timestamping' is disabled.
  • plugins/zenoh-plugin-storage-manager/tests/operations.rs: updated the config used in the test to enable 'timestamping'.
  • plugins/zenoh-plugin-storage-manager/tests/wildcard.rs: updated the config used in the test to enable 'timestamping'.

@J-Loudet J-Loudet requested a review from JEnoch July 5, 2024 08:35
@J-Loudet J-Loudet force-pushed the fix/prevent-storage-startup-no-timestamping branch 2 times, most recently from 8793146 to ad7063b Compare July 5, 2024 09:04
All storage must have a timestamp associated with a Sample.

As it is possible to publish without adding a timestamp, it means that a
Zenoh node must add this timestamp "at some point". Up until now, the
default configuration of a router ('timestamping' enabled) combined with
the fact that only routers could load plugins (and, thus, storage) made
it so that a timestamp was (by default) always added.

Recent changes in Zenoh — namely the fact that not only routers can load
plugins and that peers and client have, by default, the 'timestamping'
configuration disabled — invalidate these assumptions.

We should then enforce at runtime, that the 'timestamping' configuration
is enabled when attempting to load the storage manager.

This commit adds this check by verifying that there is an HLC associated
with the Zenoh Session — the HLC is only created if 'timestamping' is
enabled (see `zenoh/zenoh/src/net/runtime/mod.rs::142`).

* plugins/zenoh-plugin-storage-manager/src/lib.rs: return an error if
  the storage manager is started while the configuration option
  'timestamping' is disabled.
* plugins/zenoh-plugin-storage-manager/tests/operations.rs: updated
  the `config` used in the test to enable 'timestamping'.
* plugins/zenoh-plugin-storage-manager/tests/wildcard.rs: updated the
  `config` used in the test to enable 'timestamping'.

Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
@J-Loudet J-Loudet force-pushed the fix/prevent-storage-startup-no-timestamping branch from ad7063b to 016d759 Compare July 5, 2024 09:23
@Charles-Schleich
Copy link
Member

LGTM.
Related Issue on RocksDB: eclipse-zenoh/zenoh-backend-rocksdb#129

@JEnoch JEnoch merged commit 6df74c7 into dev/1.0.0 Jul 7, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants