This is an automated email from the ASF dual-hosted git repository.

samt pushed a commit to branch cep-21-tcm
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit e4fc7e9d1ba79d49918f7bc3be138cd8d3c0271f
Author: Sam Tunnicliffe <[email protected]>
AuthorDate: Wed Mar 15 13:41:58 2023 +0000

    [CEP-21] Dereference TableMetadata in simple partition builder
    
    patch by Sam Tunnicliffe; reviewed by Alex Petrov and Marcus Eriksson
    for CASSANDRA-18418
---
 src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java 
b/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
index 0180818d19..6a97fb65c0 100644
--- a/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
+++ b/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java
@@ -546,7 +546,14 @@ public class PartitionUpdate extends AbstractBTreePartition
      */
     public static SimpleBuilder simpleBuilder(TableMetadata metadata, 
Object... partitionKeyValues)
     {
-        return new SimpleBuilders.PartitionUpdateBuilder(metadata, 
partitionKeyValues);
+        // Here we dereference the current version of the supplied 
TableMetadata. The reason for this is that in some
+        // places we still reference static TableMetadata instances.
+        // For instance, TraceKeyspace contains Sessions & Events static 
members which are created at startup when the
+        // current epoch is Epoch.EMPTY. These are used to construct mutations 
when tracing is enabled and when the
+        // mutations are serialised and sent between replica & coordinator the 
epoch comparisons in PartitionUpdate
+        // deserializer trigger an IncompatibleSchemaException.
+        // TODO ultimately remove the use of static TableMetadata instances in 
System/Tracing/Auth keyspaces.
+        return new SimpleBuilders.PartitionUpdateBuilder(metadata.ref.get(), 
partitionKeyValues);
     }
 
     public void validateIndexedColumns()


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

Reply via email to