jaydeepkumar1984 commented on code in PR #4358:
URL: https://github.com/apache/cassandra/pull/4358#discussion_r2540191060


##########
src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java:
##########
@@ -678,6 +720,28 @@ private ResultMessage executeWithCondition(QueryState 
queryState, QueryOptions o
         }
     }
 
+    private ResultMessage executeWithStrictMVConsistency(QueryState 
queryState, QueryOptions options, Dispatcher.RequestTime requestTime)
+    {
+        // Strict MV consistency currently requires Paxos V2. Once additional 
transaction modes for strict MV are supported, we can relax this restriction.
+        assert metadata().params.transactionalMode == TransactionalMode.off && 
Paxos.useV2();
+        CQL3CasRequest request = makeCasRequest(queryState, options, 
requestTime);

Review Comment:
   Can we reuse _executeWithCondition_?



##########
src/java/org/apache/cassandra/db/ColumnFamilyStore.java:
##########
@@ -2637,6 +2611,39 @@ public void unloadCf()
             FBUtilities.waitOnFuture(dumpMemtable());
     }
 
+    public void checkQualifiedForStrictMVConsistency()
+    {
+        if (!DatabaseDescriptor.getMaterializedViewStrictConsistencyEnabled())
+        {
+            throw new InvalidRequestException("Not qualified for strict mv 
consistency because node level setting 
materialized_view_strict_consistency_enabled is disabled.");
+        }
+
+        if (Guardrails.instance.getMaterializedViewsPerTableFailThreshold() <= 
0)
+        {
+            throw new InvalidRequestException("Not qualified for strict mv 
consistency because maximum number of MVs per table is not set.");
+        }
+
+        if (viewManager.size() > 
Guardrails.instance.getMaterializedViewsPerTableFailThreshold())
+        {
+            throw new InvalidRequestException(String.format("Not qualified for 
strict mv consistency because base table has %s MVs which is more than limit: 
%s", viewManager.size(), 
Guardrails.instance.getMaterializedViewsPerTableFailThreshold()));
+        }
+        if (metric.viewBaseTableModificationWithTimestamp.getCount() > 0 ||
+            metric.viewBaseTableUsedInBatchStatement.getCount() > 0 ||
+            
metric.viewBaseTableDeleteStatementWithoutFullPrimaryKey.getCount() > 0 ||
+            metric.viewBaseTableInRestirctionsUsed.getCount() > 0)
+        {
+            throw new InvalidRequestException(
+            String.format("Not qualified for strict mv consistency because 
base table has non-LWT compatible queries, " +
+                          "modification with ts: %s, batch statement: %s, 
delete without full primary key: %s, IN restrictions " +

Review Comment:
   Replace "%s" with "%d"



##########
src/java/org/apache/cassandra/schema/SchemaKeyspace.java:
##########
@@ -626,6 +627,9 @@ public static void addTableParamsToRowBuilder(TableParams 
params, Row.SimpleBuil
         {
             builder.add("auto_repair", params.autoRepair.asMap());
         }
+
+        if (DatabaseDescriptor.getMaterializedViewStrictConsistencyEnabled() 
&& !forView)
+            builder.add("strict_mv_consistency", params.strictMVConsistency);

Review Comment:
   nit: parenthesis



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to