Skip to content

Commit

Permalink
CBQE-7591: Removing support for 'can_abort_rebalace' in auto_fo settings
Browse files Browse the repository at this point in the history
Change-Id: I178115720190c0b5e9238c68a3e90071786cef5c
Reviewed-on: https://review.couchbase.org/c/testrunner/+/174192
Tested-by: Balakumaran G <balakumaran.gopal@couchbase.com>
Reviewed-by: Balakumaran G <balakumaran.gopal@couchbase.com>
  • Loading branch information
ashwin2002 authored and bkumaran committed Apr 26, 2022
1 parent c36b92f commit c68685f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
18 changes: 8 additions & 10 deletions lib/membase/api/rest_client.py
Expand Up @@ -3072,24 +3072,22 @@ def get_autofailover_settings(self):
settings.enabled = json_parsed["enabled"]
settings.count = json_parsed["count"]
settings.timeout = json_parsed["timeout"]
settings.failoverOnDataDiskIssuesEnabled = json_parsed["failoverOnDataDiskIssues"]["enabled"]
settings.failoverOnDataDiskIssuesTimeout = json_parsed["failoverOnDataDiskIssues"]["timePeriod"]
settings.failoverOnDataDiskIssuesEnabled = \
json_parsed["failoverOnDataDiskIssues"]["enabled"]
settings.failoverOnDataDiskIssuesTimeout = \
json_parsed["failoverOnDataDiskIssues"]["timePeriod"]
settings.maxCount = json_parsed["maxCount"]
if json_parsed["canAbortRebalance"]:
settings.can_abort_rebalance = json_parsed["canAbortRebalance"]
return settings

def update_autofailover_settings(self, enabled, timeout, canAbortRebalance=False, enable_disk_failure=False,
def update_autofailover_settings(self, enabled, timeout,
enable_disk_failure=False,
disk_timeout=120, maxCount=1):
params_dict = {}
params_dict = dict()
params_dict['timeout'] = timeout
if enabled:
params_dict['enabled'] = 'true'

else:
params_dict['enabled'] = 'false'
if canAbortRebalance:
params_dict['canAbortRebalance'] = 'true'
if enable_disk_failure:
params_dict['failoverOnDataDiskIssues[enabled]'] = 'true'
params_dict['failoverOnDataDiskIssues[timePeriod]'] = disk_timeout
Expand Down Expand Up @@ -6276,6 +6274,7 @@ def minor_version(self):
def cluster_ip(self):
return self.internal_ip or self.ip


class AutoFailoverSettings(object):
def __init__(self):
self.enabled = True
Expand All @@ -6284,7 +6283,6 @@ def __init__(self):
self.failoverOnDataDiskIssuesEnabled = False
self.failoverOnDataDiskIssuesTimeout = 0
self.maxCount = 1
self.can_abort_rebalance = False


class AutoReprovisionSettings(object):
Expand Down
6 changes: 2 additions & 4 deletions pytests/ent_backup_restore/enterprise_backup_restore_test.py
Expand Up @@ -3919,7 +3919,7 @@ def test_backup_logs_for_keywords(self):
2. Scan backup logs for bad keywords.
Keywords:
1. CBQE-6034/MB-41131 - Check cbbackupmgr's build version/hash set correctly at build time
1. CBQE-6034/MB-41131 - Check cbbackupmgr's build version/hash set correctly at build time
by scanning for 'cbbackupmgr version Unknown' in the logs.
2. Scan for 'panic' in the logs.
"""
Expand Down Expand Up @@ -4116,8 +4116,7 @@ def test_bkrs_logs_when_no_mutations_received(self):
"Version was run with {}".format(version))

rest_conn = RestConnection(self.backupset.cluster_host)
rest_conn.update_autofailover_settings(enabled=False,
timeout=0)
rest_conn.update_autofailover_settings(enabled=False, timeout=0)

gen = BlobGenerator("ent-backup", "ent-backup-", self.value_size,
end=self.num_items)
Expand Down Expand Up @@ -5329,4 +5328,3 @@ def output_logs(flag_depth, use_json, all_flag):
backup=back_name, collection_string=buck_name, all_flag=all_flag))
print_tree(buck)
check_buck(buck)

12 changes: 6 additions & 6 deletions pytests/failover/AutoFailoverAbortsRebalance.py
Expand Up @@ -63,7 +63,7 @@ def suite_setUp(self):
pass

def test_failure_scenarios_during_rebalance_in_of_node_A(self):
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
self.sleep(5)
# Start rebalance in
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_failure_scenarios_during_rebalance_in_of_node_A(self):

def test_failure_scenarios_during_recovery_of_node_A(self):
self.recovery_type = self.input.param("recovery_type", 'full')
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
self.sleep(5)
# do a graceful failover
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_failure_scenarios_during_recovery_of_node_A(self):
self.disable_autofailover_and_validate()

def test_failure_scenarios_during_rebalance_out_of_node_A(self):
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
self.sleep(5)
# Start rebalance out
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_failure_scenarios_during_rebalance_out_of_node_A(self):
self.disable_autofailover_and_validate()

def test_failure_scenarios_during_rebalance_out_of_failedover_node_A(self):
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
# failover a node
self.cluster.failover([self.master], failover_nodes=[self.servers[self.server_index_to_fail]], graceful=False)
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_failure_scenarios_during_rebalance_out_of_failedover_node_A(self):

def test_failure_scenarios_during_rebalance_out_of_failedover_other_than_node_A(self):
self.server_index_to_failover = self.input.param("server_index_to_failover", None)
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
# failover a node
self.cluster.failover([self.master], failover_nodes=[self.servers[self.server_index_to_failover]],
Expand Down Expand Up @@ -226,7 +226,7 @@ def test_failure_scenarios_during_rebalance_out_of_failedover_other_than_node_A(
def test_failure_scenarios_during_recovery_of_node_other_than_node_A(self):
self.server_index_to_failover = self.input.param("server_index_to_failover", None)
self.recovery_type = self.input.param("recovery_type", 'full')
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
self.sleep(5)
# do a graceful failover
Expand Down
11 changes: 2 additions & 9 deletions pytests/failover/AutoFailoverBaseTest.py
Expand Up @@ -155,9 +155,7 @@ def enable_autofailover(self):
:return: True If the setting was set with the timeout, else return
False
"""
status = self.rest.update_autofailover_settings(True,
self.timeout,
self.can_abort_rebalance,
status = self.rest.update_autofailover_settings(True, self.timeout,
maxCount=self.max_count)
return status

Expand All @@ -167,7 +165,7 @@ def disable_autofailover(self):
:return: True If the setting was disabled, else return
False
"""
status = self.rest.update_autofailover_settings(False, 120, False)
status = self.rest.update_autofailover_settings(False, 120)
return status

def enable_autofailover_and_validate(self):
Expand All @@ -186,10 +184,6 @@ def enable_autofailover_and_validate(self):
"Incorrect timeout set. Expected timeout : {0} "
"Actual timeout set : {1}".format(self.timeout,
settings.timeout))
self.assertEqual(self.can_abort_rebalance, settings.can_abort_rebalance,
"Incorrect can_abort_rebalance set. Expected can_abort_rebalance : {0} "
"Actual can_abort_rebalance set : {1}".format(self.can_abort_rebalance,
settings.can_abort_rebalance))

def disable_autofailover_and_validate(self):
"""
Expand Down Expand Up @@ -589,7 +583,6 @@ def _get_params(self):
"delta")
self.multi_node_failures = self.input.param("multi_node_failures",
False)
self.can_abort_rebalance = self.input.param("can_abort_rebalance", True)
self.num_node_failures = self.input.param("num_node_failures", 1)
self.deny_autofailover = self.input.param("deny_autofailover", None)
self.services = self.input.param("services", None)
Expand Down
5 changes: 2 additions & 3 deletions pytests/gsi/gsi_autofailover.py
Expand Up @@ -96,14 +96,13 @@ def test_failed_rebalance_with_gsi_autofailover(self):
self.buckets = self.rest.get_buckets()
self.prepare_collection_for_indexing(num_of_docs_per_collection=10 ** 5)
self._create_indexes()
# enable auto failover and canAbortRebalance
# enable auto failover
self.enable_autofailover_and_validate()
# Start rebalance in
rebalance_task = self.cluster.async_rebalance(servers=self.servers,
to_add=self.servers_to_add,
to_remove=self.servers_to_remove,
services=['kv', 'index']
)
services=['kv', 'index'])
self.sleep(20)
reached = RestHelper(self.rest).rebalance_reached(percentage=20)
self.assertTrue(reached, "Rebalance failed or did not reach {0}%".format(20))
Expand Down

0 comments on commit c68685f

Please sign in to comment.