Remove byteman-related files from production sources

This patch also removes compress-lzf library (leftover from CASSANDRA-12229)
as well as it makes byte-buddy dependencies to be test scoped.

patch by Stefan Miklosovic; reviewed by Michael Semb Wever for CASSANDRA-18877
This commit is contained in:
Stefan Miklosovic 2023-10-06 12:54:05 +02:00
parent 016d91a7d7
commit b57c13603a
No known key found for this signature in database
GPG Key ID: 32F35CB2F546D93E
4 changed files with 4 additions and 90 deletions

View File

@ -527,7 +527,6 @@
<dependencyManagement>
<dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.10.4"/>
<dependency groupId="org.lz4" artifactId="lz4-java" version="1.8.0"/>
<dependency groupId="com.ning" artifactId="compress-lzf" version="0.8.4" scope="provided"/>
<dependency groupId="com.github.luben" artifactId="zstd-jni" version="1.5.5-1"/>
<dependency groupId="com.google.guava" artifactId="guava" version="27.0-jre">
<exclusion groupId="com.google.code.findbugs" artifactId="jsr305" />
@ -591,13 +590,15 @@
<dependency groupId="org.jacoco" artifactId="org.jacoco.agent" version="${jacoco.version}" scope="test"/>
<dependency groupId="org.jacoco" artifactId="org.jacoco.ant" version="${jacoco.version}" scope="test"/>
<!-- these dependencies have to be of provided scope as they are used by cassandra-dtests and ccm is looking
for these libraries in build/lib/jars -->
<dependency groupId="org.jboss.byteman" artifactId="byteman-install" version="${byteman.version}" scope="provided"/>
<dependency groupId="org.jboss.byteman" artifactId="byteman" version="${byteman.version}" scope="provided"/>
<dependency groupId="org.jboss.byteman" artifactId="byteman-submit" version="${byteman.version}" scope="provided"/>
<dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit" version="${byteman.version}" scope="provided"/>
<dependency groupId="net.bytebuddy" artifactId="byte-buddy" version="${bytebuddy.version}" />
<dependency groupId="net.bytebuddy" artifactId="byte-buddy-agent" version="${bytebuddy.version}" />
<dependency groupId="net.bytebuddy" artifactId="byte-buddy" version="${bytebuddy.version}" scope="test"/>
<dependency groupId="net.bytebuddy" artifactId="byte-buddy-agent" version="${bytebuddy.version}" scope="test"/>
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core" version="1.37" scope="test"/>
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.37" scope="test"/>
@ -785,7 +786,6 @@
<scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
<dependency groupId="org.xerial.snappy" artifactId="snappy-java"/>
<dependency groupId="org.lz4" artifactId="lz4-java"/>
<dependency groupId="com.ning" artifactId="compress-lzf"/>
<dependency groupId="com.google.guava" artifactId="guava"/>
<dependency groupId="commons-cli" artifactId="commons-cli"/>
<dependency groupId="commons-codec" artifactId="commons-codec"/>

View File

@ -73,8 +73,6 @@ public class CassandraStreamWriter
/**
* Stream file of specified sections to given channel.
*
* CassandraStreamWriter uses LZF compression on wire to decrease size to transfer.
*
* @param output where this writes data to
* @throws IOException on any I/O error
*/

View File

@ -1,58 +0,0 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.cassandra.utils;
import java.util.concurrent.atomic.AtomicReference;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.RateLimiter;
import org.jboss.byteman.rule.Rule;
import org.jboss.byteman.rule.helper.Helper;
/**
* Helper class to apply rate limiting during fault injection testing;
* for an example script, see test/resources/byteman/mutation_limiter.btm.
*/
@VisibleForTesting
public class TestRateLimiter extends Helper
{
private static final AtomicReference<RateLimiter> ref = new AtomicReference<>();
protected TestRateLimiter(Rule rule)
{
super(rule);
}
/**
* Acquires a single unit at the given rate. If the rate changes between calls, a new rate limiter is created
* and the old one is discarded.
*/
public void acquire(double rate)
{
RateLimiter limiter = ref.get();
if (limiter == null || limiter.getRate() != rate)
{
ref.compareAndSet(limiter, RateLimiter.create(rate));
limiter = ref.get();
}
limiter.acquire(1);
}
}

View File

@ -1,26 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
RULE mutation_limiter
CLASS org.apache.cassandra.db.MutationVerbHandler
METHOD doVerb
HELPER org.apache.cassandra.utils.TestRateLimiter
AT ENTRY
IF TRUE
DO acquire(1000.0)
ENDRULE