30
30
import org .apache .cassandra .schema .KeyspaceParams ;
31
31
import org .apache .cassandra .schema .ReplicationParams ;
32
32
33
- public class AuthSchemaInterceptor
33
+ import static net .bytebuddy .matcher .ElementMatchers .nameEndsWith ;
34
+
35
+ public class SystemDistributedReplicationInterceptor
34
36
{
35
37
private static final String SYSTEM_DISTRIBUTED_NTS_DC_OVERRIDE_PROPERTY = "cassandra.system_distributed_replication_dc_names" ;
36
38
private static final String SYSTEM_DISTRIBUTED_NTS_RF_OVERRIDE_PROPERTY = "cassandra.system_distributed_replication_per_dc" ;
@@ -53,22 +55,22 @@ public class AuthSchemaInterceptor
53
55
}
54
56
catch (Throwable t )
55
57
{
56
- LoggerFactory .getLogger (AuthSchemaInterceptor .class ).error ("Error parsing system distributed replication override properties" , t );
58
+ LoggerFactory .getLogger (SystemDistributedReplicationInterceptor .class ).error ("Error parsing system distributed replication override properties" , t );
57
59
}
58
60
59
61
if (rfOverride != null && !dcOverride .isEmpty ())
60
62
{
61
63
//Validate reasonable defaults
62
64
if (rfOverride <= 0 || rfOverride > 5 )
63
65
{
64
- LoggerFactory .getLogger (AuthSchemaInterceptor .class ).error ("Invalid value for {}" , SYSTEM_DISTRIBUTED_NTS_RF_OVERRIDE_PROPERTY );
66
+ LoggerFactory .getLogger (SystemDistributedReplicationInterceptor .class ).error ("Invalid value for {}" , SYSTEM_DISTRIBUTED_NTS_RF_OVERRIDE_PROPERTY );
65
67
}
66
68
else
67
69
{
68
70
for (String dc : dcOverride )
69
71
ntsOverride .put (dc , String .valueOf (rfOverride ));
70
72
71
- LoggerFactory .getLogger (AuthSchemaInterceptor .class ).info ("Using override for distributed system keyspaces: {}" , ntsOverride );
73
+ LoggerFactory .getLogger (SystemDistributedReplicationInterceptor .class ).info ("Using override for distributed system keyspaces: {}" , ntsOverride );
72
74
}
73
75
}
74
76
@@ -78,7 +80,9 @@ public class AuthSchemaInterceptor
78
80
79
81
public static ElementMatcher <? super TypeDescription > type ()
80
82
{
81
- return ElementMatchers .nameEndsWith (".AuthKeyspace" );
83
+ return nameEndsWith (".AuthKeyspace" )
84
+ .or (nameEndsWith (".TraceKeyspace" ))
85
+ .or (nameEndsWith (".SystemDistributedKeyspace" ));
82
86
}
83
87
84
88
public static AgentBuilder .Transformer transformer ()
@@ -88,7 +92,7 @@ public static AgentBuilder.Transformer transformer()
88
92
@ Override
89
93
public DynamicType .Builder <?> transform (DynamicType .Builder <?> builder , TypeDescription typeDescription , ClassLoader classLoader , JavaModule javaModule )
90
94
{
91
- return builder .method (ElementMatchers .named ("metadata" )).intercept (MethodDelegation .to (AuthSchemaInterceptor .class ));
95
+ return builder .method (ElementMatchers .named ("metadata" )).intercept (MethodDelegation .to (SystemDistributedReplicationInterceptor .class ));
92
96
}
93
97
};
94
98
}
0 commit comments