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

CASSANDRA-16183 #1

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Open

CASSANDRA-16183 #1

wants to merge 10 commits into from

Conversation

aholmberg
Copy link
Owner

No description provided.

client_request_metrics_test.py Outdated Show resolved Hide resolved
client_request_metrics_test.py Show resolved Hide resolved
client_request_metrics_test.py Show resolved Hide resolved
Comment on lines 115 to 120
global_diff, cl_diff = self.validate_nominal('Write',
WriteMetrics,
SimpleStatement(f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0)", consistency_level=CL.ONE),
query_count)

assert global_diff['MutationSizeHistogram.Count'] == query_count

Choose a reason for hiding this comment

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

We could easily test all valid consistency levels here, instead on only CL.ONE:

Suggested change
global_diff, cl_diff = self.validate_nominal('Write',
WriteMetrics,
SimpleStatement(f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0)", consistency_level=CL.ONE),
query_count)
assert global_diff['MutationSizeHistogram.Count'] == query_count
query = f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0)"
for cl in (CL.LOCAL_ONE, CL.ONE, CL.TWO, CL.ALL, CL.ANY, CL.LOCAL_QUORUM):
global_diff, cl_diff = self.validate_nominal('Write',
WriteMetrics,
SimpleStatement(query, consistency_level=cl),
query_count)

Comment on lines 124 to 127
self.validate_nominal('Read',
ClientRequestMetrics,
SimpleStatement(f"SELECT k FROM {KEYSPACE}.{TABLE} WHERE k=0 AND c=0", consistency_level=CL.LOCAL_ONE),
query_count)

Choose a reason for hiding this comment

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

Here we could also test more consistency levels:

Suggested change
self.validate_nominal('Read',
ClientRequestMetrics,
SimpleStatement(f"SELECT k FROM {KEYSPACE}.{TABLE} WHERE k=0 AND c=0", consistency_level=CL.LOCAL_ONE),
query_count)
query = f"SELECT k FROM {KEYSPACE}.{TABLE} WHERE k=0 AND c=0"
for cl in (CL.LOCAL_ONE, CL.ONE, CL.TWO, CL.ALL, CL.LOCAL_QUORUM):
self.validate_nominal('Read',
ClientRequestMetrics,
SimpleStatement(query, consistency_level=cl),
query_count)

client_request_metrics_test.py Outdated Show resolved Hide resolved

def write_failures_variant(self, scope, constraint, query_count, validator, metric_class):
validator = self.validate_metric if validator is None else validator
query_cl = CL.ONE

Choose a reason for hiding this comment

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

We could pass the consistency level as an argument so the two callers can test different CLs.

return diff

def write_unavailables(self):
query_cl = CL.THREE

Choose a reason for hiding this comment

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

We could add a short comment indicating that the writes are unavailable because the replication factor is 2.

for _ in range(query_count):
try:
self.session.execute(statement)
# self.session.execute(statement, execution_profile=exe_profile, timeout=20)

Choose a reason for hiding this comment

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

I guess this is a leftover from previous changes

def cas_write_failures(self):
query_count = 2
diff = self.write_failures_variant('CASWrite', f"WHERE k={new_key()} AND c=0 IF v!=0",
query_count,

Choose a reason for hiding this comment

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

Nit: misaligned

Suggested change
query_count,
query_count,

'Unavailables',
Unavailable
)
self.start_cluster()

Choose a reason for hiding this comment

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

I think we can use just node2.start. The JVM properties that we pass in start_cluster can be placed in a static property to be reused here. If we do so there would be a single call to the start_cluster method in setup_once, so we could get rid of start_cluster. WDYT?

Comment on lines 438 to 440
# The way we're failing writes causes a StorageProxy::cas to throw before the metric is
# incremented on each request after the first one. We find the previous ballot in-progress and fail trying to
# commit it.

Choose a reason for hiding this comment

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

Suggested change
# The way we're failing writes causes a StorageProxy::cas to throw before the metric is
# incremented on each request after the first one. We find the previous ballot in-progress and fail trying to
# commit it.
# The way we're failing writes causes a StorageProxy::cas to throw before the metric is incremented on each
# request after the first one. We find the previous ballot in-progress and fail trying to commit it.

Copy link

@adelapena adelapena left a comment

Choose a reason for hiding this comment

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

I think I have finished my review. The new tests look good to me and I have only added a few minor suggestions.

Comment on lines 421 to 424
CASClientWriteRequestMetrics,
SimpleStatement(f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0) IF NOT EXISTS",
consistency_level=CL.ONE),
2)

Choose a reason for hiding this comment

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

Nit: alignement

Suggested change
CASClientWriteRequestMetrics,
SimpleStatement(f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0) IF NOT EXISTS",
consistency_level=CL.ONE),
2)
CASClientWriteRequestMetrics,
SimpleStatement(f"INSERT INTO {KEYSPACE}.{TABLE} (k,c) VALUES (0,0) IF NOT EXISTS",
consistency_level=CL.ONE),
2)

Comment on lines 430 to 436


Choose a reason for hiding this comment

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

Suggested change


def validate(self):
assert self.values['RateUnit'] == 'events/second'
for k,v in self.values.items():

Choose a reason for hiding this comment

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

Nit: missed space

Suggested change
for k,v in self.values.items():
for k, v in self.values.items():

assert all(isinstance(i, int) for i in l), k


k = 0

Choose a reason for hiding this comment

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

Super nit: we could rename k to something like current_key or last_key to avoid name shadowing on the methods before.


def is_histo_list(k, l):
# since these values change on sampling, we can only generally verify it takes the proper form
# there is a dedicated test to make sure the histogram behaves as expected.

Choose a reason for hiding this comment

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

We could also indicate here which test

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