You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2020/10/07 21:36:26 UTC

[cassandra] branch cassandra-3.11 updated (b1efb8e -> 6c8c791)

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

dcapwell pushed a change to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from b1efb8e  Merge branch 'cassandra-3.0' into cassandra-3.11
     new 844d19d  Add ant task to check license and fix all files missing a licence
     new 8d2556f  Merge branch 'cassandra-2.2' into cassandra-3.0
     new 6c8c791  Merge branch 'cassandra-3.0' into cassandra-3.11

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                          | 22 +++++++++++++++++++++-
 .../apache/cassandra/db/commitlog/IntervalSet.java | 18 ++++++++++++++++++
 .../org/apache/cassandra/hints/InputPosition.java  | 18 ++++++++++++++++++
 .../org/apache/cassandra/metrics/AuthMetrics.java  | 18 ++++++++++++++++++
 .../apache/cassandra/utils/IntegerInterval.java    | 18 ++++++++++++++++++
 .../utils/logging/LogbackLoggingSupport.java       | 18 ++++++++++++++++++
 .../cassandra/utils/logging/LoggingSupport.java    | 18 ++++++++++++++++++
 .../utils/logging/LoggingSupportFactory.java       | 18 ++++++++++++++++++
 .../utils/logging/NoOpFallbackLoggingSupport.java  | 18 ++++++++++++++++++
 .../distributed/test/SimpleReadWriteTest.java      | 18 ++++++++++++++++++
 .../distributed/test/ThriftClientTest.java         | 18 ++++++++++++++++++
 .../distributed/test/ThriftClientUtils.java        | 18 ++++++++++++++++++
 .../distributed/upgrade/MigrateDropColumns.java    | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns22To30To311Test.java | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns22To311Test.java     | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns30To311Test.java     | 18 ++++++++++++++++++
 .../org/apache/cassandra/cql3/ViewComplexTest.java | 18 ++++++++++++++++++
 .../cql3/validation/operations/TTLTest.java        | 18 ++++++++++++++++++
 .../cassandra/db/commitlog/CommitLogCQLTest.java   | 18 ++++++++++++++++++
 .../apache/cassandra/db/marshal/EmptyTypeTest.java | 18 ++++++++++++++++++
 .../apache/cassandra/io/DiskSpaceMetricsTest.java  | 18 ++++++++++++++++++
 .../cassandra/utils/IntegerIntervalsTest.java      | 18 ++++++++++++++++++
 22 files changed, 399 insertions(+), 1 deletion(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


[cassandra] 01/01: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by dc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 6c8c791f19be13f4d1f02fe9ffc0d2d532e6c932
Merge: b1efb8e 8d2556f
Author: David Capwell <dc...@apache.org>
AuthorDate: Wed Oct 7 14:33:08 2020 -0700

    Merge branch 'cassandra-3.0' into cassandra-3.11

 build.xml                                          | 22 +++++++++++++++++++++-
 .../apache/cassandra/db/commitlog/IntervalSet.java | 18 ++++++++++++++++++
 .../org/apache/cassandra/hints/InputPosition.java  | 18 ++++++++++++++++++
 .../org/apache/cassandra/metrics/AuthMetrics.java  | 18 ++++++++++++++++++
 .../apache/cassandra/utils/IntegerInterval.java    | 18 ++++++++++++++++++
 .../utils/logging/LogbackLoggingSupport.java       | 18 ++++++++++++++++++
 .../cassandra/utils/logging/LoggingSupport.java    | 18 ++++++++++++++++++
 .../utils/logging/LoggingSupportFactory.java       | 18 ++++++++++++++++++
 .../utils/logging/NoOpFallbackLoggingSupport.java  | 18 ++++++++++++++++++
 .../distributed/test/SimpleReadWriteTest.java      | 18 ++++++++++++++++++
 .../distributed/test/ThriftClientTest.java         | 18 ++++++++++++++++++
 .../distributed/test/ThriftClientUtils.java        | 18 ++++++++++++++++++
 .../distributed/upgrade/MigrateDropColumns.java    | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns22To30To311Test.java | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns22To311Test.java     | 18 ++++++++++++++++++
 .../upgrade/MigrateDropColumns30To311Test.java     | 18 ++++++++++++++++++
 .../org/apache/cassandra/cql3/ViewComplexTest.java | 18 ++++++++++++++++++
 .../cql3/validation/operations/TTLTest.java        | 18 ++++++++++++++++++
 .../cassandra/db/commitlog/CommitLogCQLTest.java   | 18 ++++++++++++++++++
 .../apache/cassandra/db/marshal/EmptyTypeTest.java | 18 ++++++++++++++++++
 .../apache/cassandra/io/DiskSpaceMetricsTest.java  | 18 ++++++++++++++++++
 .../cassandra/utils/IntegerIntervalsTest.java      | 18 ++++++++++++++++++
 22 files changed, 399 insertions(+), 1 deletion(-)

diff --cc build.xml
index 82c35e9,e3270d8..f078d34
--- a/build.xml
+++ b/build.xml
@@@ -843,7 -787,7 +843,7 @@@
          depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
      <target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
  
-     <target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
 -    <target depends="init,gen-cql3-grammar,generate-cql-html,rat-report"
++    <target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java,rat-report"
              name="build-project">
          <echo message="${ant.project.name}: ${ant.file}"/>
          <!-- Order matters! -->
@@@ -1199,28 -1165,26 +1199,46 @@@
        </rat:report>
      </target>
  
+     <target name="rat-report" depends="rat-init" description="License checks on source" >
+       <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
+                   reportFile="${build.dir}/src.rat.txt">
+         <fileset dir="src/java"/>
+         <fileset dir="test/unit"/>
+         <fileset dir="test/distributed"/>
+       </rat:report>
+       <fail message="Some files have missing or incorrect license information. Check RAT report in ${build.dir}/src.rat.txt for more details!">
+         <condition>
+           <and>
+             <not>
+               <resourcecontains resource="${build.dir}/src.rat.txt" substring="0 Unknown Licenses" casesensitive="false" />
+             </not>
+           </and>
+         </condition>
+       </fail>
+     </target>
+ 
 +  <target name="build-jmh" depends="build-test" description="Create JMH uber jar">
 +      <jar jarfile="${build.test.dir}/deps.jar">
 +          <zipgroupfileset dir="${build.dir.lib}/jars">
 +              <include name="*jmh*.jar"/>
 +              <include name="jopt*.jar"/>
 +              <include name="commons*.jar"/>
 +          </zipgroupfileset>
 +          <zipgroupfileset dir="${build.lib}" includes="*.jar"/>
 +      </jar>
 +      <jar jarfile="${build.test.dir}/benchmarks.jar">
 +          <manifest>
 +              <attribute name="Main-Class" value="org.openjdk.jmh.Main"/>
 +          </manifest>
 +          <zipfileset src="${build.test.dir}/deps.jar" excludes="META-INF/*.SF" />
 +          <fileset dir="${build.classes.main}"/>
 +          <fileset dir="${test.classes}"/>
 +      </jar>
 +  </target>
 +
    <target name="build-test" depends="build" description="Compile test classes">
      <javac
 +     compiler="modern"
       debug="true"
       debuglevel="${debuglevel}"
       destdir="${test.classes}"
diff --cc src/java/org/apache/cassandra/hints/InputPosition.java
index 05f9db0,0b8953c..28146c1
--- a/src/java/org/apache/cassandra/hints/InputPosition.java
+++ b/src/java/org/apache/cassandra/hints/InputPosition.java
@@@ -1,3 -1,20 +1,21 @@@
+ /*
+  * 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.hints;
  
  /**
diff --cc src/java/org/apache/cassandra/metrics/AuthMetrics.java
index 57d08ef,0000000..8f0f97e
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/metrics/AuthMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/AuthMetrics.java
@@@ -1,40 -1,0 +1,58 @@@
++/*
++ * 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.metrics;
 +
 +import com.codahale.metrics.Meter;
 +
 +/**
 + * Metrics about authentication
 + */
 +public class AuthMetrics
 +{
 +
 +    public static final AuthMetrics instance = new AuthMetrics();
 +
 +    public static void init()
 +    {
 +        // no-op, just used to force instance creation
 +    }
 +
 +    /** Number and rate of successful logins */
 +    protected final Meter success;
 +
 +    /** Number and rate of login failures */
 +    protected final Meter failure;
 +
 +    private AuthMetrics()
 +    {
 +
 +        success = ClientMetrics.instance.registerMeter("AuthSuccess");
 +        failure = ClientMetrics.instance.registerMeter("AuthFailure");
 +    }
 +
 +    public void markSuccess()
 +    {
 +        success.mark();
 +    }
 +
 +    public void markFailure()
 +    {
 +        failure.mark();
 +    }
 +}
diff --cc src/java/org/apache/cassandra/utils/logging/LogbackLoggingSupport.java
index 3229460,0000000..fb17e82
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/utils/logging/LogbackLoggingSupport.java
+++ b/src/java/org/apache/cassandra/utils/logging/LogbackLoggingSupport.java
@@@ -1,146 -1,0 +1,164 @@@
++/*
++ * 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.logging;
 +
 +import java.lang.management.ManagementFactory;
 +import java.security.AccessControlException;
 +import java.util.Iterator;
 +import java.util.Map;
 +
 +import javax.management.JMX;
 +import javax.management.ObjectName;
 +
 +import org.apache.cassandra.security.ThreadAwareSecurityManager;
 +import org.apache.commons.lang3.StringUtils;
 +import org.slf4j.LoggerFactory;
 +
 +import com.google.common.collect.Maps;
 +
 +import ch.qos.logback.classic.Level;
 +import ch.qos.logback.classic.Logger;
 +import ch.qos.logback.classic.LoggerContext;
 +import ch.qos.logback.classic.jmx.JMXConfiguratorMBean;
 +import ch.qos.logback.classic.spi.ILoggingEvent;
 +import ch.qos.logback.classic.spi.TurboFilterList;
 +import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter;
 +import ch.qos.logback.classic.turbo.TurboFilter;
 +import ch.qos.logback.core.Appender;
 +import ch.qos.logback.core.hook.DelayingShutdownHook;
 +
 +/**
 + * Encapsulates all logback-specific implementations in a central place.
 + * Generally, the Cassandra code-base should be logging-backend agnostic and only use slf4j-api.
 + * This class MUST NOT be used directly, but only via {@link LoggingSupportFactory} which dynamically loads and
 + * instantiates an appropriate implementation according to the used slf4j binding.
 + */
 +public class LogbackLoggingSupport implements LoggingSupport
 +{
 +
 +    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(LogbackLoggingSupport.class);
 +
 +    @Override
 +    public void onStartup()
 +    {
 +        // The default logback configuration in conf/logback.xml allows reloading the
 +        // configuration when the configuration file has changed (every 60 seconds by default).
 +        // This requires logback to use file I/O APIs. But file I/O is not allowed from UDFs.
 +        // I.e. if logback decides to check for a modification of the config file while
 +        // executing a sandbox thread, the UDF execution and therefore the whole request
 +        // execution will fail with an AccessControlException.
 +        // To work around this, a custom ReconfigureOnChangeFilter is installed, that simply
 +        // prevents this configuration file check and possible reload of the configuration,
 +        // while executing sandboxed UDF code.
 +        Logger logbackLogger = (Logger) LoggerFactory.getLogger(ThreadAwareSecurityManager.class);
 +        LoggerContext ctx = logbackLogger.getLoggerContext();
 +
 +        TurboFilterList turboFilterList = ctx.getTurboFilterList();
 +        for (int i = 0; i < turboFilterList.size(); i++)
 +        {
 +            TurboFilter turboFilter = turboFilterList.get(i);
 +            if (turboFilter instanceof ReconfigureOnChangeFilter)
 +            {
 +                ReconfigureOnChangeFilter reconfigureOnChangeFilter = (ReconfigureOnChangeFilter) turboFilter;
 +                turboFilterList.set(i, new SMAwareReconfigureOnChangeFilter(reconfigureOnChangeFilter));
 +                break;
 +            }
 +        }
 +    }
 +
 +    @Override
 +    public void onShutdown()
 +    {
 +        DelayingShutdownHook logbackHook = new DelayingShutdownHook();
 +        logbackHook.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
 +        logbackHook.run();
 +    }
 +
 +    @Override
 +    public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
 +    {
 +        Logger logBackLogger = (Logger) LoggerFactory.getLogger(classQualifier);
 +
 +        // if both classQualifier and rawLevel are empty, reload from configuration
 +        if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel))
 +        {
 +            JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
 +                                                                          new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
 +                                                                          JMXConfiguratorMBean.class);
 +            jmxConfiguratorMBean.reloadDefaultConfiguration();
 +            return;
 +        }
 +        // classQualifier is set, but blank level given
 +        else if (StringUtils.isNotBlank(classQualifier) && StringUtils.isBlank(rawLevel))
 +        {
 +            if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
 +                logBackLogger.setLevel(null);
 +            return;
 +        }
 +
 +        Level level = Level.toLevel(rawLevel);
 +        logBackLogger.setLevel(level);
 +        logger.info("set log level to {} for classes under '{}' (if the level doesn't look like '{}' then the logger couldn't parse '{}')", level, classQualifier, rawLevel, rawLevel);
 +    }
 +
 +    @Override
 +    public Map<String, String> getLoggingLevels()
 +    {
 +        Map<String, String> logLevelMaps = Maps.newLinkedHashMap();
 +        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 +        for (Logger logBackLogger : lc.getLoggerList())
 +        {
 +            if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
 +                logLevelMaps.put(logBackLogger.getName(), logBackLogger.getLevel().toString());
 +        }
 +        return logLevelMaps;
 +    }
 +
 +    private boolean hasAppenders(Logger logBackLogger)
 +    {
 +        Iterator<Appender<ILoggingEvent>> it = logBackLogger.iteratorForAppenders();
 +        return it.hasNext();
 +    }
 +
 +    /**
 +     * The purpose of this class is to prevent logback from checking for config file change,
 +     * if the current thread is executing a sandboxed thread to avoid {@link AccessControlException}s.
 +     */
 +    private static class SMAwareReconfigureOnChangeFilter extends ReconfigureOnChangeFilter
 +    {
 +        SMAwareReconfigureOnChangeFilter(ReconfigureOnChangeFilter reconfigureOnChangeFilter)
 +        {
 +            setRefreshPeriod(reconfigureOnChangeFilter.getRefreshPeriod());
 +            setName(reconfigureOnChangeFilter.getName());
 +            setContext(reconfigureOnChangeFilter.getContext());
 +            if (reconfigureOnChangeFilter.isStarted())
 +            {
 +                reconfigureOnChangeFilter.stop();
 +                start();
 +            }
 +        }
 +
 +        protected boolean changeDetected(long now)
 +        {
 +            if (ThreadAwareSecurityManager.isSecuredThread())
 +                return false;
 +            return super.changeDetected(now);
 +        }
 +    }
 +}
diff --cc src/java/org/apache/cassandra/utils/logging/LoggingSupport.java
index 3855ca7,0000000..8ea83be
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/utils/logging/LoggingSupport.java
+++ b/src/java/org/apache/cassandra/utils/logging/LoggingSupport.java
@@@ -1,34 -1,0 +1,52 @@@
++/*
++ * 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.logging;
 +
 +import java.util.Map;
 +
 +/**
 + * Common abstraction of functionality which can be implemented for different logging backend implementations (slf4j bindings).
 + * Concrete implementations are dynamically loaded and instantiated by {@link LoggingSupportFactory#getLoggingSupport()}.
 + */
 +public interface LoggingSupport
 +{
 +    /**
 +     * Hook used to execute logging implementation specific customization at Cassandra startup time.
 +     */
 +    default void onStartup() {}
 +
 +    /**
 +     * Hook used to execute logging implementation specific customization at Cassandra shutdown time.
 +     */
 +    default void onShutdown() {}
 +
 +    /**
 +     * Changes the given logger to the given log level.
 +     *
 +     * @param classQualifier the class qualifier or logger name
 +     * @param rawLevel the string representation of a log level
 +     * @throws Exception an exception which may occur while changing the given logger to the given log level.
 +     */
 +    void setLoggingLevel(String classQualifier, String rawLevel) throws Exception;
 +
 +    /**
 +     * @return a map of logger names and their associated log level as string representations.
 +     */
 +    Map<String, String> getLoggingLevels();
 +}
diff --cc src/java/org/apache/cassandra/utils/logging/LoggingSupportFactory.java
index 3e7adab,0000000..9d099bd
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/utils/logging/LoggingSupportFactory.java
+++ b/src/java/org/apache/cassandra/utils/logging/LoggingSupportFactory.java
@@@ -1,42 -1,0 +1,60 @@@
++/*
++ * 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.logging;
 +
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +import org.apache.cassandra.utils.FBUtilities;
 +
 +/**
 + * Dynamically loads and instantiates an appropriate {@link LoggingSupport} implementation according to the used slf4j binding.
 + * For production use, this should always be {@link LogbackLoggingSupport}.
 + */
 +public class LoggingSupportFactory
 +{
 +    private static final Logger logger = LoggerFactory.getLogger(LoggingSupportFactory.class);
 +
 +    private static volatile LoggingSupport loggingSupport;
 +
 +    private LoggingSupportFactory() {}
 +
 +    /**
 +     * @return An appropriate {@link LoggingSupport} implementation according to the used slf4j binding.
 +     */
 +    public static LoggingSupport getLoggingSupport()
 +    {
 +        if (loggingSupport == null)
 +        {
 +            // unfortunately, this is the best way to determine if logback is being used for logger
 +            String loggerFactoryClass = LoggerFactory.getILoggerFactory().getClass().getName();
 +            if (loggerFactoryClass.contains("logback"))
 +            {
 +                loggingSupport = FBUtilities.instanceOrConstruct("org.apache.cassandra.utils.logging.LogbackLoggingSupport", "LogbackLoggingSupport");
 +            }
 +            else
 +            {
 +                loggingSupport = new NoOpFallbackLoggingSupport();
 +                logger.warn("You are using Cassandra with an unsupported deployment. The intended logging implementation library logback is not used by slf4j. Detected slf4j logger factory: {}. "
 +                        + "You will not be able to dynamically manage log levels via JMX and may have performance or other issues.", loggerFactoryClass);
 +            }
 +        }
 +        return loggingSupport;
 +    }
 +}
diff --cc src/java/org/apache/cassandra/utils/logging/NoOpFallbackLoggingSupport.java
index 4865e09,0000000..4f79650
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/utils/logging/NoOpFallbackLoggingSupport.java
+++ b/src/java/org/apache/cassandra/utils/logging/NoOpFallbackLoggingSupport.java
@@@ -1,30 -1,0 +1,48 @@@
++/*
++ * 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.logging;
 +
 +import java.util.Collections;
 +import java.util.Map;
 +
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +/**
 + * A fallback implementation with empty implementations which ensures other slf4j bindings (logging implementations)
 + * than the default supported framework can be used. This loses functionality, but is perfectly fine for most
 + * integration test requirements of applications using an embedded cassandra server.
 + */
 +public class NoOpFallbackLoggingSupport implements LoggingSupport
 +{
 +    private static final Logger logger = LoggerFactory.getLogger(NoOpFallbackLoggingSupport.class);
 +
 +    @Override
 +    public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
 +    {
 +        logger.warn("The log level was not changed, because you are using an unsupported slf4j logging implementation for which this functionality was not implemented.");
 +    }
 +
 +    @Override
 +    public Map<String, String> getLoggingLevels()
 +    {
 +        logger.warn("An empty map of logger names and their logging levels was returned, because you are using an unsupported slf4j logging implementation for which this functionality was not implemented.");
 +        return Collections.emptyMap();
 +    }
 +}
diff --cc test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns.java
index c8c04d1,0000000..dfa1884
mode 100644,000000..100644
--- a/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns.java
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns.java
@@@ -1,113 -1,0 +1,131 @@@
++/*
++ * 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.distributed.upgrade;
 +
 +import java.util.Arrays;
 +import java.util.Collections;
 +import java.util.Objects;
 +
 +import com.google.common.collect.ImmutableMap;
 +import com.google.common.collect.ImmutableSet;
 +import com.google.common.collect.Sets;
 +import org.junit.Assert;
 +import org.junit.Test;
 +
 +import org.apache.cassandra.db.marshal.CompositeType;
 +import org.apache.cassandra.db.marshal.Int32Type;
 +import org.apache.cassandra.db.marshal.MapType;
 +import org.apache.cassandra.distributed.api.ConsistencyLevel;
 +import org.apache.cassandra.distributed.api.Feature;
 +import org.apache.cassandra.distributed.api.ICoordinator;
 +import org.apache.cassandra.distributed.api.QueryResults;
 +import org.apache.cassandra.distributed.api.SimpleQueryResult;
 +import org.apache.cassandra.distributed.shared.AssertUtils;
 +import org.apache.cassandra.distributed.shared.Versions;
 +import org.apache.cassandra.distributed.test.ThriftClientUtils;
 +import org.apache.cassandra.thrift.Deletion;
 +import org.apache.cassandra.thrift.Mutation;
 +import org.apache.cassandra.thrift.SlicePredicate;
 +import org.apache.cassandra.thrift.SliceRange;
 +import org.apache.cassandra.utils.ByteBufferUtil;
 +
 +public abstract class MigrateDropColumns extends UpgradeTestBase
 +{
 +    private static final MapType MAP_TYPE = MapType.getInstance(Int32Type.instance, Int32Type.instance, true);
 +
 +    private final Versions.Major initial;
 +    private final Versions.Major[] upgrade;
 +
 +    protected MigrateDropColumns(Versions.Major initial, Versions.Major... upgrade)
 +    {
 +        this.initial = Objects.requireNonNull(initial, "initial");
 +        this.upgrade = Objects.requireNonNull(upgrade, "upgrade");
 +    }
 +
 +    @Test
 +    public void dropColumns() throws Throwable
 +    {
 +        new TestCase()
 +        .upgrade(initial, upgrade)
 +        .withConfig(c -> c.with(Feature.NATIVE_PROTOCOL))
 +        .setup(cluster -> {
 +            cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl(pk int, tables map<int, int>, PRIMARY KEY (pk))"));
 +
 +            ICoordinator coordinator = cluster.coordinator(1);
 +
 +            // write a RT to pk=0
 +            ThriftClientUtils.thriftClient(cluster.get(1), thrift -> {
 +                thrift.set_keyspace(KEYSPACE);
 +
 +                Mutation mutation = new Mutation();
 +                Deletion deletion = new Deletion();
 +                SlicePredicate slice = new SlicePredicate();
 +                SliceRange range = new SliceRange();
 +                range.setStart(CompositeType.build(ByteBufferUtil.bytes("tables")));
 +                range.setFinish(CompositeType.build(ByteBufferUtil.bytes("tables")));
 +                slice.setSlice_range(range);
 +                deletion.setPredicate(slice);
 +                deletion.setTimestamp(System.currentTimeMillis());
 +                mutation.setDeletion(deletion);
 +
 +                thrift.batch_mutate(Collections.singletonMap(ByteBufferUtil.bytes(0),
 +                                                             Collections.singletonMap("tbl", Arrays.asList(mutation))),
 +                                    org.apache.cassandra.thrift.ConsistencyLevel.ALL);
 +            });
 +
 +            // write table to pk=1
 +            // NOTE: because jvm-dtest doesn't support collections in the execute interface (see CASSANDRA-15969)
 +            // need to encode to a ByteBuffer first
 +            coordinator.execute(withKeyspace("INSERT INTO %s.tbl (pk, tables) VALUES (?, ?)"), ConsistencyLevel.ONE, 1, MAP_TYPE.decompose(ImmutableMap.of(1, 1)));
 +
 +            cluster.forEach(inst -> inst.flush(KEYSPACE));
 +
 +            cluster.schemaChange(withKeyspace("ALTER TABLE %s.tbl DROP tables"));
 +        })
 +        .runAfterClusterUpgrade(cluster -> {
 +            ICoordinator coordinator = cluster.coordinator(1);
 +            SimpleQueryResult qr = coordinator.executeWithResult("SELECT column_name " +
 +                                                                 "FROM system_schema.dropped_columns " +
 +                                                                 "WHERE keyspace_name=?" +
 +                                                                 " AND table_name=?;",
 +                                                                 ConsistencyLevel.ALL, KEYSPACE, "tbl");
 +            Assert.assertEquals(ImmutableSet.of("tables"), Sets.newHashSet(qr.map(r -> r.getString("column_name"))));
 +
 +            assertRows(coordinator);
 +
 +            // upgradesstables, make sure everything is still working
 +            cluster.forEach(n -> n.nodetoolResult("upgradesstables", KEYSPACE).asserts().success());
 +
 +            assertRows(coordinator);
 +        })
 +        .run();
 +    }
 +
 +    private static void assertRows(ICoordinator coordinator)
 +    {
 +        // since only a RT was written to this row there is no liveness information, so the row will be skipped
 +        AssertUtils.assertRows(
 +        coordinator.executeWithResult(withKeyspace("SELECT * FROM %s.tbl WHERE pk=?"), ConsistencyLevel.ALL, 0),
 +        QueryResults.empty());
 +
 +        AssertUtils.assertRows(
 +        coordinator.executeWithResult(withKeyspace("SELECT * FROM %s.tbl WHERE pk=?"), ConsistencyLevel.ALL, 1),
 +        QueryResults.builder().row(1).build());
 +    }
 +}
diff --cc test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To30To311Test.java
index e98b023,0000000..e68f979
mode 100644,000000..100644
--- a/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To30To311Test.java
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To30To311Test.java
@@@ -1,11 -1,0 +1,29 @@@
++/*
++ * 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.distributed.upgrade;
 +
 +import org.apache.cassandra.distributed.shared.Versions;
 +
 +public class MigrateDropColumns22To30To311Test extends MigrateDropColumns
 +{
 +    public MigrateDropColumns22To30To311Test()
 +    {
 +        super(Versions.Major.v22, Versions.Major.v30, Versions.Major.v3X);
 +    }
 +}
diff --cc test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To311Test.java
index b1670bb,0000000..5de5458
mode 100644,000000..100644
--- a/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To311Test.java
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns22To311Test.java
@@@ -1,11 -1,0 +1,29 @@@
++/*
++ * 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.distributed.upgrade;
 +
 +import org.apache.cassandra.distributed.shared.Versions;
 +
 +public class MigrateDropColumns22To311Test extends MigrateDropColumns
 +{
 +    public MigrateDropColumns22To311Test()
 +    {
 +        super(Versions.Major.v22, Versions.Major.v3X);
 +    }
 +}
diff --cc test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns30To311Test.java
index a0e0d1c,0000000..1ec460f
mode 100644,000000..100644
--- a/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns30To311Test.java
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/MigrateDropColumns30To311Test.java
@@@ -1,11 -1,0 +1,29 @@@
++/*
++ * 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.distributed.upgrade;
 +
 +import org.apache.cassandra.distributed.shared.Versions;
 +
 +public class MigrateDropColumns30To311Test extends MigrateDropColumns
 +{
 +    public MigrateDropColumns30To311Test()
 +    {
 +        super(Versions.Major.v30, Versions.Major.v3X);
 +    }
 +}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org