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

refactor(nemesis): modified compaction strategies related nemeses #9913

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timtimb0t
Copy link
Contributor

@timtimb0t timtimb0t commented Jan 24, 2025

modify_table_twcs_window_size nemesis modified to test twcs strategy in wider borders
modify_table_compaction nemesis modified for the same purposes.

Both collected in single commit due to modify_table_twcs_window_size nemesis depends on modify_table_compaction (ie modify_table_compaction nemesis adds randomness that should affect modify_table_twcs_window_size)

refs: 9361, 9362

fixes: #9361, #9362

Testing

https://jenkins.scylladb.com/view/staging/job/scylla-staging/job/eugene_test_folder/job/twcs_cluster_without_changes/59/

PR pre-checks (self review)

  • I added the relevant backport labels
  • I didn't leave commented-out/debugging code

Reminders

  • Add New configuration option and document them (in sdcm/sct_config.py)
  • Add unit tests to cover my changes (under unit-test/ folder)
  • Update the Readme/doc folder relevant to this change (if needed)

@timtimb0t timtimb0t force-pushed the modify_compaction_strategies branch 2 times, most recently from e8b0b64 to 201fe69 Compare January 24, 2025 14:26
@timtimb0t timtimb0t changed the title refactor(nemesis): modified modify_table_twcs_window_size nemesis to … refactor(nemesis): modified compaction strategies related nemeses Jan 24, 2025
@timtimb0t timtimb0t force-pushed the modify_compaction_strategies branch from 201fe69 to 6ab5ec1 Compare January 25, 2025 14:52
Copy link
Contributor

@temichus temichus left a comment

Choose a reason for hiding this comment

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

cosmetic changes.
this PR need several test runs before merging due to the random nature

sdcm/nemesis.py Outdated
'min_threshold': 4,
'max_threshold': 32,
},
def calculate_strategy_params(strategy_class):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think. method calculate_strategy_params and "Dict strategies" are unnecessary here
you can use "list strategies" as previously, just extend it with lambda and random

if (current_size // 24) > 2:
current_unit = "DAYS"
current_size = 3
compaction = settings["compaction"]
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary change value "compaction" is not used rather than the next 2 lines

sdcm/nemesis.py Outdated
"gc": 864000,
"dttl": 86400}

""" Adjust window unit and size with random increments in acceptable borders,
Copy link
Contributor

Choose a reason for hiding this comment

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

That is too short comment for such function

sdcm/nemesis.py Outdated
"DAYS": 365,
}

random_escalation_sizes = {
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary dict

sdcm/nemesis.py Outdated
"DAYS": (2, 14),
}

def escalate_unit(unit: str) -> (str, int):
Copy link
Contributor

Choose a reason for hiding this comment

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

can be just Dict instead of functions with if-elif-else statement

current_size = int(settings["compaction"].get("compaction_window_size") or 1) # default value
multiplier = 3600 if current_unit in ["DAYS", "HOURS"] else 60
self.log.debug("Initial twcs settings are: %s", settings)
MAX_TTL = 4_300_000 # ~49 days in seconds
expected_sstable_number = 35
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't understand why previous logic has hardcoded the number 35.

sdcm/nemesis.py Outdated
if proposed_ttl > MAX_TTL:
# Recalculate a smaller window size so we do not exceed MAX_TTL
# integer division to keep it safe
max_size = MAX_TTL // (multiplier * expected_sstable_number)
Copy link
Contributor

Choose a reason for hiding this comment

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

current_size = MAX_TTL // (multiplier * expected_sstable_number)
if max_size < 1:
    current_size = 1

sdcm/nemesis.py Outdated
settings["gc"] = proposed_ttl // 2
settings["dttl"] = proposed_ttl

compaction["compaction_window_unit"] = current_unit
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary change

@timtimb0t timtimb0t force-pushed the modify_compaction_strategies branch 5 times, most recently from 461a353 to c639b95 Compare February 2, 2025 17:22
 modify_table_twcs_window_size nemesis to set twcs borders  in wider range.
modified modify_table_compaction nemesis to set compaction strategies params in
wider range to adjust test coverage.
refs: 9361, 9362
@timtimb0t timtimb0t force-pushed the modify_compaction_strategies branch from c639b95 to 18f775d Compare February 2, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants