Skip to content

Commit

Permalink
Remove query handler injection (#23)
Browse files Browse the repository at this point in the history
* Remove query handler injection

* Fix tests
  • Loading branch information
tjake authored Oct 26, 2020
1 parent a82c503 commit 28b41cd
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 166 deletions.
11 changes: 0 additions & 11 deletions src/main/java/com/datastax/mcac/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,12 @@
import com.datastax.mcac.interceptors.LegacyCompactionStartInterceptor;
import com.datastax.mcac.interceptors.DroppedMessageLoggingAdvice;
import com.datastax.mcac.interceptors.OptionsMessageInterceptor;
import com.datastax.mcac.interceptors.QueryHandlerInterceptor;
import com.datastax.mcac.interceptors.StartupMessageInterceptor;
import com.datastax.mcac.interceptors.TombstoneFailureInterceptor;
import com.datastax.mcac.interceptors.TombstoneWarningInterceptor;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.loading.ClassInjector;

import java.io.File;
import java.lang.instrument.Instrumentation;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;

import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.isSynthetic;
Expand Down Expand Up @@ -54,9 +46,6 @@ public static void premain(String arg, Instrumentation inst) throws Exception {
//Cassandra Daemon
.type(CassandraDaemonInterceptor.type())
.transform(CassandraDaemonInterceptor.transformer())
//Query Handler
.type(QueryHandlerInterceptor.type())
.transform(QueryHandlerInterceptor.transformer())
//Startup Message
.type(StartupMessageInterceptor.type())
.transform(StartupMessageInterceptor.transformer())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public static void warn(@AllArguments Object[] allArguments, @SuperCall Callable
if (matcher.matches() && matcher.groupCount() == 2)
{
String cqlQuery = matcher.group(2);
if (cqlQuery.indexOf(';') > 0)
cqlQuery = cqlQuery.substring(0, cqlQuery.indexOf(";"));

Object statement = QueryProcessor.class.getMethod("parseStatement", String.class).invoke(null, cqlQuery);

Method ks = statement.getClass().getMethod("keyspace");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,18 @@ private void writeData(
)
{
int rangeVal = 0;
for (int i = 1; i <= 10000; i++)
for (int i = 1; i <= 1000; i++)
{
session.execute(
"INSERT into foo.bar(key, k2, k3, value) VALUES (?, ?, ?, ?)", 0, i % 2 == 0 ? rangeVal++ : rangeVal, i, "1"
);
try
{
session.execute(
"INSERT into foo.bar(key, k2, k3, value) VALUES (?, ?, ?, ?)", 0, i % 2 == 0 ? rangeVal++ : rangeVal, i, "1"
);
}
catch (Throwable t)
{
//Timeout ok
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void readWriteData(
CompletableFuture write = CompletableFuture.runAsync(
() ->
{
for (int i = 0; i < 10000; i++)
for (int i = 0; i < 1000; i++)
{
try
{
Expand All @@ -148,7 +148,7 @@ private void readWriteData(
*/
if (version.equals("3.11") || version.equals("4.0"))
{
for (int i = 0; i < 10000; i++)
for (int i = 0; i < 1000; i++)
{
try
{
Expand Down
16 changes: 0 additions & 16 deletions src/test/java/com/datastax/mcac/EventsIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ public void testDriverMessage() throws IOException
.build();
Session session = cluster.connect();

session.execute("CALL InsightsRpc.reportInsight('{\n" +
" \"metadata\": {\n" +
" \"name\": \"driver.startup\",\n" +
" \"insightMappingId\": \"v1\",\n" +
" \"insightType\": \"EVENT\",\n" +
" \"timestamp\": 1542285611120,\n" +
" \"tags\": {\n" +
" \"language\": \"nodejs\"\n" +
" }\n" +
" },\n" +
" \"data\": {}" +
"}')");


session.execute("CREATE KEYSPACE foo with replication={'class': 'SimpleStrategy', 'replication_factor':3}");
session.execute("CREATE TABLE foo.bar (key text PRIMARY KEY, value text) with compaction = {'class': 'LeveledCompactionStrategy'}");

Expand All @@ -86,8 +72,6 @@ public void testDriverMessage() throws IOException

File rootDir = getInsightsDir();

Assert.assertTrue(InsightsTestUtil.checkInsightLogFor(rootDir, "driver.startup") > 0);

Assert.assertTrue(InsightsTestUtil.checkInsightLogFor(rootDir, NodeConfiguration.NAME) > 0);

Assert.assertTrue(InsightsTestUtil.checkInsightLogFor(rootDir, SchemaInformation.NAME) > 0);
Expand Down
20 changes: 0 additions & 20 deletions src/test/resources/4.0/cassandra_low_timeouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1265,26 +1265,6 @@ back_pressure_strategy:
# Limit the number of concurrent sstable upgrades
# max_concurrent_automatic_sstable_upgrades: 1

# Audit logging - Logs every incoming CQL command request, authentication to a node. See the docs
# on audit_logging for full details about the various configuration options.
audit_logging_options:
enabled: false
logger: BinAuditLogger
# audit_logs_dir:
# included_keyspaces:
# excluded_keyspaces: system, system_schema, system_virtual_schema
# included_categories:
# excluded_categories:
# included_users:
# excluded_users:
# roll_cycle: HOURLY
# block: true
# max_queue_weight: 268435456 # 256 MiB
# max_log_size: 17179869184 # 16 GiB
## archive command is "/path/to/script.sh %path" where %path is replaced with the file being rolled:
# archive_command:
# max_archive_retries: 10


# default options for full query logging - these can be overridden from command line when executing
# nodetool enablefullquerylog
Expand Down
26 changes: 0 additions & 26 deletions src/test/resources/4.0/cassandra_low_tombstone_thresholds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1259,32 +1259,6 @@ back_pressure_strategy:
# each write which may be lower in order to facilitate availability.
# ideal_consistency_level: EACH_QUORUM

# Automatically upgrade sstables after upgrade - if there is no ordinary compaction to do, the
# oldest non-upgraded sstable will get upgraded to the latest version
# automatic_sstable_upgrade: false
# Limit the number of concurrent sstable upgrades
# max_concurrent_automatic_sstable_upgrades: 1

# Audit logging - Logs every incoming CQL command request, authentication to a node. See the docs
# on audit_logging for full details about the various configuration options.
audit_logging_options:
enabled: false
logger: BinAuditLogger
# audit_logs_dir:
# included_keyspaces:
# excluded_keyspaces: system, system_schema, system_virtual_schema
# included_categories:
# excluded_categories:
# included_users:
# excluded_users:
# roll_cycle: HOURLY
# block: true
# max_queue_weight: 268435456 # 256 MiB
# max_log_size: 17179869184 # 16 GiB
## archive command is "/path/to/script.sh %path" where %path is replaced with the file being rolled:
# archive_command:
# max_archive_retries: 10


# default options for full query logging - these can be overridden from command line when executing
# nodetool enablefullquerylog
Expand Down

0 comments on commit 28b41cd

Please sign in to comment.