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 shadow indexing mode selection #6663

Merged
merged 2 commits into from
Oct 7, 2022

Conversation

VladLazar
Copy link
Contributor

@VladLazar VladLazar commented Oct 7, 2022

Cover letter

Previously, topic level overrides of remote read/write were not honoured
in some cases. For example, if remote write was enabled at the cluster
level (cloud_storage_enable_remote_write=true) and disabled at the topic
level (redpanda.remote.write=false), remote writes would still be
performed. This is due to a bug in the logic which chooses the SI mode:
if none of the topic level overrides are true,
'get_shadow_indexing_mode` returns a std::nullopt which causes the
default value of the properties to be used. The default value is
whatever the cluster level config is set to.

This PR fixes the issue and adds ducktape tests for the SI mode selection.

Backport Required

  • not a bug fix
  • issue does not exist in previous branches
  • papercut/not impactful enough to backport
  • v22.2.x
  • v22.1.x
  • v21.11.x

UX changes

  • Topic level overrides for remote read/write work in all cases now.

Release notes

Bug Fixes

  • Fix bug in remote read/write enablement. Topic level overrides are now respected in all cases.

@VladLazar VladLazar marked this pull request as ready for review October 7, 2022 09:30
def test_shadow_indexing_mode(self, cloud_storage_enable_remote_read,
cloud_storage_enable_remote_write,
topic_remote_read, topic_remote_write):
to_bool = lambda x: True if x == "true" else False
Copy link
Contributor

@abhijat abhijat Oct 7, 2022

Choose a reason for hiding this comment

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

nit: this could be simplified to:

Suggested change
to_bool = lambda x: True if x == "true" else False
to_bool = lambda x: x == "true"

or maybe even compare directly:

read = ret["redpanda.remote.read"][0] == "true"

Vlad Lazar added 2 commits October 7, 2022 12:57
Previously, topic level overrides of remote read/write were not honoured
in some cases. For example, if remote write was enabled at the cluster
level (cloud_storage_enable_remote_write=true) and disabled at the topic
level (redpanda.remote.write=false), remote writes would still be
performed. This is due to a bug in the logic which chooses the SI mode:
if none of the topic level overrides are true,
'get_shadow_indexing_mode` returns a std::nullopt which causes the
default value of the properties to be used. The default value is
whatever the cluster level config is set to.

This commit fixes the issue. Note that we may still return a
std::nullopt if both remote read and write are unspecified at the topic
level. This means that the topic will always follow the cluster level
remote read/write configuration.
@VladLazar
Copy link
Contributor Author

Changes in force-push:

  • Following a discussion with John, I realised that if the topic does not specify either remote read or write policies, it should always follow the cluster level configuration (even if it changes at a later point). I've updated the code to match this behaviour and added another ducktape test for it.
  • Made the new tests faster and cheaper.

@VladLazar VladLazar requested review from jcsp and abhijat October 7, 2022 12:04
@mmedenjak mmedenjak added kind/bug Something isn't working area/cloud-storage Shadow indexing subsystem and removed area/redpanda labels Oct 7, 2022
@VladLazar VladLazar merged commit 31ed4f8 into redpanda-data:dev Oct 7, 2022
@VladLazar
Copy link
Contributor Author

/backport v22.2.x

@VladLazar
Copy link
Contributor Author

/backport v22.1.x

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 5a13e8d6936cacb1a4dea06a9b13157ab36cf7af 55fd2bfdbe086f3576560477e9bbb0b3b6978334

Workflow run logs.

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 5a13e8d6936cacb1a4dea06a9b13157ab36cf7af 55fd2bfdbe086f3576560477e9bbb0b3b6978334

Workflow run logs.

@VladLazar
Copy link
Contributor Author

/backport v22.2.x

@VladLazar
Copy link
Contributor Author

/backport v22.1.x

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 5a13e8d6936cacb1a4dea06a9b13157ab36cf7af 55fd2bfdbe086f3576560477e9bbb0b3b6978334

Workflow run logs.

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 5a13e8d6936cacb1a4dea06a9b13157ab36cf7af 55fd2bfdbe086f3576560477e9bbb0b3b6978334

Workflow run logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cloud-storage Shadow indexing subsystem kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants