Skip to content

Commit

Permalink
Extend maximum expiration date
Browse files Browse the repository at this point in the history
  • Loading branch information
bereng committed Oct 25, 2022
1 parent 010f7ce commit 918b1dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client_request_metrics_local_remote_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_batch_and_slice(self):
# Run batch test:
query = 'BEGIN BATCH '
for i in murmur3_hashes.keys():
for y in range(0, 50):
for y in range(0, 40):
query += "INSERT INTO ks.test (id, ord, val) VALUES ({}, {}, 'aaa')".format(i, y)
query += 'APPLY BATCH;'
session.execute(query)
Expand Down
20 changes: 17 additions & 3 deletions ttl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,20 @@ def test_expiration_overflow_policy_reject(self):
def test_expiration_overflow_policy_reject_default_ttl(self):
self._base_expiration_overflow_policy_test(default_ttl=True, policy='REJECT')

@since('4.2')
def test_expiration_overflow_policy_none(self):
self._base_expiration_overflow_policy_test(default_ttl=False, policy='NONE')

@since('4.2')
def test_expiration_overflow_policy_none_default_ttl(self):
self._base_expiration_overflow_policy_test(default_ttl=True, policy='NONE')

def _base_expiration_overflow_policy_test(self, default_ttl, policy):
"""
Checks that expiration date overflow policy is correctly applied
@jira_ticket CASSANDRA-14092
@jira_ticket CASSANDRA-14092 and CASSANDRA-14227
Notice this is using the legacy 20y limitation. Newer versions support up to 68y
"""
MAX_TTL = 20 * 365 * 24 * 60 * 60 # 20 years in seconds
default_time_to_live = MAX_TTL if default_ttl else None
Expand Down Expand Up @@ -402,7 +412,7 @@ def _base_expiration_overflow_policy_test(self, default_ttl, policy):
assert_row_count(self.session1, 'ttl_table', 0 if policy == 'REJECT' else 1)

# Check that warning is always logged, unless policy is REJECT
if policy != 'REJECT':
if policy != 'REJECT' and policy != 'NONE':
node1 = self.cluster.nodelist()[0]
prefix = 'default ' if default_ttl else ''
warning = node1.grep_log("Request on table {}.{} with {}ttl of {} seconds exceeds maximum supported expiration"
Expand Down Expand Up @@ -599,7 +609,11 @@ def test_recover_negative_expiration_date_sstables_with_scrub(self):
node.watch_log_for('Loading new SSTables', timeout=10)

logger.debug("Check that there are no rows present")
assert_row_count(session, 'ttl_table', 0)
# CASSANDRA-14227 4.2 upwards we have long TTL that can read overflowed rows
if self.cluster.version() >= '4.2':
assert_row_count(session, 'ttl_table', 1)
else:
assert_row_count(session, 'ttl_table', 0)

logger.debug("Shutting down node")
self.cluster.stop()
Expand Down
7 changes: 4 additions & 3 deletions upgrade_tests/upgrade_through_versions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ def upgrade_scenario(self, populate=True, create_schema=True, rolling=False, aft

self.upgrade_to_version(version_meta, partial=True, nodes=(node,), internode_ssl=internode_ssl)

logger.debug(str(self.fixture_dtest_setup.subprocs))
self._check_on_subprocs(self.fixture_dtest_setup.subprocs)
logger.debug('Successfully upgraded %d of %d nodes to %s' %
(num + 1, len(self.cluster.nodelist()), version_meta.version))
Expand Down Expand Up @@ -488,7 +489,7 @@ def _check_on_subprocs(self, subprocs):
if not all(subproc_statuses):
message = "A subprocess has terminated early. Subprocess statuses: "
for s in subprocs:
message += "{name} (is_alive: {aliveness}), ".format(name=s.name, aliveness=s.is_alive())
message += "{name} (is_alive: {aliveness}, exitCode: {exitCode}), ".format(name=s.name, aliveness=s.is_alive(), exitCode=s.exitcode)
message += "attempting to terminate remaining subprocesses now."
self._terminate_subprocs()
raise RuntimeError(message)
Expand Down Expand Up @@ -653,7 +654,7 @@ def _start_continuous_write_and_verify(self, wait_for_rowcount=0, max_wait_s=600
# queue of verified writes, which are update candidates
verification_done_queue = Queue(maxsize=500)

writer = Process(target=data_writer, args=(self, to_verify_queue, verification_done_queue, 25))
writer = Process(name="data_writer", target=data_writer, args=(self, to_verify_queue, verification_done_queue, 25))
# daemon subprocesses are killed automagically when the parent process exits
writer.daemon = True
self.fixture_dtest_setup.subprocs.append(writer)
Expand All @@ -662,7 +663,7 @@ def _start_continuous_write_and_verify(self, wait_for_rowcount=0, max_wait_s=600
if wait_for_rowcount > 0:
self._wait_until_queue_condition('rows written (but not verified)', to_verify_queue, operator.ge, wait_for_rowcount, max_wait_s=max_wait_s)

verifier = Process(target=data_checker, args=(self, to_verify_queue, verification_done_queue))
verifier = Process(name="data_checker", target=data_checker, args=(self, to_verify_queue, verification_done_queue))
# daemon subprocesses are killed automagically when the parent process exits
verifier.daemon = True
self.fixture_dtest_setup.subprocs.append(verifier)
Expand Down

0 comments on commit 918b1dc

Please sign in to comment.