Skip to content

Conversation

Runtian
Copy link
Contributor

@Runtian Runtian commented Sep 3, 2025

This PR is for strict_mv_consistency that move MV base table update backed by LWT (Paxos V2).
It contains following changes:

  1. Add metrics for MV base table to determine if base table is qualified to be migrated to LWT backed use case (Those metrics are added for migration purpose if users want to migrate from non strict MV consistency to this new design, users need to make sure the metrics are good)
  2. Add table options to change the MV behavior to use strict MV consistency (strict_mv_consistency is introduced as a new table params for base table so it can be turned on and off)
  3. strict_mv_consistency enabled table will be updated with Paxos V2
  4. Paxos repair for strict_mv_consistency enabled table will replay MV mutations

The Cassandra Jira

Copy link
Contributor

@jaydeepkumar1984 jaydeepkumar1984 left a comment

Choose a reason for hiding this comment

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

I am continuing to review. In the meantime, here are some of the comments.

// When false, it behaves the same as normal streaming.
public volatile boolean materialized_views_on_repair_enabled = true;

public boolean materialized_view_base_table_metric_collection_enabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

add this new configurations to config/cassandra_latest.yaml


for (ModificationStatement statement : statements)
{
if (DatabaseDescriptor.getMaterializedViewsBasetableMetricCollectionEnabled())
Copy link
Contributor

Choose a reason for hiding this comment

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

These four lines are redundant at multiple places. I think it would be a good idea to create a wrapper for it.

SinglePartitionReadCommand readCommand = null;
if (isAcceptedButNotCommitted && table.strictMVEnabled() && !latestAccepted.update.isEmpty())
{
assert latestAccepted.update.rowCount() == 1 : "latest accepted with multiple rows: " + latestAccepted.update.rowCount();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this assertion even feasible in everyday situations? Or possible in case of bugs only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible in case of bugs only.

}
}

public static void getCurrentAndApplyMVMutations(SinglePartitionReadCommand query,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit; should we name this to something like, resolveCurrentAndApplyMVMutations, because "get" might confuse the people in that they would assume that it is doing a read RPC to get the current state, which is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants