Merge branch 'cassandra-3.11' into cassandra-4.0

This commit is contained in:
Andrés de la Peña 2021-05-27 16:33:44 +01:00
commit 0d3ead9f55
6 changed files with 4933 additions and 2492 deletions

View File

@ -35,6 +35,7 @@ default_env_vars: &default_env_vars
DTEST_BRANCH: trunk
CCM_MAX_HEAP_SIZE: 1024M
CCM_HEAP_NEWSIZE: 256M
# The Ant test target to run, for example:
# REPEATED_UTEST_TARGET: testsome
# REPEATED_UTEST_TARGET: test-jvm-dtest-some
@ -55,6 +56,7 @@ default_env_vars: &default_env_vars
REPEATED_UTEST_COUNT: 100
# Whether the test iteration should stop on the first failure
REPEATED_UTEST_STOP_ON_FAILURE: false
# A Python dtest to be run multiple times, for example:
# REPEATED_DTEST_NAME: cqlsh_tests/test_cqlsh.py
# REPEATED_DTEST_NAME: cqlsh_tests/test_cqlsh.py::TestCqlshSmoke
@ -67,6 +69,27 @@ default_env_vars: &default_env_vars
# Whether the test iteration should stop on the first failure
REPEATED_DTEST_STOP_ON_FAILURE: false
# A Python upgrade dtest to be run multiple times, for example:
# REPEATED_UPGRADE_DTEST_NAME: upgrade_tests/cql_tests.py
# REPEATED_UPGRADE_DTEST_NAME: upgrade_tests/cql_tests.py::TestCQLNodes2RF1_Upgrade_current_4_0_x_To_indev_4_0_x
REPEATED_UPGRADE_DTEST_NAME:
# The number of times that the repeated Python upgrade dtest should be run
REPEATED_UPGRADE_DTEST_COUNT: 100
# Whether the test iteration should stop on the first failure
REPEATED_UPGRADE_DTEST_STOP_ON_FAILURE: false
# The name of JVM upgrade dtest class to be run multiple times, for example:
# REPEATED_JVM_UPGRADE_DTEST_CLASS: org.apache.cassandra.distributed.upgrade.MixedModeAvailabilityV30Test
REPEATED_JVM_UPGRADE_DTEST_CLASS:
# The optional specific methods within REPEATED_JVM_UPGRADE_DTEST_CLASS to be run, for example:
# REPEATED_JVM_UPGRADE_DTEST_METHODS: testAvailabilityV30ToV3X
# REPEATED_JVM_UPGRADE_DTEST_METHODS: testAvailabilityV30ToV3X,testAvailabilityV30ToV4
REPEATED_JVM_UPGRADE_DTEST_METHODS:
# The number of times that the repeated JVM upgrade dtest should be run
REPEATED_JVM_UPGRADE_DTEST_COUNT: 100
# Whether the JVM upgrade dtest iteration should stop on the first failure
REPEATED_JVM_UPGRADE_DTEST_STOP_ON_FAILURE: false
j8_par_executor: &j8_par_executor
executor:
name: java8-executor
@ -166,14 +189,17 @@ j8_with_dtests_jobs: &j8_with_dtests_jobs
requires:
- start_utests_system_keyspace_directory
- j8_build
- start_jvm_upgrade_dtest:
- start_j8_dtest_jars_build:
type: approval
- j8_dtest_jars_build:
requires:
- j8_build
- start_jvm_upgrade_dtest
- start_j8_dtest_jars_build
- start_jvm_upgrade_dtest:
type: approval
- j8_jvm_upgrade_dtests:
requires:
- start_jvm_upgrade_dtest
- j8_dtest_jars_build
# Java 8 dtests (on request)
- start_j8_dtests:
@ -261,33 +287,47 @@ j8_with_dtests_jobs: &j8_with_dtests_jobs
- start_j11_cqlsh_tests-no-vnodes
- j8_build
# Java 8 repeated utest (on request)
- start_j8_repeated-utest:
- start_j8_repeated_utest:
type: approval
- j8_repeated-utest:
- j8_repeated_utest:
requires:
- start_j8_repeated-utest
- start_j8_repeated_utest
- j8_build
# Java 11 repeated utest (on request)
- start_j11_repeated-utest:
- start_j11_repeated_utest:
type: approval
- j11_repeated-utest:
- j11_repeated_utest:
requires:
- start_j11_repeated-utest
- start_j11_repeated_utest
- j8_build
# Java 8 repeated dtest (on request)
- start_j8_repeated-dtest:
- start_j8_repeated_dtest:
type: approval
- j8_repeated-dtest:
- j8_repeated_dtest:
requires:
- start_j8_repeated-dtest
- start_j8_repeated_dtest
- j8_build
# Java 11 repeated dtest (on request)
- start_j11_repeated-dtest:
- start_j11_repeated_dtest:
type: approval
- j11_repeated-dtest:
- j11_repeated_dtest:
requires:
- start_j11_repeated-dtest
- start_j11_repeated_dtest
- j8_build
# Repeated Python upgrade dtest (on request)
- start_repeated_upgrade_dtest:
type: approval
- repeated_upgrade_dtest:
requires:
- start_repeated_upgrade_dtest
- j8_build
# Repeated JVM upgrade dtest (on request)
- start_repeated_jvm_upgrade_dtest:
type: approval
- repeated_jvm_upgrade_dtest:
requires:
- start_repeated_jvm_upgrade_dtest
- j8_dtest_jars_build
j11_with_dtests_jobs: &j11_with_dtests_jobs
jobs:
@ -342,18 +382,18 @@ j11_with_dtests_jobs: &j11_with_dtests_jobs
- start_j11_cqlsh_tests-no-vnodes
- j11_build
# Java 11 repeated utest (on request)
- start_j11_repeated-utest:
- start_j11_repeated_utest:
type: approval
- j11_repeated-utest:
- j11_repeated_utest:
requires:
- start_j11_repeated-utest
- start_j11_repeated_utest
- j11_build
# Java 11 repeated dtest (on request)
- start_j11_repeated-dtest:
- start_j11_repeated_dtest:
type: approval
- j11_repeated-dtest:
- j11_repeated_dtest:
requires:
- start_j11_repeated-dtest
- start_j11_repeated_dtest
- j11_build
j8_with_dtest_jobs_only: &j8_with_dtest_jobs_only
@ -828,32 +868,47 @@ jobs:
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.8'
python_version: '3.8'
j8_repeated-utest:
j8_repeated_utest:
<<: *j8_par_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_repeated_utest
- run_repeated_utest:
target: ${REPEATED_UTEST_TARGET}
class: ${REPEATED_UTEST_CLASS}
methods: ${REPEATED_UTEST_METHODS}
count: ${REPEATED_UTEST_COUNT}
stop_on_failure: ${REPEATED_UTEST_STOP_ON_FAILURE}
j11_repeated-utest:
j11_repeated_utest:
<<: *j11_par_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_repeated_utest
- run_repeated_utest:
target: ${REPEATED_UTEST_TARGET}
class: ${REPEATED_UTEST_CLASS}
methods: ${REPEATED_UTEST_METHODS}
count: ${REPEATED_UTEST_COUNT}
stop_on_failure: ${REPEATED_UTEST_STOP_ON_FAILURE}
j8_repeated-dtest:
j8_repeated_dtest:
<<: *j8_par_executor
steps:
- attach_workspace:
at: /home/cassandra
- clone_dtest
- create_venv
- run_repeated_dtest
- run_repeated_dtest:
tests: ${REPEATED_DTEST_NAME}
vnodes: ${REPEATED_DTEST_VNODES}
upgrade: "false"
count: ${REPEATED_DTEST_COUNT}
stop_on_failure: ${REPEATED_DTEST_STOP_ON_FAILURE}
j11_repeated-dtest:
j11_repeated_dtest:
<<: *j11_par_executor
steps:
- attach_workspace:
@ -861,7 +916,39 @@ jobs:
- log_environment
- clone_dtest
- create_venv
- run_repeated_dtest
- run_repeated_dtest:
tests: ${REPEATED_DTEST_NAME}
vnodes: ${REPEATED_DTEST_VNODES}
upgrade: "false"
count: ${REPEATED_DTEST_COUNT}
stop_on_failure: ${REPEATED_DTEST_STOP_ON_FAILURE}
repeated_jvm_upgrade_dtest:
<<: *j8_par_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_repeated_utest:
target: test-jvm-dtest-some
class: ${REPEATED_JVM_UPGRADE_DTEST_CLASS}
methods: ${REPEATED_JVM_UPGRADE_DTEST_METHODS}
count: ${REPEATED_JVM_UPGRADE_DTEST_COUNT}
stop_on_failure: ${REPEATED_JVM_UPGRADE_DTEST_STOP_ON_FAILURE}
repeated_upgrade_dtest:
<<: *j8_par_executor
steps:
- attach_workspace:
at: /home/cassandra
- clone_dtest
- create_venv
- run_repeated_dtest:
tests: ${REPEATED_UPGRADE_DTEST_NAME}
vnodes: "false"
upgrade: "true"
stop_on_failure: ${REPEATED_UPGRADE_DTEST_STOP_ON_FAILURE}
count: ${REPEATED_UPGRADE_DTEST_COUNT}
commands:
log_environment:
@ -1209,30 +1296,41 @@ commands:
destination: dtest_<<parameters.file_tag>>_logs
run_repeated_utest:
parameters:
target:
type: string
class:
type: string
methods:
type: string
count:
type: string
stop_on_failure:
type: string
steps:
- run:
name: Run repeated utest
name: Run repeated JUnit test
no_output_timeout: 15m
command: |
if [ "$REPEATED_UTEST_CLASS" == "<nil>" ]; then
if [ "<<parameters.class>>" == "<nil>" ]; then
echo "Repeated utest class name hasn't been defined, exiting without running any test"
elif [ "$REPEATED_UTEST_COUNT" == "<nil>" ]; then
elif [ "<<parameters.count>>" == "<nil>" ]; then
echo "Repeated utest count hasn't been defined, exiting without running any test"
elif [ "$REPEATED_UTEST_COUNT" -le 0 ]; then
elif [ "<<parameters.count>>" -le 0 ]; then
echo "Repeated utest count is lesser or equals than zero, exiting without running any test"
else
# Calculate the number of test iterations to be run by the current parallel runner.
# Since we are running the same test multiple times there is no need to use `circleci tests split`.
count=$((REPEATED_UTEST_COUNT / CIRCLE_NODE_TOTAL))
if (($CIRCLE_NODE_INDEX < (REPEATED_UTEST_COUNT % CIRCLE_NODE_TOTAL))); then
count=$((<<parameters.count>> / CIRCLE_NODE_TOTAL))
if (($CIRCLE_NODE_INDEX < (<<parameters.count>> % CIRCLE_NODE_TOTAL))); then
count=$((count+1))
fi
if (($count <= 0)); then
echo "No tests to run in this runner"
else
echo "Running $REPEATED_UTEST_TARGET $REPEATED_UTEST_CLASS $REPEATED_UTEST_METHODS $count times"
echo "Running <<parameters.target>> <<parameters.class>> <<parameters.methods>> <<parameters.count>> times"
set -x
export PATH=$JAVA_HOME/bin:$PATH
@ -1242,8 +1340,8 @@ commands:
cp ~/dtest_jars/dtest* /tmp/cassandra/build/
fi
target=$REPEATED_UTEST_TARGET
class_path=$REPEATED_UTEST_CLASS
target=<<parameters.target>>
class_path=<<parameters.class>>
class_name="${class_path##*.}"
# Prepare the -Dtest.name argument.
@ -1258,14 +1356,14 @@ commands:
fi
# Prepare the -Dtest.methods argument, which is optional
if [ "$REPEATED_UTEST_METHODS" == "<nil>" ]; then
if [ "<<parameters.methods>>" == "<nil>" ]; then
methods=""
else
methods="-Dtest.methods=$REPEATED_UTEST_METHODS"
methods="-Dtest.methods=<<parameters.methods>>"
fi
# Run the test target as many times as requested collecting the exit code,
# stopping the iteration only if REPEATED_UTEST_STOP_ON_FAILURE is set.
# stopping the iteration only if stop_on_failure is set.
exit_code="$?"
for i in $(seq -w 1 $count); do
@ -1281,7 +1379,7 @@ commands:
# move the stdout output file
dest=/tmp/results/repeated_utest/stdout/${status}/${i}
mkdir -p $dest
mv stdout.txt $dest/${REPEATED_UTEST_TARGET}-${REPEATED_UTEST_CLASS}.txt
mv stdout.txt $dest/<<parameters.target>>-<<parameters.class>>.txt
# move the XML output files
source=build/test/output
@ -1300,7 +1398,7 @@ commands:
fi
# maybe stop iterations on test failure
if [[ $REPEATED_UTEST_STOP_ON_FAILURE = true ]] && (( $exit_code > 0 )); then
if [[ <<parameters.stop_on_failure>> = true ]] && (( $exit_code > 0 )); then
break
fi
done
@ -1321,30 +1419,41 @@ commands:
destination: logs
run_repeated_dtest:
parameters:
tests:
type: string
vnodes:
type: string
upgrade:
type: string
count:
type: string
stop_on_failure:
type: string
steps:
- run:
name: Run repeated dtest
name: Run repeated Python dtest
no_output_timeout: 15m
command: |
if [ "$REPEATED_DTEST_NAME" == "<nil>" ]; then
if [ "<<parameters.tests>>" == "<nil>" ]; then
echo "Repeated dtest name hasn't been defined, exiting without running any test"
elif [ "$REPEATED_DTEST_COUNT" == "<nil>" ]; then
elif [ "<<parameters.count>>" == "<nil>" ]; then
echo "Repeated dtest count hasn't been defined, exiting without running any test"
elif [ "$REPEATED_DTEST_COUNT" -le 0 ]; then
elif [ "<<parameters.count>>" -le 0 ]; then
echo "Repeated dtest count is lesser or equals than zero, exiting without running any test"
else
# Calculate the number of test iterations to be run by the current parallel runner.
# Since we are running the same test multiple times there is no need to use `circleci tests split`.
count=$((REPEATED_DTEST_COUNT / CIRCLE_NODE_TOTAL))
if (($CIRCLE_NODE_INDEX < (REPEATED_DTEST_COUNT % CIRCLE_NODE_TOTAL))); then
count=$((<<parameters.count>> / CIRCLE_NODE_TOTAL))
if (($CIRCLE_NODE_INDEX < (<<parameters.count>> % CIRCLE_NODE_TOTAL))); then
count=$((count+1))
fi
if (($count <= 0)); then
echo "No tests to run in this runner"
else
echo "Running $REPEATED_DTEST_NAME $count times"
echo "Running <<parameters.tests>> $count times"
source ~/env3.6/bin/activate
export PATH=$JAVA_HOME/bin:$PATH
@ -1358,17 +1467,22 @@ commands:
mkdir -p /tmp/results/dtests
stop_on_failure_arg=""
if $REPEATED_UTEST_STOP_ON_FAILURE; then
if <<parameters.stop_on_failure>>; then
stop_on_failure_arg="-x"
fi
vnodes_args=""
if $REPEATED_DTEST_VNODES; then
if <<parameters.vnodes>>; then
vnodes_args="--use-vnodes --num-tokens=16"
fi
upgrade_arg=""
if <<parameters.upgrade>>; then
upgrade_arg="--execute-upgrade-tests"
fi
# we need the "set -o pipefail" here so that the exit code that circleci will actually use is from pytest and not the exit code from tee
set -o pipefail && cd ~/cassandra-dtest && pytest $vnodes_args --count=$count $stop_on_failure_arg --log-cli-level=DEBUG --junit-xml=/tmp/results/dtests/pytest_result.xml -s --cassandra-dir=/home/cassandra/cassandra --keep-test-dir $REPEATED_DTEST_NAME | tee /tmp/dtest/stdout.txt
set -o pipefail && cd ~/cassandra-dtest && pytest $vnodes_args --count=$count $stop_on_failure_arg $upgrade_arg --log-cli-level=DEBUG --junit-xml=/tmp/results/dtests/pytest_result.xml -s --cassandra-dir=/home/cassandra/cassandra --keep-test-dir <<parameters.tests>> | tee /tmp/dtest/stdout.txt
fi
fi
- store_test_results:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -103,46 +103,77 @@ Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration,
The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information. Note that the higher resources are not available in the free tier of CircleCI.
The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. In an analogous way, upgrade tests can be run repeatedly with the jobs ``repeated_upgrade_dtest``/``repeated_jvm_upgrade_dtest``. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
+------------------------------------+------------------------------------------------------------------+
| Variable | Description |
+====================================+==================================================================+
| ``REPEATED_UTEST_TARGET`` | The Ant test target to run, for example: |
| | |
| | * ``testsome`` |
| | * ``test-jvm-dtest-some`` |
| | * ``test-cdc`` |
| | * ``test-compression`` |
| | * ``test-system-keyspace-directory`` |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_UTEST_CLASS`` | The name of the Java test class to be run multiple times, for |
| | example: |
| | |
| | * ``Rorg.apache.cassandra.cql3.ViewTest`` |
| | * ``Rorg.apache.cassandra.distributed.test.PagingTest`` |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_UTEST_METHODS`` | The optional specific methods within ``REPEATED_UTEST_CLASS`` to |
| | be run, for example: |
| | |
| | * ``testCompoundPartitionKey`` |
| | * ``testCompoundPartitionKey,testStaticTable`` |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_UTEST_COUNT`` | The number of times that the repeated Java test should be run |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_UTEST_STOP_ON_FAILURE`` | Whether the utest iteration should stop on the first failure |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_DTEST_NAME`` | The Python dtest to be run multiple times, for example: |
| | |
| | * ``cqlsh_tests/test_cqlsh.py`` |
| | * ``cqlsh_tests/test_cqlsh.py::TestCqlshSmoke`` |
| | * ``cqlsh_tests/test_cqlsh.py::TestCqlshSmoke::test_insert`` |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_DTEST_VNODES`` | Whether the repeated Python dtest should use vnodes |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_DTEST_COUNT`` | The number of times that the repeated Python dtest should be run |
+------------------------------------+------------------------------------------------------------------+
| ``REPEATED_DTEST_STOP_ON_FAILURE`` | Whether the dtest iteration should stop on the first failure |
+------------------------------------+------------------------------------------------------------------+
+----------------------------------------------+---------------------------------------------------------------+
| Variable | Description |
+==============================================+===============================================================+
|``REPEATED_UTEST_TARGET`` | The Ant test target to run, for example: |
| | |
| | * ``testsome`` |
| | * ``test-jvm-dtest-some`` |
| | * ``test-cdc`` |
| | * ``test-compression`` |
| | * ``test-system-keyspace-directory`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UTEST_CLASS`` | The name of the Java test class to be run multiple times, for |
| | example: |
| | |
| | * ``org.apache.cassandra.cql3.ViewTest`` |
| | * ``org.apache.cassandra.distributed.test.PagingTest`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UTEST_METHODS`` | The optional specific methods within ``REPEATED_UTEST_CLASS`` |
| | to be run, for example: |
| | |
| | * ``testCompoundPartitionKey`` |
| | * ``testCompoundPartitionKey,testStaticTable`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UTEST_COUNT`` | The number of times that the repeated Java test should be run |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UTEST_STOP_ON_FAILURE`` | Whether the utest iteration should stop on the first failure |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_DTEST_NAME`` | The Python dtest to be run multiple times, for example: |
| | |
| | * ``cqlsh_tests/test_cqlsh.py`` |
| | * ``cqlsh_tests/test_cqlsh.py::TestCqlshSmoke`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_DTEST_VNODES`` | Whether the repeated Python dtest should use vnodes |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_DTEST_COUNT`` | The number of times that the repeated Python dtest should be |
| | run |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_DTEST_STOP_ON_FAILURE`` | Whether the dtest iteration should stop on the first failure |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UPGRADE_DTEST_NAME`` | A Python upgrade dtest to be run multiple times, for example: |
| | |
| | * ``upgrade_tests/cql_tests.py`` |
| | * ``upgrade_tests/repair_test.py`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UPGRADE_DTEST_COUNT`` | The number of times that the repeated Python upgrade dtest |
| | should be run |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_UPGRADE_DTEST_STOP_ON_ | Whether the Python upgrade dtest iteration should stop on the |
|FAILURE`` | first failure |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_JVM_UPGRADE_DTEST_CLASS`` | The name of JVM upgrade dtest class to be run multiple times, |
| | for example: |
| | |
| | * | ``org.apache.cassandra.distributed.upgrade.`` |
| | | ``MixedModeAvailabilityV30Test`` |
| | * | ``org.apache.cassandra.distributed.upgrade.`` |
| | | ``MixedModeConsistencyV3XTest`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_JVM_UPGRADE_DTEST_METHODS`` | The optional specific methods within |
| | ``REPEATED_JVM_UPGRADE_DTEST_CLASS`` to be run, for example: |
| | |
| | * ``testAvailabilityV30ToV4`` |
| | * ``testAvailabilityV30ToV3X,testAvailabilityV30ToV4`` |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_JVM_UPGRADE_DTEST_COUNT`` | The number of times that the repeated JVM upgrade dtest |
| | should be run |
+----------------------------------------------+---------------------------------------------------------------+
|``REPEATED_JVM_UPGRADE_DTEST_STOP_ON_FAILURE``| Whether the JVM upgrade dtest iteration should stop on the |
| | first failure |
+----------------------------------------------+---------------------------------------------------------------+