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

feature(views-with-tablets): enable testing materialized views with tablets #9615

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

wmitros
Copy link
Contributor

@wmitros wmitros commented Dec 24, 2024

We plan to disallow materialized views in tablet keyspaces, until the remaining issues with them
are resolved. For that, we've introduced the "views-with-tablets" experimental feature, so that
they can be enabled regardless, for example for testing. Currently, the feature has no effect,
but we want to prepare the cluster tests to use it, so that they won't start failing when it
starts actually having an effect.

While improving views with tablets, we should make sure that the existing tests keep passing,
so we should run materialized view (and index) tests with tablets using the experimental feature.

The feature doesn't affect tests ran on vnodes. For tablets, the tests would fail without the feature
due to unsupported configuration.

Considering that, we should enable the feature by default for all tests running on 2025.1 or later.

The change includes:

  • adjusting experimental_features based on scylla version in sct_config, setting the new feature
    when running on 2025.1 or later
  • adding a new parameter "enable_views_with_tablets_on_upgrade". When it's set, we enable the new
    feature in upgrade_test.py after upgrading a node. Currently, there are no upgrade tests to 2025.1,
    so it isn't used
  • adding a config file configurations/enable_views_with_tablets_on_upgrade.yaml that enables the
    mentioned parameter without setting an env variable

@wmitros wmitros added the backport/none Backport is not required label Dec 24, 2024
@wmitros
Copy link
Contributor Author

wmitros commented Dec 24, 2024

Looks like yaml tests aren't using the default configurations, fixed in rebase

@wmitros
Copy link
Contributor Author

wmitros commented Jan 7, 2025

Refs scylladb/scylladb#21832

@piodul
Copy link
Contributor

piodul commented Jan 13, 2025

@wmitros why is this PR a draft? What is missing?

@wmitros wmitros marked this pull request as ready for review January 13, 2025 10:39
@wmitros
Copy link
Contributor Author

wmitros commented Jan 13, 2025

@wmitros why is this PR a draft? What is missing?

I think it's ready, forgot to change the type

@wmitros wmitros requested a review from fruch January 13, 2025 22:00
@@ -110,6 +110,8 @@ skip_download: false
authenticator_user: ''
authenticator_password: ''

experimental_features: ['views-with-tablets']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Materialized views are currently not allowed in tablet keyspaces, due to some
pending issues. However, they can be enabled using the "views-with-tablets" experimental feature.

This is not technically true, they can be created in tablet keyspaces right now but we want to forbid this. We introduced an experimental feature first, now we want to adjust the test and, finally, we will forbid creating materialized views without the experimental feature being enabled.

Just clarifying so that other reviewers won't get confused why tests that use MVs are still working. I recommend updating the description.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing upgrades to future versions, we'll need to
keep the experimental_feature also for base version, with an exception for sequential upgrades,
(currently we only have 2021.1->2022.1->2023.1 test in test_custom_profile_sequential_rolling_upgrade)
where the base version of the sequence might not have this experimental feature, so we'll need
to adjust it accordingly.

It would be great if the feature were enabled programmatically for the base version as well, but I'm not familiar with SCT enough to tell you how to do that. @fruch perhaps you will know?

If it's not feasible, alternatively you could add a comment near the experimental_features key which explains when the views-with-tablets feature needs to be provided and when not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Materialized views are currently not allowed in tablet keyspaces, due to some
pending issues. However, they can be enabled using the "views-with-tablets" experimental feature.

This is not technically true, they can be created in tablet keyspaces right now but we want to forbid this.

I updated the description for the current state

It would be great if the feature were enabled programmatically for the base version as well, but I'm not familiar with SCT enough to tell you how to do that. @fruch perhaps you will know?

I'm not sure there is such a way in general for all tests. I saw that when tablets were introduced, we added a enable_tablets_on_upgrade config option that we used on specific test pipelines - we could probably do something like that here as well, but currently no tests would use it, as we don't have tests for upgrading to 2025.1, and the developers that were adding these tests would have to remember about it.

If it's not feasible, alternatively you could add a comment near the experimental_features key which explains when the views-with-tablets feature needs to be provided and when not.

For now I added a comment for the experimental_features configuration option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only downside of using this in default for everything, that is gonna block people from using older versions

And it's gonna waste lots of people's time,

We are using older releases during development

I think this is different from the regular extra configuration in scylla yaml that wasn't there before, and existence of it does not break anything

I think moving it into the with the same version logic you used in upgrade tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Older versions of scylla which do not support this experimental feature will not recognize it, and will fail to start. If we are using SCT with older versions of scylla then it sounds like it will be a problem.

@fruch is there a way to adjust the configuration programmatically?

I found an old PR which removed the experimental "tablets" feature from SCT (#7512). It looks like the approach there was to modify Jenkinsfiles (configurations/raft/enable_raft_experimental.yaml). Would it be a viable approach here instead of adding "views-with-tablets" to the list of default features?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piodul
I agree with @fruch that defaults must not limit us to only one scylla version.
For example, I use various scylla versions with the master SCT branch all the time.

Yes, additional small file in the configurations is good solution.

Also, note that each CI job can be provided with the updated SCT config option in the jenkins pipeline extra_environment_variables parameter.
One of the recent examples:
Screenshot from 2025-01-16 20-08-09

In this case it is not needed to update SCT configs.

So, choose whatever fits your needs better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, today I was hit with the same problem in test/cqlpy/run's "--release" feature which is supposed to allow running old versions of Scylla, but the newly added views-with-tablets doesn't work on old versions. My fix is scylladb/scylladb#22350. Basically test/cqlpy/run.py has a rather-ugly list of configuration "overrides", specific options that need to be added or removed from specific past versions. This list is ugly, but isn't long or hard, and I'm rather please with the power it gives me to run tests against old versions (e.g., just today in scylladb/scylladb#22354 I wrote a test and then ran it against 10 different versions of Scylla).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piodul

there two place we can do it programmatically:

  1. in proposed_scylla_yaml, where we read append_scylla_yaml and use it
  2. in sct_config.py after sct_config.get_version_based_on_conf() is called, and we have the version information

the first is the simplest, but it's buried in not so clear place
the 2nd might be better and clear place for more changes per release we need to do in SCT configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. in sct_config.py after sct_config.get_version_based_on_conf() is called, and we have the version information

I added a new method for changing the config based on the release in sct_config.py after sct_config.get_version_based_on_conf(), please take a look

upgrade_test.py Outdated
version = ComparableScyllaVersion(self.scylla_version)
if self.is_enterprise and version >= "2025.1.0~dev" or not self.is_enterprise and version >= "6.3.0~dev":
scylla_yaml_updates.update({"experimental_features": ["views-with-tablets"]})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need something similar in _rollback_node, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed we reused the original scylla.yaml after rollback because we don't revert other updates (like enable_tablets) to it either, but I don't see it explicitly so @scylladb/qa-maintainers please confirm or deny

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, someone need to cross check it in the code

Anyhow I would recommend appending to the flags, now the code is override anything that any might have put in there before

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wmitros wmitros force-pushed the forbid-tablet-mv branch 3 times, most recently from 573509a to 5f575d9 Compare January 15, 2025 22:08
upgrade_test.py Outdated Show resolved Hide resolved
@@ -110,6 +110,8 @@ skip_download: false
authenticator_user: ''
authenticator_password: ''

experimental_features: ['views-with-tablets']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piodul
I agree with @fruch that defaults must not limit us to only one scylla version.
For example, I use various scylla versions with the master SCT branch all the time.

Yes, additional small file in the configurations is good solution.

Also, note that each CI job can be provided with the updated SCT config option in the jenkins pipeline extra_environment_variables parameter.
One of the recent examples:
Screenshot from 2025-01-16 20-08-09

In this case it is not needed to update SCT configs.

So, choose whatever fits your needs better.

docs/configuration_options.md Outdated Show resolved Hide resolved
upgrade_test.py Outdated
version = ComparableScyllaVersion(self.scylla_version)
if self.is_enterprise and version >= "2025.1.0~dev" or not self.is_enterprise and version >= "6.3.0~dev":
scylla_yaml_updates.update({"experimental_features": ["views-with-tablets"]})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wmitros wmitros force-pushed the forbid-tablet-mv branch 4 times, most recently from 3553708 to 50162cd Compare January 19, 2025 23:12
@wmitros
Copy link
Contributor Author

wmitros commented Jan 19, 2025

In the new version I change the views-with-tablets feature to be enabled programmatically, based on the version.
I also added a new config parameter enable_view_with_tablets_on_upgrade to be used for 2025.1 upgrade tests

docs/configuration_options.md Outdated Show resolved Hide resolved
@@ -2770,6 +2776,10 @@ def update_argus_with_version(self, scylla_version: str, package_name: str):
except Exception as exc: # pylint: disable=broad-except
self.log.exception("Failed to save target Scylla version in Argus", exc_info=exc)

def update_config_based_on_version(self):
if self.is_enterprise and ComparableScyllaVersion(self.scylla_version) >= "2025.1.0~dev":
self['experimental_features'] = ['views-with-tablets']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we rather add the views-with-tablets feature to the list instead of overwriting it? What if there are other experimental features enabled there already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any test is currently using other experimental features, but it should be possible for new/manual tests. Added in rebase

dict(name="enable_views_with_tablets_on_upgrade", env="SCT_ENABLE_VIEWS_WITH_TABLETS_ON_UPGRADE", type=boolean,
help="Enables creating materialized views in keyspaces using tablets by adding an experimental feature."
"It should not be used when upgrading to versions before 2025.1 and it should be used for upgrades"
"where we create such views."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: one more indent on this line, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, pre-commit is requiring this indentation

…ablets

We plan to disallow materialized views in tablet keyspaces, until the remaining issues with them
are resolved. For that, we've introduced the "views-with-tablets" experimental feature, so that
they can be enabled regardless, for example for testing. Currently, the feature has no effect,
but we want to prepare the cluster tests to use it, so that they won't start failing when it
starts actually having an effect.

While improving views with tablets, we should make sure that the existing tests keep passing,
so we should run materialized view (and index) tests with tablets using the experimental feature.

The feature doesn't affect tests ran on vnodes. For tablets, the tests would fail without the feature
due to unsupported configuration.

Considering that, we should enable the feature by default for all tests running on 2025.1 or later.

The change includes:
* adjusting experimental_features based on scylla version in sct_config, setting the new feature
when running on 2025.1 or later
* adding a new parameter "enable_views_with_tablets_on_upgrade". When it's set, we enable the new
feature in upgrade_test.py after upgrading a node. Currently, there are no upgrade tests to 2025.1,
so it isn't used
* adding a config file configurations/enable_views_with_tablets_on_upgrade.yaml that enables the
mentioned parameter without setting an env variable
@piodul piodul requested a review from vponomaryov January 20, 2025 17:34
@piodul
Copy link
Contributor

piodul commented Jan 21, 2025

@fruch @vponomaryov please re-review - we need this to unblock scylladb/scylladb#22217, which is required for 2025.1

Copy link
Contributor

@fruch fruch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fruch fruch dismissed vponomaryov’s stale review January 21, 2025 19:28

request were resolved

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing is using this one, it's for doing things manual ?

do we want to leave a job that is using this ?

@fruch fruch merged commit 0ccab43 into scylladb:master Jan 21, 2025
6 checks passed
@Annamikhlin
Copy link

artifacts-centos9-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-centos9-test/87/
artifacts-rocky8-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-rocky8-test/88/

failed with error:

p:ERROR >     if 'views-with-tablets' not in self.get('experimental_features', []):
p:ERROR > TypeError: SCTConfiguration.get() takes 2 positional arguments but 3 were given
21:42:00  ERROR: script returned exit code 1

@wmitros / @fruch - could you please take a look? it's preventing from next to pass

wmitros added a commit to wmitros/scylla-cluster-tests that referenced this pull request Jan 21, 2025
…atures

Because the SCTConfiguration is also a dict, in
scylladb#9615 we used the
dict's `get` method with a default value to check the contents of the list
of experimental features (there may be none). However, SCTConfiguration
overrides this `get` method without allowing any defaults. As a result,
we called it with too many parameters.
We work around this in this patch by using an extra if.
@wmitros
Copy link
Contributor Author

wmitros commented Jan 21, 2025

artifacts-centos9-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-centos9-test/87/ artifacts-rocky8-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-rocky8-test/88/

failed with error:

p:ERROR >     if 'views-with-tablets' not in self.get('experimental_features', []):
p:ERROR > TypeError: SCTConfiguration.get() takes 2 positional arguments but 3 were given
21:42:00  ERROR: script returned exit code 1

@wmitros / @fruch - could you please take a look? it's preventing from next to pass

I posted #9894, I'm surprised this wasn't caught by CI

@fruch
Copy link
Contributor

fruch commented Jan 21, 2025

artifacts-centos9-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-centos9-test/87/ artifacts-rocky8-test - https://jenkins.scylladb.com/job/releng-testing/job/artifacts/job/artifacts-rocky8-test/88/
failed with error:

p:ERROR >     if 'views-with-tablets' not in self.get('experimental_features', []):
p:ERROR > TypeError: SCTConfiguration.get() takes 2 positional arguments but 3 were given
21:42:00  ERROR: script returned exit code 1

@wmitros / @fruch - could you please take a look? it's preventing from next to pass

I posted #9894, I'm surprised this wasn't caught by CI

you beat me in few minutes,

I've posted a fix as well (but with a unittest)
#9895

@fruch
Copy link
Contributor

fruch commented Jan 21, 2025

@wmitros

CI unittest test didn't cover it, cause it's a new functionality that was added

other test even if we would have run them (integration, or longevity) might miss that if we were running it with anything but master (CI doesn't run with master by default, it run with older releases)

@wmitros
Copy link
Contributor Author

wmitros commented Jan 21, 2025

@wmitros / @fruch - could you please take a look? it's preventing from next to pass

I posted #9894, I'm surprised this wasn't caught by CI

you beat me in few minutes,

I've posted a fix as well (but with a unittest) #9895

Adding a unittest seems useful, so I'll close mine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/none Backport is not required promoted-to-master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants