Add an optimized default configuration to tests and make it available for new users

This patch adds a new configuration file, cassandra_latest.yaml, which changes
some of the settings to use new features we usually recommend to users,
including:
- Big Trie-Indexed SSTables
- Trie memtables
- Unified Compaction Strategy
- Storage Attached Index
- Off-heap objects memtables
- Direct-write commit log
- No storage compatibility

These changes are applied in new test targets for unit, in-jvm and python dtests that are
run pre-commit. When changes are made to the new config file, python dtest will use it
directly, but unit and in-jvm dtests require updates, respectively, to latest_diff.yaml
and InstanceConfig.java.

patch by Branimir Lambov; reviewed by Berenguer Blasi for CASSANDRA-18753
This commit is contained in:
Branimir Lambov 2023-11-14 14:30:51 +02:00
parent ebe07db602
commit 06ed1afc34
55 changed files with 7606 additions and 4922 deletions

View File

@ -169,7 +169,7 @@ Running other types of tests with docker:
.build/docker/run-tests.sh test-compression
.build/docker/run-tests.sh test-oa
.build/docker/run-tests.sh test-system-keyspace-directory
.build/docker/run-tests.sh test-tries
.build/docker/run-tests.sh test-latest
.build/docker/run-tests.sh test-burn
.build/docker/run-tests.sh long-test
.build/docker/run-tests.sh cqlsh-test

View File

@ -134,7 +134,7 @@ case ${target} in
# check that ${cassandra_dtest_dir} is valid
[ -f "${cassandra_dtest_dir}/dtest.py" ] || { echo >&2 "${cassandra_dtest_dir}/dtest.py not found. please specify 'cassandra_dtest_dir' to point to the local cassandra-dtest source"; exit 1; }
;;
"test"| "test-cdc" | "test-compression" | "test-oa" | "test-system-keyspace-directory" | "test-trie" | "jvm-dtest" | "jvm-dtest-upgrade" | "jvm-dtest-novnode" | "jvm-dtest-upgrade-novnode" | "simulator-dtest")
"test"| "test-cdc" | "test-compression" | "test-oa" | "test-system-keyspace-directory" | "test-latest" | "jvm-dtest" | "jvm-dtest-upgrade" | "jvm-dtest-novnode" | "jvm-dtest-upgrade-novnode" | "simulator-dtest")
[[ ${mem} -gt $((5 * 1024 * 1024 * 1024 * ${jenkins_executors})) ]] || { echo >&2 "tests require minimum docker memory 6g (per jenkins executor (${jenkins_executors})), found ${mem}"; exit 1; }
max_docker_runs_by_cores=$( echo "sqrt( ${cores} / ${jenkins_executors} )" | bc )
max_docker_runs_by_mem=$(( ${mem} / ( 5 * 1024 * 1024 * 1024 * ${jenkins_executors} ) ))

View File

@ -217,8 +217,8 @@ _main() {
"test-system-keyspace-directory")
_run_testlist "unit" "testclasslist-system-keyspace-directory" "${split_chunk}" "$(_timeout_for 'test.timeout')"
;;
"test-trie")
_run_testlist "unit" "testclasslist-trie" "${split_chunk}" "$(_timeout_for 'test.timeout')"
"test-latest")
_run_testlist "unit" "testclasslist-latest" "${split_chunk}" "$(_timeout_for 'test.timeout')"
;;
"test-burn")
_run_testlist "burn" "testclasslist" "${split_chunk}" "$(_timeout_for 'test.burn.timeout')"

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

@ -134,7 +134,7 @@ default_env_vars: &default_env_vars
# REPEATED_ANT_TEST_TARGET: test-jvm-dtest-some
# REPEATED_ANT_TEST_TARGET: test-cdc
# REPEATED_ANT_TEST_TARGET: test-compression
# REPEATED_ANT_TEST_TARGET: test-trie
# REPEATED_ANT_TEST_TARGET: test-latest
# REPEATED_ANT_TEST_TARGET: test-oa
# REPEATED_ANT_TEST_TARGET: test-system-keyspace-directory
REPEATED_ANT_TEST_TARGET: testsome
@ -149,7 +149,7 @@ default_env_vars: &default_env_vars
REPEATED_ANT_TEST_METHODS:
# Whether the test iteration should use vnodes for JVM dtests (-Dtest.jvm.args='-Dcassandra.dtest.num_tokens=16').
# This will only be applied as a default to JVM dtests that don't provide their own initial tokens or token count,
# in the same way that it's done for *_jvm_dtests_vnode jobs. Ant targets other than JVM dtests will ignore this.
# in the same way that it's done for *_jvm_dtests_latest_vnode jobs. Ant targets other than JVM dtests will ignore this.
REPEATED_ANT_TEST_VNODES: false
# The number of times that the repeated JUnit test should be run.
REPEATED_ANT_TEST_COUNT: 500
@ -277,11 +277,11 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j11_jvm_dtests
- j11_build
- start_j11_jvm_dtests_vnode:
- start_j11_jvm_dtests_latest_vnode:
type: approval
- j11_jvm_dtests_vnode:
- j11_jvm_dtests_latest_vnode:
requires:
- start_j11_jvm_dtests_vnode
- start_j11_jvm_dtests_latest_vnode
- j11_build
- start_j11_jvm_dtests_repeat:
type: approval
@ -289,11 +289,11 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j11_jvm_dtests_repeat
- j11_build
- start_j11_jvm_dtests_vnode_repeat:
- start_j11_jvm_dtests_latest_vnode_repeat:
type: approval
- j11_jvm_dtests_vnode_repeat:
- j11_jvm_dtests_latest_vnode_repeat:
requires:
- start_j11_jvm_dtests_vnode_repeat
- start_j11_jvm_dtests_latest_vnode_repeat
- j11_build
- start_j17_jvm_dtests:
type: approval
@ -301,11 +301,11 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j17_jvm_dtests
- j11_build
- start_j17_jvm_dtests_vnode:
- start_j17_jvm_dtests_latest_vnode:
type: approval
- j17_jvm_dtests_vnode:
- j17_jvm_dtests_latest_vnode:
requires:
- start_j17_jvm_dtests_vnode
- start_j17_jvm_dtests_latest_vnode
- j11_build
- start_j17_jvm_dtests_repeat:
type: approval
@ -313,11 +313,11 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j17_jvm_dtests_repeat
- j11_build
- start_j17_jvm_dtests_vnode_repeat:
- start_j17_jvm_dtests_latest_vnode_repeat:
type: approval
- j17_jvm_dtests_vnode_repeat:
- j17_jvm_dtests_latest_vnode_repeat:
requires:
- start_j17_jvm_dtests_vnode_repeat
- start_j17_jvm_dtests_latest_vnode_repeat
- j11_build
- start_j11_simulator_dtests:
type: approval
@ -465,29 +465,29 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j17_utests_compression_repeat
- j11_build
- start_j11_utests_trie:
- start_j11_utests_latest:
type: approval
- j11_utests_trie:
- j11_utests_latest:
requires:
- start_j11_utests_trie
- start_j11_utests_latest
- j11_build
- start_j17_utests_trie:
- start_j17_utests_latest:
type: approval
- j17_utests_trie:
- j17_utests_latest:
requires:
- start_j17_utests_trie
- start_j17_utests_latest
- j11_build
- start_j11_utests_trie_repeat:
- start_j11_utests_latest_repeat:
type: approval
- j11_utests_trie_repeat:
- j11_utests_latest_repeat:
requires:
- start_j11_utests_trie_repeat
- start_j11_utests_latest_repeat
- j11_build
- start_j17_utests_trie_repeat:
- start_j17_utests_latest_repeat:
type: approval
- j17_utests_trie_repeat:
- j17_utests_latest_repeat:
requires:
- start_j17_utests_trie_repeat
- start_j17_utests_latest_repeat
- j11_build
- start_j11_utests_stress:
type: approval
@ -594,17 +594,17 @@ j11_separate_jobs: &j11_separate_jobs
- start_j11_dtests_vnode
- j11_build
# Java 11 off-heap dtests
- start_j11_dtests_offheap:
- start_j11_dtests_latest:
type: approval
- j11_dtests_offheap:
- j11_dtests_latest:
requires:
- start_j11_dtests_offheap
- start_j11_dtests_latest
- j11_build
- start_j11_dtests_offheap_repeat:
- start_j11_dtests_latest_repeat:
type: approval
- j11_dtests_offheap_repeat:
- j11_dtests_latest_repeat:
requires:
- start_j11_dtests_offheap_repeat
- start_j11_dtests_latest_repeat
- j11_build
# Java 17 dtests
- start_j17_dtests:
@ -620,17 +620,17 @@ j11_separate_jobs: &j11_separate_jobs
- start_j17_dtests_vnode
- j11_build
# Java 17 off-heap dtests
- start_j17_dtests_offheap:
- start_j17_dtests_latest:
type: approval
- j17_dtests_offheap:
- j17_dtests_latest:
requires:
- start_j17_dtests_offheap
- start_j17_dtests_latest
- j11_build
- start_j17_dtests_offheap_repeat:
- start_j17_dtests_latest_repeat:
type: approval
- j17_dtests_offheap_repeat:
- j17_dtests_latest_repeat:
requires:
- start_j17_dtests_offheap_repeat
- start_j17_dtests_latest_repeat
- j11_build
# Python large DTests
- start_j11_dtests_large:
@ -700,16 +700,16 @@ j11_separate_jobs: &j11_separate_jobs
requires:
- start_j11_cqlsh_tests
- j11_build
# Java 11 cqlsh offheap dtests offheap
- start_j11_cqlsh_tests_offheap:
# Java 11 cqlsh latest dtests
- start_j11_cqlsh_tests_latest:
type: approval
- j11_cqlsh_dtests_py38_offheap:
- j11_cqlsh_dtests_py38_latest:
requires:
- start_j11_cqlsh_tests_offheap
- start_j11_cqlsh_tests_latest
- j11_build
- j11_cqlsh_dtests_py311_offheap:
- j11_cqlsh_dtests_py311_latest:
requires:
- start_j11_cqlsh_tests_offheap
- start_j11_cqlsh_tests_latest
- j11_build
# Java 17 cqlsh dtests
- start_j17_cqlsh_tests:
@ -731,15 +731,15 @@ j11_separate_jobs: &j11_separate_jobs
- start_j17_cqlsh_tests
- j11_build
# Java 17 cqlsh dtests off-heap
- start_j17_cqlsh_tests_offheap:
- start_j17_cqlsh_tests_latest:
type: approval
- j17_cqlsh_dtests_py38_offheap:
- j17_cqlsh_dtests_py38_latest:
requires:
- start_j17_cqlsh_tests_offheap
- start_j17_cqlsh_tests_latest
- j11_build
- j17_cqlsh_dtests_py311_offheap:
- j17_cqlsh_dtests_py311_latest:
requires:
- start_j17_cqlsh_tests_offheap
- start_j17_cqlsh_tests_latest
- j11_build
# Java 11 upgrade tests
- start_j11_upgrade_dtests:
@ -819,6 +819,12 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j11_unit_tests_repeat:
requires:
- j11_build
- j11_utests_latest:
requires:
- j11_build
- j11_utests_latest_repeat:
requires:
- j11_build
- j11_simulator_dtests:
requires:
- j11_build
@ -831,10 +837,10 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j11_jvm_dtests_repeat:
requires:
- j11_build
- j11_jvm_dtests_vnode:
- j11_jvm_dtests_latest_vnode:
requires:
- j11_build
- j11_jvm_dtests_vnode_repeat:
- j11_jvm_dtests_latest_vnode_repeat:
requires:
- j11_build
- j17_jvm_dtests:
@ -843,10 +849,10 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j17_jvm_dtests_repeat:
requires:
- j11_build
- j17_jvm_dtests_vnode:
- j17_jvm_dtests_latest_vnode:
requires:
- j11_build
- j17_jvm_dtests_vnode_repeat:
- j17_jvm_dtests_latest_vnode_repeat:
requires:
- j11_build
- j11_cqlshlib_tests:
@ -871,6 +877,12 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j17_unit_tests_repeat:
requires:
- j11_build
- j17_utests_latest:
requires:
- j11_build
- j17_utests_latest_repeat:
requires:
- j11_build
# specialized unit tests (all run on request)
- start_utests_long:
type: approval
@ -926,24 +938,6 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
requires:
- start_utests_compression
- j11_build
- start_utests_trie:
type: approval
- j11_utests_trie:
requires:
- start_utests_trie
- j11_build
- j17_utests_trie:
requires:
- start_utests_trie
- j11_build
- j11_utests_trie_repeat:
requires:
- start_utests_trie
- j11_build
- j17_utests_trie_repeat:
requires:
- start_utests_trie
- j11_build
- start_utests_stress:
type: approval
- j11_utests_stress:
@ -1022,15 +1016,11 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j11_dtests_vnode_repeat:
requires:
- j11_build
- start_j11_dtests_offheap:
type: approval
- j11_dtests_offheap:
- j11_dtests_latest:
requires:
- start_j11_dtests_offheap
- j11_build
- j11_dtests_offheap_repeat:
- j11_dtests_latest_repeat:
requires:
- start_j11_dtests_offheap
- j11_build
# Java 17 dtests
- j17_dtests:
@ -1045,15 +1035,11 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j17_dtests_vnode_repeat:
requires:
- j11_build
- start_j17_dtests_offheap:
type: approval
- j17_dtests_offheap:
- j17_dtests_latest:
requires:
- start_j17_dtests_offheap
- j11_build
- j17_dtests_offheap_repeat:
- j17_dtests_latest_repeat:
requires:
- start_j17_dtests_offheap
- j11_build
# Large Python DTests
- start_j11_dtests_large:
@ -1105,16 +1091,16 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
- j11_cqlsh_dtests_py311_vnode:
requires:
- j11_build
# Java 11 cqlsh dtests offheap
- start_j11_cqlsh_dtests_offheap:
# Java 11 cqlsh dtests latest
- start_j11_cqlsh_dtests_latest:
type: approval
- j11_cqlsh_dtests_py38_offheap:
- j11_cqlsh_dtests_py38_latest:
requires:
- start_j11_cqlsh_dtests_offheap
- start_j11_cqlsh_dtests_latest
- j11_build
- j11_cqlsh_dtests_py311_offheap:
- j11_cqlsh_dtests_py311_latest:
requires:
- start_j11_cqlsh_dtests_offheap
- start_j11_cqlsh_dtests_latest
- j11_build
# Java 17 cqlsh dtests
- j17_cqlsh_dtests_py38:
@ -1130,15 +1116,15 @@ j11_pre-commit_jobs: &j11_pre-commit_jobs
requires:
- j11_build
# Java 17 cqlsh dtests off-heap
- start_j17_cqlsh-dtests-offheap:
- start_j17_cqlsh-dtests-latest:
type: approval
- j17_cqlsh_dtests_py38_offheap:
- j17_cqlsh_dtests_py38_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j11_build
- j17_cqlsh_dtests_py311_offheap:
- j17_cqlsh_dtests_py311_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j11_build
# Java 11 upgrade tests (on request)
- start_j11_upgrade_dtests:
@ -1178,11 +1164,11 @@ j17_separate_jobs: &j17_separate_jobs
requires:
- start_j17_jvm_dtests
- j17_build
- start_j17_jvm_dtests_vnode:
- start_j17_jvm_dtests_latest_vnode:
type: approval
- j17_jvm_dtests_vnode:
- j17_jvm_dtests_latest_vnode:
requires:
- start_j17_jvm_dtests_vnode
- start_j17_jvm_dtests_latest_vnode
- j17_build
- start_j17_jvm_dtests_repeat:
type: approval
@ -1190,11 +1176,11 @@ j17_separate_jobs: &j17_separate_jobs
requires:
- start_j17_jvm_dtests_repeat
- j17_build
- start_j17_jvm_dtests_vnode_repeat:
- start_j17_jvm_dtests_latest_vnode_repeat:
type: approval
- j17_jvm_dtests_vnode_repeat:
- j17_jvm_dtests_latest_vnode_repeat:
requires:
- start_j17_jvm_dtests_vnode_repeat
- start_j17_jvm_dtests_latest_vnode_repeat
- j17_build
- start_j17_cqlshlib_tests:
type: approval
@ -1221,17 +1207,17 @@ j17_separate_jobs: &j17_separate_jobs
requires:
- start_j17_dtests_vnode
- j17_build
- start_j17_dtests_offheap:
- start_j17_dtests_latest:
type: approval
- j17_dtests_offheap:
- j17_dtests_latest:
requires:
- start_j17_dtests_offheap
- start_j17_dtests_latest
- j17_build
- start_j17_dtests_offheap_repeat:
- start_j17_dtests_latest_repeat:
type: approval
- j17_dtests_offheap_repeat:
- j17_dtests_latest_repeat:
requires:
- start_j17_dtests_offheap_repeat
- start_j17_dtests_latest_repeat
- j17_build
- start_j17_dtests_large:
type: approval
@ -1275,15 +1261,15 @@ j17_separate_jobs: &j17_separate_jobs
requires:
- start_j17_cqlsh_tests
- j17_build
- start_j17_cqlsh-dtests-offheap:
- start_j17_cqlsh-dtests-latest:
type: approval
- j17_cqlsh_dtests_py38_offheap:
- j17_cqlsh_dtests_py38_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j17_build
- j17_cqlsh_dtests_py311_offheap:
- j17_cqlsh_dtests_py311_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j17_build
# specialized unit tests (all run on request)
- start_j17_utests_oa:
@ -1334,17 +1320,17 @@ j17_separate_jobs: &j17_separate_jobs
requires:
- start_j17_utests_compression_repeat
- j17_build
- start_j17_utests_trie:
- start_j17_utests_latest:
type: approval
- j17_utests_trie:
- j17_utests_latest:
requires:
- start_j17_utests_trie
- start_j17_utests_latest
- j17_build
- start_j17_utests_trie_repeat:
- start_j17_utests_latest_repeat:
type: approval
- j17_utests_trie_repeat:
- j17_utests_latest_repeat:
requires:
- start_j17_utests_trie_repeat
- start_j17_utests_latest_repeat
- j17_build
- start_j17_utests_stress:
type: approval
@ -1422,16 +1408,22 @@ j17_pre-commit_jobs: &j17_pre-commit_jobs
- j17_unit_tests_repeat:
requires:
- j17_build
- j17_utests_latest:
requires:
- j17_build
- j17_utests_latest_repeat:
requires:
- j17_build
- j17_jvm_dtests:
requires:
- j17_build
- j17_jvm_dtests_repeat:
requires:
- j17_build
- j17_jvm_dtests_vnode:
- j17_jvm_dtests_latest_vnode:
requires:
- j17_build
- j17_jvm_dtests_vnode_repeat:
- j17_jvm_dtests_latest_vnode_repeat:
requires:
- j17_build
- j17_cqlshlib_tests:
@ -1452,17 +1444,11 @@ j17_pre-commit_jobs: &j17_pre-commit_jobs
- j17_dtests_vnode_repeat:
requires:
- j17_build
- start_j17_dtests_offheap:
type: approval
- j17_dtests_offheap:
- j17_dtests_latest:
requires:
- start_j17_dtests_offheap
- j17_build
- start_j17_dtests_offheap_repeat:
type: approval
- j17_dtests_offheap_repeat:
- j17_dtests_latest_repeat:
requires:
- start_j17_dtests_offheap_repeat
- j17_build
- start_j17_dtests_large:
type: approval
@ -1494,15 +1480,15 @@ j17_pre-commit_jobs: &j17_pre-commit_jobs
- j17_cqlsh_dtests_py311_vnode:
requires:
- j17_build
- start_j17_cqlsh-dtests-offheap:
- start_j17_cqlsh-dtests-latest:
type: approval
- j17_cqlsh_dtests_py38_offheap:
- j17_cqlsh_dtests_py38_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j17_build
- j17_cqlsh_dtests_py311_offheap:
- j17_cqlsh_dtests_py311_latest:
requires:
- start_j17_cqlsh-dtests-offheap
- start_j17_cqlsh-dtests-latest
- j17_build
# specialized unit tests (all run on request)
- start_utests_long:
@ -1535,16 +1521,6 @@ j17_pre-commit_jobs: &j17_pre-commit_jobs
requires:
- start_utests_compression
- j17_build
- start_utests_trie:
type: approval
- j17_utests_trie:
requires:
- start_utests_trie
- j17_build
- j17_utests_trie_repeat:
requires:
- start_utests_trie
- j17_build
- start_utests_stress:
type: approval
- j17_utests_stress:
@ -1690,7 +1666,7 @@ jobs:
classlistprefix: distributed
target: "testclasslist"
j11_jvm_dtests_vnode:
j11_jvm_dtests_latest_vnode:
<<: *j11_small_par_executor
steps:
- attach_workspace:
@ -1702,7 +1678,7 @@ jobs:
- run_parallel_junit_tests:
classlistprefix: distributed
target: "testclasslist"
arguments: "-Dtest.jvm.args='-Dcassandra.dtest.num_tokens=16'"
arguments: "-Dtest.jvm.args='-Dcassandra.dtest.num_tokens=16 -Djvm_dtests.latest=true'"
j17_jvm_dtests:
<<: *j17_small_par_executor
@ -1730,7 +1706,7 @@ jobs:
classlistprefix: distributed
target: "testclasslist"
j17_jvm_dtests_vnode:
j17_jvm_dtests_latest_vnode:
<<: *j17_small_par_executor
steps:
- attach_workspace:
@ -1742,7 +1718,7 @@ jobs:
- run_parallel_junit_tests:
classlistprefix: distributed
target: "testclasslist"
arguments: "-Dtest.jvm.args='-Dcassandra.dtest.num_tokens=16'"
arguments: "-Dtest.jvm.args='-Dcassandra.dtest.num_tokens=16 -Djvm_dtests.latest=true'"
j17_unit_tests:
<<: *j17_par_executor
@ -1847,7 +1823,7 @@ jobs:
- run_parallel_junit_tests:
target: testclasslist-compression
j11_utests_trie:
j11_utests_latest:
<<: *j11_par_executor
steps:
- attach_workspace:
@ -1855,9 +1831,9 @@ jobs:
- create_junit_containers
- log_environment
- run_parallel_junit_tests:
target: testclasslist-trie
target: testclasslist-latest
j17_utests_trie:
j17_utests_latest:
<<: *j17_par_executor
steps:
- attach_workspace:
@ -1865,7 +1841,7 @@ jobs:
- create_junit_containers
- log_environment
- run_parallel_junit_tests:
target: testclasslist-trie
target: testclasslist-latest
j11_utests_stress:
<<: *j11_seq_executor
@ -1933,7 +1909,7 @@ jobs:
file_tag: j11_with_vnodes
pytest_extra_args: '--use-vnodes --num-tokens=16 --skip-resource-intensive-tests'
j11_dtests_offheap:
j11_dtests_latest:
<<: *j11_par_executor
steps:
- attach_workspace:
@ -1941,11 +1917,11 @@ jobs:
- clone_dtest
- create_venv
- create_dtest_containers:
file_tag: j11_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k not cql'"
file_tag: j11_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k not cql'"
- run_dtests:
file_tag: j11_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j11_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
j17_dtests_vnode:
<<: *j17_par_executor
@ -1962,7 +1938,7 @@ jobs:
file_tag: j17_with_vnodes
pytest_extra_args: '--use-vnodes --num-tokens=16 --skip-resource-intensive-tests'
j17_dtests_offheap:
j17_dtests_latest:
<<: *j17_par_executor
steps:
- attach_workspace:
@ -1971,11 +1947,11 @@ jobs:
- clone_dtest
- create_venv
- create_dtest_containers:
file_tag: j17_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k not cql'"
file_tag: j17_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k not cql'"
- run_dtests:
file_tag: j17_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j17_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
j11_dtests:
<<: *j11_par_executor
@ -2056,7 +2032,7 @@ jobs:
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.11'
python_version: '3.11'
j11_cqlsh_dtests_py38_offheap:
j11_cqlsh_dtests_py38_latest:
<<: *j11_par_executor
steps:
- attach_workspace:
@ -2065,16 +2041,16 @@ jobs:
- create_venv:
python_version: '3.8'
- create_dtest_containers:
file_tag: j11_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k cql'"
file_tag: j11_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k cql'"
python_version: '3.8'
- run_dtests:
file_tag: j11_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j11_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.8'
python_version: '3.8'
j11_cqlsh_dtests_py311_offheap:
j11_cqlsh_dtests_py311_latest:
<<: *j11_par_executor
steps:
- attach_workspace:
@ -2083,12 +2059,12 @@ jobs:
- create_venv:
python_version: '3.11'
- create_dtest_containers:
file_tag: j11_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k cql'"
file_tag: j11_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k cql'"
python_version: '3.11'
- run_dtests:
file_tag: j11_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j11_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.11'
python_version: '3.11'
@ -2164,7 +2140,7 @@ jobs:
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.11'
python_version: '3.11'
j17_cqlsh_dtests_py38_offheap:
j17_cqlsh_dtests_py38_latest:
<<: *j17_par_executor
steps:
- attach_workspace:
@ -2173,16 +2149,16 @@ jobs:
- create_venv:
python_version: '3.8'
- create_dtest_containers:
file_tag: j17_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k cql'"
file_tag: j17_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k cql'"
python_version: '3.8'
- run_dtests:
file_tag: j17_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j17_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.8'
python_version: '3.8'
j17_cqlsh_dtests_py311_offheap:
j17_cqlsh_dtests_py311_latest:
<<: *j17_par_executor
steps:
- attach_workspace:
@ -2191,12 +2167,12 @@ jobs:
- create_venv:
python_version: '3.11'
- create_dtest_containers:
file_tag: j17_dtests_offheap
run_dtests_extra_args: "--use-vnodes --use-off-heap-memtables --skip-resource-intensive-tests --pytest-options '-k cql'"
file_tag: j17_dtests_latest
run_dtests_extra_args: "--use-vnodes --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests --pytest-options '-k cql'"
python_version: '3.11'
- run_dtests:
file_tag: j17_dtests_offheap
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
file_tag: j17_dtests_latest
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
extra_env_args: 'CQLSH_PYTHON=/usr/bin/python3.11'
python_version: '3.11'
@ -2340,21 +2316,21 @@ jobs:
- log_environment
- run_utests_compression_repeat
j11_utests_trie_repeat:
j11_utests_latest_repeat:
<<: *j11_repeated_utest_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_utests_trie_repeat
- run_utests_latest_repeat
j17_utests_trie_repeat:
j17_utests_latest_repeat:
<<: *j17_repeated_utest_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_utests_trie_repeat
- run_utests_latest_repeat
j11_utests_oa_repeat:
<<: *j11_repeated_utest_executor
@ -2452,13 +2428,13 @@ jobs:
- log_environment
- run_jvm_dtests_repeat
j11_jvm_dtests_vnode_repeat:
j11_jvm_dtests_latest_vnode_repeat:
<<: *j11_repeated_utest_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_jvm_dtests_vnode_repeat
- run_jvm_dtests_latest_vnode_repeat
j11_simulator_dtests_repeat:
<<: *j11_repeated_utest_executor
@ -2476,13 +2452,13 @@ jobs:
- log_environment
- run_jvm_dtests_repeat
j17_jvm_dtests_vnode_repeat:
j17_jvm_dtests_latest_vnode_repeat:
<<: *j17_repeated_utest_executor
steps:
- attach_workspace:
at: /home/cassandra
- log_environment
- run_jvm_dtests_vnode_repeat
- run_jvm_dtests_latest_vnode_repeat
j11_repeated_ant_test:
<<: *j11_repeated_utest_executor
@ -2540,7 +2516,7 @@ jobs:
count: ${REPEATED_DTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
j11_dtests_offheap_repeat:
j11_dtests_latest_repeat:
<<: *j11_repeated_dtest_executor
steps:
- attach_workspace:
@ -2553,7 +2529,7 @@ jobs:
upgrade: "false"
count: ${REPEATED_DTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
extra_dtest_args: "--use-off-heap-memtables --skip-resource-intensive-tests"
extra_dtest_args: "--configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests"
j11_dtests_large_repeat:
<<: *j11_repeated_dtest_executor
@ -2615,7 +2591,7 @@ jobs:
count: ${REPEATED_DTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
j17_dtests_offheap_repeat:
j17_dtests_latest_repeat:
<<: *j17_repeated_dtest_executor
steps:
- attach_workspace:
@ -2628,7 +2604,7 @@ jobs:
upgrade: "false"
count: ${REPEATED_DTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
extra_dtest_args: "--use-off-heap-memtables --skip-resource-intensive-tests"
extra_dtest_args: "--configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests"
j17_dtests_large_repeat:
<<: *j17_repeated_dtest_executor
@ -3098,10 +3074,10 @@ commands:
count: ${REPEATED_UTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
run_utests_trie_repeat:
run_utests_latest_repeat:
steps:
- run_repeated_utests:
target: test-trie
target: test-latest
tests: ${REPEATED_UTESTS}
count: ${REPEATED_UTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
@ -3163,7 +3139,7 @@ commands:
count: ${REPEATED_SIMULATOR_DTESTS_COUNT}
stop_on_failure: ${REPEATED_TESTS_STOP_ON_FAILURE}
run_jvm_dtests_vnode_repeat:
run_jvm_dtests_latest_vnode_repeat:
steps:
- run_repeated_utests:
target: test-jvm-dtest-some
@ -3233,8 +3209,8 @@ commands:
testtag="compression"
elif [[ $target == "test-system-keyspace-directory" ]]; then
testtag="system_keyspace_directory"
elif [[ $target == "test-trie" ]]; then
testtag="trie"
elif [[ $target == "test-latest" ]]; then
testtag="latest"
elif [[ $target == "test-oa" ]]; then
testtag="oa"
fi
@ -3257,7 +3233,7 @@ commands:
if [[ $target == "test" || \
$target == "test-cdc" || \
$target == "test-compression" || \
$target == "test-trie" || \
$target == "test-latest" || \
$target == "test-oa" || \
$target == "test-system-keyspace-directory" || \
$target == "fqltool-test" || \
@ -3385,7 +3361,7 @@ commands:
if [[ $target == "test" || \
$target == "test-cdc" || \
$target == "test-compression" || \
$target == "test-trie" || \
$target == "test-latest" || \
$target == "test-oa" || \
$target == "test-system-keyspace-directory" || \
$target == "fqltool-test" || \

View File

@ -1,5 +1,5 @@
--- config_template.yml 2024-01-05 00:32:24.148600479 +0000
+++ config_template.yml.PAID 2024-01-05 00:32:40.861079981 +0000
--- config_template.yml 2024-02-29 12:11:33.962348946 +0200
+++ config_template.yml.PAID 2024-02-29 12:18:07.186939536 +0200
@@ -157,20 +157,20 @@
j11_par_executor: &j11_par_executor
executor:
@ -142,7 +142,7 @@
j11_separate_jobs: &j11_separate_jobs
jobs:
@@ -1920,7 +1943,7 @@
@@ -1896,7 +1919,7 @@
target: testclasslist-system-keyspace-directory
j11_dtests_vnode:
@ -151,17 +151,17 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -1934,7 +1957,7 @@
@@ -1910,7 +1933,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --skip-resource-intensive-tests'
j11_dtests_offheap:
j11_dtests_latest:
- <<: *j11_par_executor
+ <<: *j11_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -1948,7 +1971,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
@@ -1924,7 +1947,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
j17_dtests_vnode:
- <<: *j17_par_executor
@ -169,17 +169,17 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -1963,7 +1986,7 @@
@@ -1939,7 +1962,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --skip-resource-intensive-tests'
j17_dtests_offheap:
j17_dtests_latest:
- <<: *j17_par_executor
+ <<: *j17_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -1978,7 +2001,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --use-off-heap-memtables --skip-resource-intensive-tests'
@@ -1954,7 +1977,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --configuration-yaml=cassandra_latest.yaml --skip-resource-intensive-tests'
j11_dtests:
- <<: *j11_par_executor
@ -187,7 +187,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -1992,7 +2015,7 @@
@@ -1968,7 +1991,7 @@
pytest_extra_args: '--skip-resource-intensive-tests'
j17_dtests:
@ -196,7 +196,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2007,7 +2030,7 @@
@@ -1983,7 +2006,7 @@
pytest_extra_args: '--skip-resource-intensive-tests'
j11_upgrade_dtests:
@ -205,7 +205,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2021,7 +2044,7 @@
@@ -1997,7 +2020,7 @@
pytest_extra_args: '--execute-upgrade-tests-only --upgrade-target-version-only --upgrade-version-selection all'
j11_cqlsh_dtests_py38_vnode:
@ -214,7 +214,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2039,7 +2062,7 @@
@@ -2015,7 +2038,7 @@
python_version: '3.8'
j11_cqlsh_dtests_py311_vnode:
@ -223,25 +223,25 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2057,7 +2080,7 @@
@@ -2033,7 +2056,7 @@
python_version: '3.11'
j11_cqlsh_dtests_py38_offheap:
j11_cqlsh_dtests_py38_latest:
- <<: *j11_par_executor
+ <<: *j11_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -2075,7 +2098,7 @@
@@ -2051,7 +2074,7 @@
python_version: '3.8'
j11_cqlsh_dtests_py311_offheap:
j11_cqlsh_dtests_py311_latest:
- <<: *j11_par_executor
+ <<: *j11_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -2093,7 +2116,7 @@
@@ -2069,7 +2092,7 @@
python_version: '3.11'
j11_cqlsh_dtests_py38:
@ -250,7 +250,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2111,7 +2134,7 @@
@@ -2087,7 +2110,7 @@
python_version: '3.8'
j11_cqlsh_dtests_py311:
@ -259,7 +259,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2129,7 +2152,7 @@
@@ -2105,7 +2128,7 @@
python_version: '3.11'
j17_cqlsh_dtests_py38_vnode:
@ -268,7 +268,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2147,7 +2170,7 @@
@@ -2123,7 +2146,7 @@
python_version: '3.8'
j17_cqlsh_dtests_py311_vnode:
@ -277,25 +277,25 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2165,7 +2188,7 @@
@@ -2141,7 +2164,7 @@
python_version: '3.11'
j17_cqlsh_dtests_py38_offheap:
j17_cqlsh_dtests_py38_latest:
- <<: *j17_par_executor
+ <<: *j17_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -2183,7 +2206,7 @@
@@ -2159,7 +2182,7 @@
python_version: '3.8'
j17_cqlsh_dtests_py311_offheap:
j17_cqlsh_dtests_py311_latest:
- <<: *j17_par_executor
+ <<: *j17_large_par_executor
steps:
- attach_workspace:
at: /home/cassandra
@@ -2201,7 +2224,7 @@
@@ -2177,7 +2200,7 @@
python_version: '3.11'
j17_cqlsh_dtests_py38:
@ -304,7 +304,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2219,7 +2242,7 @@
@@ -2195,7 +2218,7 @@
python_version: '3.8'
j17_cqlsh_dtests_py311:
@ -313,7 +313,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2237,7 +2260,7 @@
@@ -2213,7 +2236,7 @@
python_version: '3.11'
j11_dtests_large_vnode:
@ -322,7 +322,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2251,7 +2274,7 @@
@@ -2227,7 +2250,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --only-resource-intensive-tests --force-resource-intensive-tests'
j11_dtests_large:
@ -331,7 +331,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2265,7 +2288,7 @@
@@ -2241,7 +2264,7 @@
pytest_extra_args: '--only-resource-intensive-tests --force-resource-intensive-tests'
j17_dtests_large_vnode:
@ -340,7 +340,7 @@
steps:
- attach_workspace:
at: /home/cassandra
@@ -2279,7 +2302,7 @@
@@ -2255,7 +2278,7 @@
pytest_extra_args: '--use-vnodes --num-tokens=16 --only-resource-intensive-tests --force-resource-intensive-tests'
j17_dtests_large:

12
.jenkins/Jenkinsfile vendored
View File

@ -283,7 +283,7 @@ pipeline {
}
}
}
stage('trie') {
stage('latest') {
steps {
script {
def attempt = 1
@ -292,18 +292,18 @@ pipeline {
sleep(60 * attempt)
}
attempt = attempt + 1
trie = build job: "${env.JOB_NAME}-test-trie", propagate: false
if (trie.result != 'FAILURE') break
latest = build job: "${env.JOB_NAME}-test-latest", propagate: false
if (latest.result != 'FAILURE') break
}
if (trie.result != 'SUCCESS') unstable('trie failures')
if (trie.result == 'FAILURE') currentBuild.result='FAILURE'
if (latest.result != 'SUCCESS') unstable('test-latest failures')
if (latest.result == 'FAILURE') currentBuild.result='FAILURE'
}
}
post {
always {
warnError('missing test xml files') {
script {
copyTestResults('test-trie', trie.getNumber())
copyTestResults('test-latest', latest.getNumber())
}
}
}

View File

@ -1,4 +1,5 @@
5.0-beta2
* Add an optimized default configuration to tests and make it available for new users (CASSANDRA-18753)
* Fix remote JMX under Java17 (CASSANDRA-19453)
* Avoid consistency violations for SAI intersections over unrepaired data at consistency levels requiring reconciliation (CASSANDRA-19018)
* Fix NullPointerException in ANN+WHERE when adding rows in another partition (CASSANDRA-19404)

View File

@ -71,6 +71,12 @@ using the provided 'sstableupgrade' tool.
New features
------------
- A new configuration file, `cassandra_latest.yaml`, is provided for users that would like to evaluate and
experiment with the latest recommended features and changes in Cassandra, which provide improved functionality and
performance. This file is intended to be used in a development environment and is only recommended for production
use after careful evaluation. The file is located in the conf directory and is not selected by default.
To use it, one may specify the file using the `-Dcassandra.config` option, e.g. by running
`cassandra -Dcassandra.config=file://$CASSANDRA_HOME/conf/cassandra_latest.yaml`.
- Added a new authorizer, CIDR authorizer, to restrict user access based on CIDR groups.
- Pluggable crypto providers were made possible via `crypto_provider` section in cassandra.yaml. The default provider is
Amazon Corretto Crypto Provider and it is installed automatically upon node's start. Only x86_64 and aarch64 architectures are supported now.

View File

@ -1294,22 +1294,22 @@
</sequential>
</macrodef>
<macrodef name="testlist-trie">
<macrodef name="testlist-latest">
<attribute name="test.file.list" />
<sequential>
<property name="trie_yaml" value="${build.test.dir}/cassandra.trie.yaml"/>
<concat destfile="${trie_yaml}">
<property name="latest_yaml" value="${build.test.dir}/cassandra.latest.yaml"/>
<concat destfile="${latest_yaml}">
<fileset file="${test.conf}/cassandra.yaml"/>
<fileset file="${test.conf}/trie_memtable.yaml"/>
<fileset file="${test.conf}/latest_diff.yaml"/>
<fileset file="${test.conf}/storage_compatibility_mode_none.yaml"/>
</concat>
<testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
exclude="**/*.java" timeout="${test.timeout}" testtag="trie">
exclude="**/*.java" timeout="${test.timeout}" testtag="latest">
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.config=file:///${trie_yaml}"/>
<jvmarg value="-Dcassandra.config=file:///${latest_yaml}"/>
<jvmarg value="-Dcassandra.test.storage_compatibility_mode=NONE"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
</testmacrohelper>
@ -1427,12 +1427,12 @@
<testhelper testdelegate="testlist-cdc" />
</target>
<target name="test-trie" depends="maybe-build-test" description="Execute unit tests with trie memtables">
<target name="test-latest" depends="maybe-build-test" description="Execute unit tests with configuration matching cassandra_latest.yaml">
<path id="all-test-classes-path">
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
</path>
<property name="all-test-classes" refid="all-test-classes-path"/>
<testhelper testdelegate="testlist-trie" />
<testhelper testdelegate="testlist-latest" />
</target>
<target name="test-oa" depends="maybe-build-test" description="Test Runner for the oa sstable format">
@ -1697,12 +1697,12 @@
<property name="all-test-classes" refid="all-test-classes-path"/>
<testhelper testdelegate="testlist-compression"/>
</target>
<target name="testclasslist-trie" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
<target name="testclasslist-latest" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
<path id="all-test-classes-path">
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
</path>
<property name="all-test-classes" refid="all-test-classes-path"/>
<testhelper testdelegate="testlist-trie"/>
<testhelper testdelegate="testlist-latest"/>
</target>
<target name="testclasslist-cdc" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
<path id="all-test-classes-path">
@ -1772,7 +1772,17 @@
</testmacro>
</target>
<property name="simulator.asm.print" value="none"/> <!-- Supports: NONE, CLASS_SUMMARY, CLASS_DETAIL, METHOD_SUMMARY, METHOD_DETAIL, ASM; see org.apache.cassandra.simulator.asm.MethodLogger.Level -->
<target name="test-jvm-dtest-latest" depends="maybe-build-test" description="Execute in-jvm dtests with latest configuration">
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true" filter="**/test/${test.name}.java">
<jvmarg value="-Djvm_dtests.latest=true"/>
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
</testmacro>
</target>
<property name="simulator.asm.print" value="none"/> <!-- Supports: NONE, CLASS_SUMMARY, CLASS_DETAIL, METHOD_SUMMARY, METHOD_DETAIL, ASM; see org.apache.cassandra.simulator.asm.MethodLogger.Level -->
<target name="test-simulator-dtest" depends="maybe-build-test" description="Execute simulator dtests">
<testmacro inputdir="${test.simulator-test.src}" timeout="${test.simulation.timeout}" forkmode="perTest" showoutput="true" filter="**/test/${test.name}.java">
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-simulator.xml"/>
@ -1825,7 +1835,20 @@
</testmacro>
</target>
<target name="generate-unified-test-report" description="Merge all unit xml files into one, generate html pages, and print summary test numbers">
<target name="test-jvm-dtest-latest-some" depends="maybe-build-test" description="Execute some in-jvm dtests with latest configuration">
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true">
<test unless:blank="${test.methods}" name="${test.name}" methods="${test.methods}" todir="${build.test.dir}/output/" outfile="TEST-${test.name}-${test.methods}"/>
<test if:blank="${test.methods}" name="${test.name}" todir="${build.test.dir}/output/" outfile="TEST-${test.name}"/>
<jvmarg value="-Djvm_dtests.latest=true"/>
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
</testmacro>
</target>
<target name="generate-unified-test-report" description="Merge all unit xml files into one, generate html pages, and print summary test numbers">
<junitreport todir="${build.dir}">
<fileset dir="${build.test.dir}/output">
<include name="**/TEST*.xml"/>

View File

@ -6,6 +6,21 @@
# full explanations of configuration directives
# /NOTE
# NOTE:
# This file is provided in two versions:
# - cassandra.yaml: Contains configuration defaults for a "compatible"
# configuration that operates using settings that are backwards-compatible
# and interoperable with machines running older versions of Cassandra.
# This version is provided to facilitate pain-free upgrades for existing
# users of Cassandra running in production who want to gradually and
# carefully introduce new features.
# - cassandra_latest.yaml: Contains configuration defaults that enable
# the latest features of Cassandra, including improved functionality as
# well as higher performance. This version is provided for new users of
# Cassandra who want to get the most out of their cluster, and for users
# evaluating the technology.
# /NOTE
# The name of the cluster. This is mainly used to prevent machines in
# one logical cluster from joining another.
cluster_name: 'Test Cluster'
@ -703,6 +718,31 @@ concurrent_materialized_view_writes: 32
# spinning (for spinning disks)
# disk_optimization_strategy: ssd
# Supported memtable implementations and selected default.
# Currently Cassandra offers two memtable implementations:
# - SkipListMemtable is the legacy memtable implementation provided by earlier
# versions of Cassandra.
# - TrieMemtable is a new memtable that utilizes a trie data structure. This
# implementation significantly reduces garbage collection load by moving
# more of the sstable metadata off-heap, fits more data in the same allocation
# and can reliably handle higher write throughput.
# Because the trie memtable is a sharded single-writer solution, it can perform
# worse when the load is very unevenly distributed, e.g. when most of the writes
# access a very small number of partitions or with legacy secondary indexes.
# The memtable implementation can be selected per table by setting memtable
# property in the table definition to one of the configurations specified below.
# If the memtable property is not set, the "default" configuration will be used.
# See src/java/org/apache/cassandra/db/memtable/Memtable_API.md for further
# information.
memtable:
configurations:
skiplist:
class_name: SkipListMemtable
trie:
class_name: TrieMemtable
default:
inherits: skiplist
# Total permitted memory to use for memtables. Cassandra will stop
# accepting writes when the limit is exceeded until a flush completes,
# and will trigger a flush based on memtable_cleanup_threshold
@ -848,6 +888,7 @@ memtable_allocation_type: heap_buffers
# shrink their index summaries in order to meet this limit. However, this
# is a best-effort process. In extreme conditions Cassandra may need to use
# more than this amount of memory.
# Only relevant to formats that use an index summary, e.g. BIG.
# Min unit: KiB
index_summary_capacity:
@ -855,6 +896,7 @@ index_summary_capacity:
# periodically to redistribute memory from the fixed-size pool to sstables
# proportional their recent read rates. Setting to null value will disable this
# process, leaving existing index summaries at their current sampling level.
# Only relevant to formats that use an index summary, e.g. BIG.
# Min unit: m
index_summary_resize_interval: 60m
@ -1112,14 +1154,14 @@ column_index_cache_size: 2KiB
# specify compaction.
# The selected compaction strategy will also apply to system tables.
#
# The default is to use SizeTieredCompactionStrategy, with its default
# compaction parameters.
# If no value is specified, the default is to use SizeTieredCompactionStrategy,
# with its default compaction parameters.
#
# default_compaction:
# class_name: UnifiedCompactionStrategy
# class_name: SizeTieredCompactionStrategy
# parameters:
# scaling_parameters: T4
# target_sstable_size: 1GiB
# min_threshold: 4
# max_threshold: 32
# Number of simultaneous compactions to allow, NOT including

2195
conf/cassandra_latest.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -205,6 +205,8 @@ public enum CassandraRelevantProperties
DTEST_API_LOG_TOPOLOGY("cassandra.dtest.api.log.topology"),
/** This property indicates if the code is running under the in-jvm dtest framework */
DTEST_IS_IN_JVM_DTEST("org.apache.cassandra.dtest.is_in_jvm_dtest"),
/** In_JVM dtest property indicating that the test should use "latest" configuration */
DTEST_JVM_DTESTS_USE_LATEST("jvm_dtests.latest"),
ENABLE_DC_LOCAL_COMMIT("cassandra.enable_dc_local_commit", "true"),
/**
* Whether {@link org.apache.cassandra.db.ConsistencyLevel#NODE_LOCAL} should be allowed.

View File

@ -175,7 +175,7 @@ public class DatabaseDescriptor
/* Hashing strategy Random or OPHF */
private static IPartitioner partitioner;
private static String paritionerName;
private static String partitionerName;
private static DiskAccessMode indexAccessMode;
@ -1434,7 +1434,7 @@ public class DatabaseDescriptor
throw new ConfigurationException("Invalid partitioner class " + name, e);
}
paritionerName = partitioner.getClass().getCanonicalName();
partitionerName = partitioner.getClass().getCanonicalName();
}
private static DiskAccessMode resolveCommitLogWriteDiskAccessMode(DiskAccessMode providedDiskAccessMode)
@ -1944,7 +1944,7 @@ public class DatabaseDescriptor
public static String getPartitionerName()
{
return paritionerName;
return partitionerName;
}
/* For tests ONLY, don't use otherwise or all hell will break loose. Tests should restore value at the end. */
@ -1952,6 +1952,7 @@ public class DatabaseDescriptor
{
IPartitioner old = partitioner;
partitioner = newPartitioner;
partitionerName = partitioner.getClass().getCanonicalName();
return old;
}

View File

@ -658,6 +658,9 @@ public abstract class ReadCommand extends AbstractReadQuery
@Override
protected Row applyToStatic(Row row)
{
if (row == Rows.EMPTY_STATIC_ROW)
return row;
return applyToRow(row);
}

View File

@ -95,6 +95,7 @@ public class UnifiedCompactionStrategy extends AbstractCompactionStrategy
super(cfs, options);
this.controller = controller;
estimatedRemainingTasks = 0;
lastExpiredCheck = Clock.Global.currentTimeMillis();
}
public static Map<String, String> validateOptions(Map<String, String> options) throws ConfigurationException

View File

@ -268,9 +268,10 @@ public class Controller
if (minSSTableSize > 0)
{
double count = localDensity / minSSTableSize;
// Minimum size only applies if it is smaller than the base count.
// Minimum size only applies if the base count would result in smaller sstables.
// We also want to use the min size if we don't yet know the flush size (density is NaN).
// Note: the minimum size cannot be larger than the target size's minimum.
if (count < baseShardCount)
if (!(count >= baseShardCount)) // also true for count == NaN
{
// Make it a power of two, rounding down so that sstables are greater in size than the min.
// Setting the bottom bit to 1 ensures the result is at least 1.

View File

@ -15,18 +15,47 @@
# specific language governing permissions and limitations
# under the License.
# This file changes the configuration for tests to match the
# cassandra_latest.yaml file, which enables new features.
# This file was constructed by running:
# `diff conf/cassandra.yaml conf/cassandra_latest.yaml | grep '^>' | cut -c 3-`
# and moving the `default: inherits: trie` lines to the start of the file.
# On any change to this file, please also update
# test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java
# Change default memtable implementation to TrieMemtable
# Note: this attaches at the end of cassandra.yaml, where the memtable configuration setting must be.
default:
inherits: trie
# Change the default SSTable format to BTI.
# Note: This can also be achieved by passing -Dcassandra.sstable.format.default=bti
key_cache_size: 0MiB
memtable_allocation_type: offheap_objects
commitlog_disk_access_mode: auto
trickle_fsync: true
sstable:
selected_format: bti
# Change default compaction to UCS
column_index_size: 4KiB
default_compaction:
class_name: UnifiedCompactionStrategy
parameters:
base_shard_count: 1
scaling_parameters: T4
max_sstables_to_compact: 64
target_sstable_size: 1GiB
sstable_growth: 0.3333333333333333
min_sstable_size: 100MiB
concurrent_compactors: 8
stream_entire_sstables: true
default_secondary_index: sai
default_secondary_index_enabled: true
storage_compatibility_mode: NONE

View File

@ -31,6 +31,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import com.vdurmont.semver4j.Semver;
import org.apache.cassandra.config.CassandraRelevantProperties;
import org.apache.cassandra.distributed.api.Feature;
import org.apache.cassandra.distributed.api.IInstanceConfig;
import org.apache.cassandra.distributed.shared.NetworkTopology;
@ -114,6 +115,44 @@ public class InstanceConfig implements IInstanceConfig
.set("counter_cache_size", "50MiB")
.set("key_cache_size", "50MiB")
.set("commitlog_disk_access_mode", "legacy");
if (CassandraRelevantProperties.DTEST_JVM_DTESTS_USE_LATEST.getBoolean())
{
// TODO: make this load latest_diff.yaml or cassandra_latest.yaml
this.set("memtable", Map.of(
"configurations", Map.of(
"default", Map.of(
"class_name", "TrieMemtable"))))
.set("key_cache_size", "0MiB")
.set("memtable_allocation_type", "offheap_objects")
.set("commitlog_disk_access_mode", "auto")
.set("trickle_fsync", "true")
.set("sstable", Map.of(
"selected_format", "bti"))
.set("column_index_size", "4KiB")
.set("default_compaction", Map.of(
"class_name", "UnifiedCompactionStrategy",
"parameters", Map.of(
"scaling_parameters", "T4",
"max_sstables_to_compact", "64",
"target_sstable_size", "1GiB",
"sstable_growth","0.3333333333333333",
"min_sstable_size", "100MiB")))
.set("concurrent_compactors", "8")
.set("stream_entire_sstables", "true")
.set("default_secondary_index", "sai")
.set("default_secondary_index_enabled", "true")
.set("storage_compatibility_mode", "NONE");
}
this.featureFlags = EnumSet.noneOf(Feature.class);
this.jmxPort = jmx_port;
}

View File

@ -44,9 +44,11 @@ import org.junit.rules.ExpectedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.distributed.api.ConsistencyLevel;
import org.apache.cassandra.distributed.api.ICluster;
import org.apache.cassandra.distributed.api.IMessageFilters;
import org.apache.cassandra.distributed.shared.InstanceClassLoader;
import org.apache.cassandra.exceptions.CasWriteTimeoutException;
import org.apache.cassandra.exceptions.CasWriteUnknownResultException;
@ -55,8 +57,9 @@ import org.apache.cassandra.utils.FBUtilities;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import static org.apache.cassandra.distributed.shared.AssertUtils.assertRows;
import static org.apache.cassandra.distributed.shared.AssertUtils.row;
import static org.hamcrest.CoreMatchers.containsString;
import static org.apache.cassandra.distributed.shared.AssertUtils.*;
// TODO: this test should be removed after running in-jvm dtests is set up via the shared API repository
public class CasWriteTest extends TestBaseImpl
@ -110,6 +113,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_PREPARE_REQ.id).from(1).to(2, 3).drop().on(); // drop the internode messages to acceptors
cluster.filters().verbs(Verb.PAXOS2_PREPARE_REQ.id).from(1).to(2, 3).drop().on(); // drop the internode messages to acceptors
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -118,6 +122,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_PREPARE_RSP.id).from(2, 3).to(1).drop().on(); // drop the internode messages to acceptors
cluster.filters().verbs(Verb.PAXOS2_PREPARE_RSP.id).from(2, 3).to(1).drop().on(); // drop the internode messages to acceptors
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -126,6 +131,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_PROPOSE_REQ.id).from(1).to(2, 3).drop().on();
cluster.filters().verbs(Verb.PAXOS2_PROPOSE_REQ.id).from(1).to(2, 3).drop().on();
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -134,6 +140,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_PROPOSE_RSP.id).from(2, 3).to(1).drop().on();
cluster.filters().verbs(Verb.PAXOS2_PROPOSE_RSP.id).from(2, 3).to(1).drop().on();
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -142,6 +149,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_COMMIT_REQ.id).from(1).to(2, 3).drop().on();
cluster.filters().verbs(Verb.PAXOS2_COMMIT_AND_PREPARE_REQ.id).from(1).to(2, 3).drop().on();
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -150,6 +158,7 @@ public class CasWriteTest extends TestBaseImpl
{
expectCasWriteTimeout();
cluster.filters().verbs(Verb.PAXOS_COMMIT_RSP.id).from(2, 3).to(1).drop().on();
cluster.filters().verbs(Verb.PAXOS2_COMMIT_REMOTE_RSP.id).from(2, 3).to(1).drop().on();
cluster.coordinator(1).execute(mkUniqueCasInsertQuery(1), ConsistencyLevel.QUORUM);
}
@ -164,6 +173,8 @@ public class CasWriteTest extends TestBaseImpl
c.filters().reset();
c.filters().verbs(Verb.PAXOS_PREPARE_REQ.id).from(1).to(3).drop();
c.filters().verbs(Verb.PAXOS_PROPOSE_REQ.id).from(1).to(2).drop();
c.filters().verbs(Verb.PAXOS2_PREPARE_REQ.id).from(1).to(3).drop();
c.filters().verbs(Verb.PAXOS2_PROPOSE_REQ.id).from(1).to(2).drop();
},
failure ->
failure.get() != null &&
@ -253,18 +264,22 @@ public class CasWriteTest extends TestBaseImpl
cluster.filters().reset();
int pk = pkGen.getAndIncrement();
CountDownLatch ready = new CountDownLatch(1);
cluster.filters().verbs(Verb.PAXOS_PROPOSE_REQ.id).from(1).to(2, 3).messagesMatching((from, to, msg) -> {
final IMessageFilters.Matcher matcher = (from, to, msg) -> {
if (to == 2)
{
// Inject a single CAS request in-between prepare and propose phases
cluster.coordinator(2).execute(mkCasInsertQuery((a) -> pk, 1, 2),
ConsistencyLevel.QUORUM);
ready.countDown();
} else {
}
else
{
Uninterruptibles.awaitUninterruptibly(ready);
}
return false;
}).drop();
};
cluster.filters().verbs(Verb.PAXOS_PROPOSE_REQ.id).from(1).to(2, 3).messagesMatching(matcher).drop();
cluster.filters().verbs(Verb.PAXOS2_PROPOSE_REQ.id).from(1).to(2, 3).messagesMatching(matcher).drop();
try
{
@ -272,13 +287,19 @@ public class CasWriteTest extends TestBaseImpl
}
catch (Throwable t)
{
Assert.assertEquals("Expecting cause to be CasWriteUnknownResultException",
CasWriteUnknownResultException.class.getCanonicalName(), t.getClass().getCanonicalName());
final Class<?> exceptionClass = isPaxosVariant2() ? CasWriteTimeoutException.class : CasWriteUnknownResultException.class;
Assert.assertEquals("Expecting cause to be " + exceptionClass.getSimpleName(),
exceptionClass.getCanonicalName(), t.getClass().getCanonicalName());
return;
}
Assert.fail("Expecting test to throw a CasWriteUnknownResultException");
}
private static boolean isPaxosVariant2()
{
return Config.PaxosVariant.v2.name().equals(cluster.coordinator(1).instance().config().getString("paxos_variant"));
}
// every invokation returns a query with an unique pk
private String mkUniqueCasInsertQuery(int v)
{

View File

@ -19,12 +19,14 @@
package org.apache.cassandra.distributed.test;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Set;
import com.google.common.collect.Sets;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.dht.Bounds;
@ -65,11 +67,14 @@ public class PreviewRepairSnapshotTest extends TestBaseImpl
.with(NETWORK)).start()))
{
Set<Integer> tokensToMismatch = Sets.newHashSet(1, 50, 99);
cluster.schemaChange(withKeyspace("create table %s.tbl (id int primary key) with compaction = {'class' : 'SizeTieredCompactionStrategy', 'enabled':false }"));
cluster.schemaChange(withKeyspace("create table %s.tbl (id blob primary key) with compaction = {'class' : 'SizeTieredCompactionStrategy', 'enabled':false }"));
// 1 token per sstable;
for (int i = 0; i < 100; i++)
{
cluster.coordinator(1).execute(withKeyspace("insert into %s.tbl (id) values (?)"), ConsistencyLevel.ALL, i);
// BigFormat severely overestimates the number of partitions per range when the sstable size is small.
// Do multiple writes per sstable, with the same token, to compensate.
for (int j = 0; j < 10; ++j)
cluster.coordinator(1).execute(withKeyspace("insert into %s.tbl (id) values (?)"), ConsistencyLevel.ALL, matchingHashBlob(i, j));
cluster.stream().forEach(instance -> instance.flush(KEYSPACE));
}
cluster.stream().forEach(instance -> instance.flush(KEYSPACE));
@ -85,9 +90,10 @@ public class PreviewRepairSnapshotTest extends TestBaseImpl
Set<Token> mismatchingTokens = new HashSet<>();
for (Integer token : tokensToMismatch)
{
cluster.get(2).executeInternal(withKeyspace("insert into %s.tbl (id) values (?)"), token);
final ByteBuffer b = matchingHashBlob(token, 0);
cluster.get(2).executeInternal(withKeyspace("insert into %s.tbl (id) values (?)"), b);
cluster.get(2).flush(KEYSPACE);
Object[][] res = cluster.get(2).executeInternal(withKeyspace("select token(id) from %s.tbl where id = ?"), token);
Object[][] res = cluster.get(2).executeInternal(withKeyspace("select token(id) from %s.tbl where id = ?"), b);
mismatchingTokens.add(new Murmur3Partitioner.LongToken((long) res[0][0]));
}
@ -105,6 +111,13 @@ public class PreviewRepairSnapshotTest extends TestBaseImpl
}
}
private ByteBuffer matchingHashBlob(int hashAffectingComponent, int hashUnaffectingComponent)
{
// Generate blobs with mathing hash for the same i, but different for the different j
ByteBuffer base = ByteBuffer.wrap(Integer.toHexString(hashAffectingComponent).getBytes());
return Util.generateMurmurCollision(base, Integer.toHexString(hashUnaffectingComponent).getBytes());
}
private IIsolatedExecutor.SerializableRunnable checkSnapshot(Set<Token> mismatchingTokens, int expectedSnapshotSize)
{
return () -> {

View File

@ -21,6 +21,7 @@ package org.apache.cassandra.distributed.test;
import java.io.IOException;
import java.util.Set;
import org.junit.Assume;
import org.junit.Test;
import org.apache.cassandra.db.ColumnFamilyStore;
@ -43,6 +44,8 @@ public class SecondaryIndexCompactionTest extends TestBaseImpl
{
try (Cluster cluster = init(Cluster.build(1).start()))
{
Assume.assumeFalse("Test only valid for legacy index",
"sai".equals(cluster.get(1).config().getString("default_secondary_index")));
cluster.schemaChange(withKeyspace("create table %s.tbl (id int, ck int, something int, else int, primary key (id, ck));"));
cluster.schemaChange(withKeyspace("create index tbl_idx on %s.tbl (ck)"));

View File

@ -88,7 +88,7 @@ public class SecondaryIndexTest extends TestBaseImpl
cluster.forEach(i -> i.flush(KEYSPACE));
Pattern indexScanningPattern =
Pattern.compile(String.format("Index mean cardinalities are v_index_%d:[0-9]+. Scanning with v_index_%d.", seq.get(), seq.get()));
Pattern.compile(String.format("Index mean cardinalities are v_index_%d:[-0-9]+. Scanning with v_index_%d.", seq.get(), seq.get()));
for (int i = 0 ; i < 33; ++i)
{

View File

@ -60,8 +60,8 @@ public class UpgradeSSTablesTest extends TestBaseImpl
cluster.get(1).acceptsOnInstance((String ks) -> {
ColumnFamilyStore cfs = Keyspace.open(ks).getColumnFamilyStore("tbl");
cfs.disableAutoCompaction();
CompactionManager.instance.setMaximumCompactorThreads(1);
CompactionManager.instance.setCoreCompactorThreads(1);
CompactionManager.instance.setMaximumCompactorThreads(1);
}).accept(KEYSPACE);
String blob = "blob";
@ -104,8 +104,8 @@ public class UpgradeSSTablesTest extends TestBaseImpl
cluster.get(1).acceptsOnInstance((String ks) -> {
ColumnFamilyStore cfs = Keyspace.open(ks).getColumnFamilyStore("tbl");
cfs.disableAutoCompaction();
CompactionManager.instance.setMaximumCompactorThreads(1);
CompactionManager.instance.setCoreCompactorThreads(1);
CompactionManager.instance.setMaximumCompactorThreads(1);
}).accept(KEYSPACE);
String blob = "blob";
@ -198,8 +198,8 @@ public class UpgradeSSTablesTest extends TestBaseImpl
cluster.get(1).acceptsOnInstance((String ks) -> {
ColumnFamilyStore cfs = Keyspace.open(ks).getColumnFamilyStore("tbl");
cfs.disableAutoCompaction();
CompactionManager.instance.setMaximumCompactorThreads(1);
CompactionManager.instance.setCoreCompactorThreads(1);
CompactionManager.instance.setMaximumCompactorThreads(1);
}).accept(KEYSPACE);
String blob = "blob";

View File

@ -106,7 +106,7 @@ public class ConcurrencyFactorTest extends TestBaseImpl
// Token-restricted range query not using SAI so should use initial concurrency estimation
query = String.format("SELECT * FROM %s.%s WHERE token(pk) > 0", KEYSPACE, SAI_TABLE);
runAndValidate("Submitting range requests on 2 ranges with a concurrency of 2 (230.4 rows per range expected)", query);
runAndValidate("Submitting range requests on 2 ranges with a concurrency of 2.*", query);
// Token-restricted range query with SAI so should bypass initial concurrency estimation
query = String.format("SELECT * FROM %s.%s WHERE token(pk) > 0 AND gdp > ?", KEYSPACE, SAI_TABLE);
@ -124,7 +124,7 @@ public class ConcurrencyFactorTest extends TestBaseImpl
await().atMost(5, TimeUnit.SECONDS).until(() -> {
List<TracingUtil.TraceEntry> traceEntries = TracingUtil.getTrace(cluster, sessionId, ConsistencyLevel.ONE);
return traceEntries.stream().anyMatch(entry -> entry.activity.equals(trace));
return traceEntries.stream().anyMatch(entry -> entry.activity.matches(trace));
});
}

View File

@ -55,6 +55,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assume;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -110,6 +111,7 @@ import org.apache.cassandra.dht.Token;
import org.apache.cassandra.gms.ApplicationState;
import org.apache.cassandra.gms.Gossiper;
import org.apache.cassandra.gms.VersionedValue;
import org.apache.cassandra.index.internal.CassandraIndex;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableId;
import org.apache.cassandra.io.sstable.SSTableLoader;
@ -659,6 +661,12 @@ public class Util
return new PartitionerSwitcher(p);
}
public static void assumeLegacySecondaryIndex()
{
Assume.assumeTrue("Test only valid for legacy secondary index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
}
public static class PartitionerSwitcher implements AutoCloseable
{
final IPartitioner oldP;

View File

@ -104,7 +104,8 @@ public class ParseAndConvertUnitsTest
assertNull(config.file_cache_size);
assertNull(config.index_summary_capacity);
assertEquals(new DataStorageSpec.LongMebibytesBound(1), config.prepared_statements_cache_size);
assertNull(config.key_cache_size);
if (config.key_cache_size != null) // null in default test config, 0 in latest test config (CASSANDRA-18753)
assertEquals(new DataStorageSpec.IntMebibytesBound(0), config.key_cache_size);
assertEquals(new DataStorageSpec.LongMebibytesBound(16), config.row_cache_size);
assertNull(config.native_transport_max_request_data_in_flight);
assertNull(config.native_transport_max_request_data_in_flight_per_ip);

View File

@ -34,6 +34,7 @@ import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.CqlBuilder;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.index.internal.CassandraIndex;
import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.locator.TokenMetadata;
import org.apache.cassandra.schema.CompactionParams;
@ -447,12 +448,12 @@ public class DescribeStatementTest extends CQLTester
{
assertRowsNet(executeDescribeNet(describeKeyword + " CLUSTER"),
row("Test Cluster",
"ByteOrderedPartitioner",
trimIfPresent(DatabaseDescriptor.getPartitionerName(), "org.apache.cassandra.dht."),
DatabaseDescriptor.getEndpointSnitch().getClass().getName()));
assertRowsNet(executeDescribeNet("system_virtual_schema", describeKeyword + " CLUSTER"),
row("Test Cluster",
"ByteOrderedPartitioner",
trimIfPresent(DatabaseDescriptor.getPartitionerName(), "org.apache.cassandra.dht."),
DatabaseDescriptor.getEndpointSnitch().getClass().getName()));
}
@ -462,11 +463,18 @@ public class DescribeStatementTest extends CQLTester
assertRowsNet(executeDescribeNet(KEYSPACE_PER_TEST, "DESCRIBE CLUSTER"),
row("Test Cluster",
"ByteOrderedPartitioner",
trimIfPresent(DatabaseDescriptor.getPartitionerName(), "org.apache.cassandra.dht."),
DatabaseDescriptor.getEndpointSnitch().getClass().getName(),
ImmutableMap.of(token.toString(), ImmutableList.of(addressAndPort.toString()))));
}
private String trimIfPresent(String src, String begin)
{
if (src.startsWith(begin))
return src.substring(begin.length());
return src;
}
@Test
public void testDescribeTableWithInternals() throws Throwable
{
@ -1005,7 +1013,11 @@ public class DescribeStatementTest extends CQLTester
private static String indexOutput(String index, String table, String col)
{
return format("CREATE INDEX %s ON %s.%s (%s);", index, "test", table, col);
if (DatabaseDescriptor.getDefaultSecondaryIndex() == CassandraIndex.NAME)
return format("CREATE INDEX %s ON %s.%s (%s);", index, "test", table, col);
else
return format("CREATE CUSTOM INDEX %s ON %s.%s (%s) USING '%s';",
index, "test", table, col, DatabaseDescriptor.getDefaultSecondaryIndex());
}
private static String usersMvTableOutput()

View File

@ -27,6 +27,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.apache.cassandra.db.marshal.*;
@ -831,6 +832,7 @@ public class FrozenCollectionsTest extends CQLTester
@Test
public void testSecondaryIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a frozen<map<int, text>> PRIMARY KEY, b frozen<map<int, text>>)");
// for now, we don't support indexing values or keys of collections in the primary key
@ -996,6 +998,7 @@ public class FrozenCollectionsTest extends CQLTester
@Test
public void testClusteringColumnFiltering() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b frozen<map<int, int>>, c int, d int, PRIMARY KEY (a, b, c))");
createIndex("CREATE INDEX c_index ON %s (c)");
createIndex("CREATE INDEX d_index ON %s (d)");

View File

@ -17,18 +17,20 @@
*/
package org.apache.cassandra.cql3.validation.entities;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.dht.ByteOrderedPartitioner;
import org.apache.cassandra.exceptions.InvalidRequestException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.cassandra.Util;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.dht.ByteOrderedPartitioner;
import org.apache.cassandra.exceptions.InvalidRequestException;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -39,6 +41,7 @@ public class SecondaryIndexOnMapEntriesTest extends CQLTester
public static void setUp()
{
DatabaseDescriptor.setPartitionerUnsafe(ByteOrderedPartitioner.instance);
Util.assumeLegacySecondaryIndex();
}
@Test

View File

@ -21,6 +21,7 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import com.google.common.collect.Iterables;
import org.junit.Test;
import org.junit.Assert;
@ -50,14 +51,17 @@ public class CrcCheckChanceTest extends CQLTester
execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2");
ColumnFamilyStore cfs = Keyspace.open(CQLTester.KEYSPACE).getColumnFamilyStore(currentTable());
ColumnFamilyStore indexCfs = cfs.indexManager.getAllIndexColumnFamilyStores().iterator().next();
ColumnFamilyStore indexCfs = Iterables.getFirst(cfs.indexManager.getAllIndexColumnFamilyStores(), null);
Util.flush(cfs);
Assert.assertEquals(0.99, cfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.99, cfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
Assert.assertEquals(0.99, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.99, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
if (indexCfs != null)
{
Assert.assertEquals(0.99, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.99, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
}
//Test for stack overflow
alterTable("ALTER TABLE %s WITH crc_check_chance = 0.99");
@ -96,8 +100,11 @@ public class CrcCheckChanceTest extends CQLTester
Assert.assertEquals(0.01, cfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, cfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
if (indexCfs != null)
{
Assert.assertEquals(0.01, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
}
assertRows(execute("SELECT * FROM %s WHERE p=?", "p1"),
row("p1", "k1", "sv1", "v1"),
@ -116,29 +123,47 @@ public class CrcCheckChanceTest extends CQLTester
//but previous JMX-set value will persist until next restart
Assert.assertEquals(0.01, cfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
if (indexCfs != null)
{
Assert.assertEquals(0.01, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.01, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
}
//Verify the call used by JMX still works
cfs.setCrcCheckChance(0.03);
Assert.assertEquals(0.03, cfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, cfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
if (indexCfs != null)
{
Assert.assertEquals(0.03, indexCfs.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, indexCfs.getLiveSSTables().iterator().next().getCrcCheckChance(), 0.0);
}
// Also check that any open readers also use the updated value
// note: only compressed files currently perform crc checks, so only the dfile reader is relevant here
SSTableReader baseSSTable = cfs.getLiveSSTables().iterator().next();
SSTableReader idxSSTable = indexCfs.getLiveSSTables().iterator().next();
try (RandomAccessReader baseDataReader = baseSSTable.openDataReader();
RandomAccessReader idxDataReader = idxSSTable.openDataReader())
if (indexCfs != null)
{
Assert.assertEquals(0.03, baseDataReader.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, idxDataReader.getCrcCheckChance(), 0.0);
SSTableReader idxSSTable = indexCfs.getLiveSSTables().iterator().next();
try (RandomAccessReader baseDataReader = baseSSTable.openDataReader();
RandomAccessReader idxDataReader = idxSSTable.openDataReader())
{
Assert.assertEquals(0.03, baseDataReader.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.03, idxDataReader.getCrcCheckChance(), 0.0);
cfs.setCrcCheckChance(0.31);
Assert.assertEquals(0.31, baseDataReader.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.31, idxDataReader.getCrcCheckChance(), 0.0);
cfs.setCrcCheckChance(0.31);
Assert.assertEquals(0.31, baseDataReader.getCrcCheckChance(), 0.0);
Assert.assertEquals(0.31, idxDataReader.getCrcCheckChance(), 0.0);
}
}
else
{
try (RandomAccessReader baseDataReader = baseSSTable.openDataReader())
{
Assert.assertEquals(0.03, baseDataReader.getCrcCheckChance(), 0.0);
cfs.setCrcCheckChance(0.31);
Assert.assertEquals(0.31, baseDataReader.getCrcCheckChance(), 0.0);
}
}
}

View File

@ -24,6 +24,7 @@ import java.util.UUID;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.validation.entities.SecondaryIndexTest;
@ -722,6 +723,7 @@ public class CompactStorageSplit1Test extends CQLTester
@Test
public void testCompactTableWithValueOver64k() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s(a int, b blob, PRIMARY KEY (a)) WITH COMPACT STORAGE");
createIndex("CREATE INDEX ON %s(b)");
failInsert("INSERT INTO %s (a, b) VALUES (0, ?)", ByteBuffer.allocate(SecondaryIndexTest.TOO_BIG));
@ -768,6 +770,7 @@ public class CompactStorageSplit1Test extends CQLTester
@Test
public void testEmptyRestrictionValueWithSecondaryIndexAndCompactTables() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (pk blob, c blob, v blob, PRIMARY KEY ((pk), c)) WITH COMPACT STORAGE");
assertInvalidMessage("Secondary indexes are not supported on PRIMARY KEY columns in COMPACT STORAGE tables",
"CREATE INDEX on %s(c)");

View File

@ -31,6 +31,7 @@ import com.google.common.base.StandardSystemProperty;
import org.junit.Test;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.io.util.File;
import org.apache.cassandra.tools.ToolRunner;
@ -145,6 +146,7 @@ public class InsertInvalidateSizedRecordsTest extends CQLTester
@Test
public void singleValueIndex()
{
Util.assumeLegacySecondaryIndex();
createTable(KEYSPACE, "CREATE TABLE %s (a blob, b blob, PRIMARY KEY (a))");
String table = KEYSPACE + "." + currentTable();
execute("CREATE INDEX single_value_index ON %s (b)");

View File

@ -459,7 +459,7 @@ public class InsertUpdateIfConditionTest extends CQLTester
@Test
public void testDropCreateIndexIfNotExists()
{
String tableName = createTable("CREATE TABLE %s (id text PRIMARY KEY, value1 blob, value2 blob)with comment = 'foo'");
String tableName = createTable("CREATE TABLE %s (id text PRIMARY KEY, value1 text, value2 blob)with comment = 'foo'");
// try dropping when doesn't exist
schemaChange(format("DROP INDEX IF EXISTS %s.myindex", KEYSPACE));

View File

@ -24,6 +24,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.Util;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.dht.ByteOrderedPartitioner;
@ -542,8 +543,9 @@ public class SelectLimitTest extends CQLTester
}
@Test
public void testIndexOnRegularColumnWithPartitionWithoutRows() throws Throwable
public void testIndexOnRegularColumnWithPartitionWithoutRows()
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (pk int, c int, s int static, v int, PRIMARY KEY(pk, c))");
createIndex("CREATE INDEX ON %s (v)");

View File

@ -21,6 +21,7 @@ import org.junit.Test;
import java.nio.ByteBuffer;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.apache.cassandra.utils.ByteBufferUtil;
@ -785,6 +786,7 @@ public class SelectMultiColumnRelationTest extends CQLTester
@Test
public void testMultipleClusteringWithIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, PRIMARY KEY (a, b, c, d))");
createIndex("CREATE INDEX ON %s (b)");
createIndex("CREATE INDEX ON %s (e)");
@ -864,6 +866,7 @@ public class SelectMultiColumnRelationTest extends CQLTester
@Test
public void testMultipleClusteringWithIndexAndValueOver64K() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b blob, c int, d int, PRIMARY KEY (a, b, c))");
createIndex("CREATE INDEX ON %s (b)");
@ -904,6 +907,7 @@ public class SelectMultiColumnRelationTest extends CQLTester
@Test
public void testMultiplePartitionKeyAndMultiClusteringWithIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, f int, PRIMARY KEY ((a, b), c, d, e))");
createIndex("CREATE INDEX ON %s (c)");
createIndex("CREATE INDEX ON %s (f)");

View File

@ -25,6 +25,7 @@ import java.util.Arrays;
import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
@ -47,6 +48,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
@Test
public void testTokenAndIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY (a, b, c))");
createIndex("CREATE INDEX ON %s(c)");
@ -86,6 +88,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
@Test
public void testFilteringOnPartitionKeyWithToken() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY ((a, b), c))");
createIndex("CREATE INDEX ON %s(d)");
@ -316,6 +319,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
@Test
public void testMultiColumnPartitionKeyWithIndexAndTokenNonTokenRestrictionsMix() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, primary key((a, b)))");
createIndex("CREATE INDEX ON %s(b)");
createIndex("CREATE INDEX ON %s(c)");
@ -402,6 +406,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
@Test
public void testCompositeIndexWithPK() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (blog_id int, time1 int, time2 int, author text, content text, PRIMARY KEY (blog_id, time1, time2))");
createIndex("CREATE INDEX ON %s(author)");
@ -533,6 +538,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
@Test
public void testIndexOnCompositeWithCollections() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (blog_id int, time1 int, time2 int, author text, content set<text>, PRIMARY KEY (blog_id, time1, time2))");
createIndex("CREATE INDEX ON %s (author)");

View File

@ -21,11 +21,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.junit.Test;
public class SelectSingleColumnRelationTest extends CQLTester
{
@Test
@ -456,6 +457,8 @@ public class SelectSingleColumnRelationTest extends CQLTester
@Test
public void testMultiplePartitionKeyWithIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex(); // SAI does not allow multi-column slice restrictions
createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, f int, PRIMARY KEY ((a, b), c, d, e))");
createIndex("CREATE INDEX ON %s (c)");
createIndex("CREATE INDEX ON %s (f)");

View File

@ -23,11 +23,14 @@ import java.util.UUID;
import org.junit.Test;
import org.junit.Assert;
import org.apache.cassandra.Util;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.Duration;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.index.internal.CassandraIndex;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@ -341,8 +344,11 @@ public class SelectTest extends CQLTester
assertInvalidMessage("Unsupported unset value for column categories",
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ?", "test", 5, unset());
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND categories CONTAINS ? AND categories CONTAINS ?", "xyz", "lmn", "notPresent");
if (DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME))
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND categories CONTAINS ? AND categories CONTAINS ?", "xyz", "lmn", "notPresent");
else
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND categories CONTAINS ? AND categories CONTAINS ?", "xyz", "lmn", "notPresent"));
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND categories CONTAINS ? AND categories CONTAINS ? ALLOW FILTERING", "xyz", "lmn", "notPresent"));
});
}
@ -375,9 +381,13 @@ public class SelectTest extends CQLTester
assertInvalidMessage("Unsupported unset value for column categories",
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ?", "test", 5, unset());
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "lmn", "notPresent");
if (DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME))
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "lmn", "notPresent");
else
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "lmn", "notPresent"));
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ? ALLOW FILTERING",
"test", 5, "lmn", "notPresent"));
});
@ -432,15 +442,24 @@ public class SelectTest extends CQLTester
assertInvalidMessage("Unsupported unset value for column categories",
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ?", "test", 5, unset());
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS KEY ?",
"test", 5, "lmn", "notPresent");
if (DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME))
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS KEY ?",
"test", 5, "lmn", "notPresent");
else
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS KEY ?",
"test", 5, "lmn", "notPresent"));
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS KEY ? ALLOW FILTERING",
"test", 5, "lmn", "notPresent"));
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS ?",
"test", 5, "lmn", "foo");
if (DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME))
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS ?",
"test", 5, "lmn", "foo");
else
assertRows(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS ?",
"test", 5, "lmn", "foo"),
row("test", 5, map("lmn", "foo")));
});
}
@ -473,9 +492,13 @@ public class SelectTest extends CQLTester
assertInvalidMessage("Unsupported unset value for column categories",
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ?", "test", 5, unset());
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "foo", "notPresent");
if (DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME))
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
"SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "foo", "notPresent");
else
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ?",
"test", 5, "foo", "notPresent"));
assertEmpty(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS ? AND categories CONTAINS ? ALLOW FILTERING",
"test", 5, "foo", "notPresent"));
@ -1593,6 +1616,7 @@ public class SelectTest extends CQLTester
@Test
public void testIndexQueryWithValueOver64K() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c blob, PRIMARY KEY (a, b))");
String idx = createIndex("CREATE INDEX ON %s (c)");

View File

@ -28,10 +28,12 @@ import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.cassandra.*;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.statements.schema.IndexTarget;
import org.apache.cassandra.db.marshal.*;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.index.internal.CassandraIndex;
import org.apache.cassandra.index.sasi.SASIIndex;
import org.apache.cassandra.schema.*;
import org.apache.cassandra.service.reads.SpeculativeRetryPolicy;
@ -444,13 +446,17 @@ public class SchemaCQLHelperTest extends CQLTester
containsString("ALTER TABLE " + keyspace() + "." + tableName + " DROP reg3 USING TIMESTAMP 10000;"),
containsString("ALTER TABLE " + keyspace() + "." + tableName + " ADD reg3 int;")));
assertThat(schema, containsString("CREATE INDEX IF NOT EXISTS " + tableName + "_reg2_idx ON " + keyspace() + '.' + tableName + " (reg2);"));
final boolean isIndexLegacy = DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME);
assertThat(schema, containsString(
"CREATE " + (isIndexLegacy ? "" : "CUSTOM ") +
"INDEX IF NOT EXISTS " + tableName + "_reg2_idx ON " + keyspace() + '.' + tableName + " (reg2)" +
(isIndexLegacy ? "" : " USING '" + DatabaseDescriptor.getDefaultSecondaryIndex() + "'") + ";"));
JsonNode manifest = JsonUtils.JSON_OBJECT_MAPPER.readTree(cfs.getDirectories().getSnapshotManifestFile(SNAPSHOT).toJavaIOFile());
JsonNode files = manifest.get("files");
// two files, the second is index
Assert.assertTrue(files.isArray());
Assert.assertEquals(2, files.size());
Assert.assertEquals(isIndexLegacy ? 2 : 1, files.size());
}
@Test

View File

@ -35,6 +35,7 @@ import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Uninterruptibles;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cache.AutoSavingCache;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
@ -78,7 +79,7 @@ public class ActiveCompactionsTest extends CQLTester
ExecutorService es = Executors.newFixedThreadPool(2);
final int loopCount = 5000;
final int loopCount = 3500;
for (int ii = 0; ii < loopCount; ii++)
{
CountDownLatch trigger = new CountDownLatch(1);
@ -108,6 +109,7 @@ public class ActiveCompactionsTest extends CQLTester
@Test
public void testSecondaryIndexTracking() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (pk int, ck int, a int, b int, PRIMARY KEY (pk, ck))");
String idxName = createIndex("CREATE INDEX on %s(a)");
getCurrentColumnFamilyStore().disableAutoCompaction();

View File

@ -32,8 +32,10 @@ import java.util.stream.Collectors;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Uninterruptibles;
import org.junit.Assume;
import org.junit.Test;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
@ -44,6 +46,7 @@ import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.index.Index;
import org.apache.cassandra.index.StubIndex;
import org.apache.cassandra.index.internal.CassandraIndex;
import org.apache.cassandra.index.internal.CollatedViewIndexBuilder;
import org.apache.cassandra.io.sstable.ISSTableScanner;
import org.apache.cassandra.io.sstable.ReducingKeyIterator;
@ -426,6 +429,8 @@ public class CancelCompactionsTest extends CQLTester
@Test
public void test2iCancellation() throws Throwable
{
Assume.assumeTrue("Tests legacy index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
createTable("create table %s (id int primary key, something int)");
createIndex("create index on %s(something)");
getCurrentColumnFamilyStore().disableAutoCompaction();
@ -446,6 +451,8 @@ public class CancelCompactionsTest extends CQLTester
@Test
public void testSubrangeCompactionWith2i() throws Throwable
{
Assume.assumeTrue("Tests legacy index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
createTable("create table %s (id int primary key, something int)");
createIndex("create index on %s(something)");
getCurrentColumnFamilyStore().disableAutoCompaction();

View File

@ -271,7 +271,7 @@ public class ControllerTest
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Math.scalb(10, 60)));
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Double.POSITIVE_INFINITY));
// Check NaN
assertEquals(3, controller.getNumShards(Double.NaN));
assertEquals(1, controller.getNumShards(Double.NaN));
}
@Test
@ -310,7 +310,7 @@ public class ControllerTest
assertEquals(3, controller.getNumShards(Math.scalb(10, 60)));
assertEquals(3, controller.getNumShards(Double.POSITIVE_INFINITY));
// Check NaN
assertEquals(3, controller.getNumShards(Double.NaN));
assertEquals(1, controller.getNumShards(Double.NaN));
}
@Test
@ -349,7 +349,7 @@ public class ControllerTest
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Math.scalb(10, 80)));
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Double.POSITIVE_INFINITY));
// Check NaN
assertEquals(3, controller.getNumShards(Double.NaN));
assertEquals(1, controller.getNumShards(Double.NaN));
}
@Test
@ -387,7 +387,7 @@ public class ControllerTest
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Math.scalb(600, 50)));
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Math.scalb(10, 60)));
assertEquals(3 * (int) Controller.MAX_SHARD_SPLIT, controller.getNumShards(Double.POSITIVE_INFINITY));
assertEquals(3, controller.getNumShards(Double.NaN));
assertEquals(1, controller.getNumShards(Double.NaN));
}
@Test

View File

@ -50,7 +50,7 @@ public class ShardedMultiWriterTest extends CQLTester
long totSizeBytes = ((minSSTableSizeMB << 20) * numShards) * 2;
// We have double the data required for 5 shards so we should get 5 shards
testShardedCompactionWriter(numShards, totSizeBytes, numShards);
testShardedCompactionWriter(numShards, totSizeBytes, numShards, minSSTableSizeMB);
}
@Test
@ -61,7 +61,7 @@ public class ShardedMultiWriterTest extends CQLTester
long totSizeBytes = (minSSTableSizeMB << 20);
// there should be only 1 shard if there is <= minSSTableSize
testShardedCompactionWriter(numShards, totSizeBytes, 1);
testShardedCompactionWriter(numShards, totSizeBytes, 1, minSSTableSizeMB);
}
@Test
@ -72,18 +72,19 @@ public class ShardedMultiWriterTest extends CQLTester
long totSizeBytes = (minSSTableSizeMB << 20) * 3;
// there should be only 3 shards if there is minSSTableSize * 3 data
testShardedCompactionWriter(numShards, totSizeBytes, 3);
testShardedCompactionWriter(numShards, totSizeBytes, 3, minSSTableSizeMB);
}
private void testShardedCompactionWriter(int numShards, long totSizeBytes, int numOutputSSTables) throws Throwable
private void testShardedCompactionWriter(int numShards, long totSizeBytes, int numOutputSSTables, int minSSTableSizeMB) throws Throwable
{
createTable(String.format("CREATE TABLE %%s (k int, t int, v blob, PRIMARY KEY (k, t)) with compaction = " +
"{'class':'UnifiedCompactionStrategy', 'base_shard_count' : '%d'} ", numShards));
"{'class':'UnifiedCompactionStrategy', 'base_shard_count' : '%d', 'min_sstable_size': '" + minSSTableSizeMB + "MiB'} ", numShards));
ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
cfs.disableAutoCompaction();
int rowCount = insertData(totSizeBytes);
cfs.metric.flushSizeOnDisk.update(totSizeBytes); // flush size is only updated after the flush completes; set here so that flush uses correct size
cfs.forceBlockingFlush(ColumnFamilyStore.FlushReason.UNIT_TESTS);
assertEquals(numOutputSSTables, cfs.getLiveSSTables().size());

View File

@ -67,7 +67,8 @@ public class CompactionAwareWriterTest extends CQLTester
{
// Disabling durable write since we don't care
schemaChange("CREATE KEYSPACE IF NOT EXISTS " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes=false");
schemaChange(String.format("CREATE TABLE %s.%s (k int, t int, v blob, PRIMARY KEY (k, t))", KEYSPACE, TABLE));
schemaChange(String.format("CREATE TABLE %s.%s (k int, t int, v blob, PRIMARY KEY (k, t)) WITH compaction = {'class': 'SizeTieredCompactionStrategy'}", KEYSPACE, TABLE));
// The compaction specification above is to avoid failures caused by UCS splitting large files.
}
@AfterClass

View File

@ -32,10 +32,12 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.junit.Assume;
import org.junit.Test;
import com.datastax.driver.core.exceptions.QueryValidationException;
import org.apache.cassandra.Util;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.ColumnIdentifier;
import org.apache.cassandra.cql3.Operator;
@ -43,8 +45,8 @@ import org.apache.cassandra.cql3.restrictions.IndexRestrictions;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.apache.cassandra.cql3.statements.schema.IndexTarget;
import org.apache.cassandra.cql3.statements.ModificationStatement;
import org.apache.cassandra.db.ColumnFamilyStore.FlushReason;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.ColumnFamilyStore.FlushReason;
import org.apache.cassandra.db.filter.RowFilter;
import org.apache.cassandra.db.lifecycle.LifecycleNewTracker;
import org.apache.cassandra.db.marshal.AbstractType;
@ -55,10 +57,11 @@ import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
import org.apache.cassandra.db.rows.Row;
import org.apache.cassandra.db.rows.Unfiltered;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.index.internal.CassandraIndex;
import org.apache.cassandra.index.transactions.IndexTransaction;
import org.apache.cassandra.io.sstable.Component;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableFlushObserver;
import org.apache.cassandra.index.transactions.IndexTransaction;
import org.apache.cassandra.schema.ColumnMetadata;
import org.apache.cassandra.schema.IndexMetadata;
import org.apache.cassandra.schema.Indexes;
@ -162,6 +165,8 @@ public class CustomIndexTest extends CQLTester
@Test
public void nonCustomIndexesRequireExactlyOneTargetColumn() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s(k int, c int, v1 int, v2 int, PRIMARY KEY (k,c))");
assertInvalidMessage("Only CUSTOM indexes support multiple columns", "CREATE INDEX multi_idx on %s(v1,v2)");
@ -350,6 +355,8 @@ public class CustomIndexTest extends CQLTester
@Test
public void createIndexWithoutTargets() throws Throwable
{
Assume.assumeTrue("Test does not work with different default secondary index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
createTable("CREATE TABLE %s(k int, c int, v1 int, v2 int, PRIMARY KEY(k,c))");
// only allowed for CUSTOM indexes
assertInvalidMessage("Only CUSTOM indexes can be created without specifying a target column",
@ -458,6 +465,8 @@ public class CustomIndexTest extends CQLTester
@Test
public void customExpressionsMustTargetCustomIndex() throws Throwable
{
Assume.assumeTrue("Test does not work with different default secondary index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY (a, b))");
createIndex("CREATE INDEX non_custom_index ON %s(c)");
assertInvalidThrowMessage(Optional.of(ProtocolVersion.CURRENT),
@ -1393,6 +1402,8 @@ public class CustomIndexTest extends CQLTester
@Test
public void testIndexGroupsInstancesManagement() throws Throwable
{
Assume.assumeTrue("Test does not work with different default secondary index",
DatabaseDescriptor.getDefaultSecondaryIndex().equals(CassandraIndex.NAME));
String indexClassName = IndexWithSharedGroup.class.getName();
createTable("CREATE TABLE %s (k int PRIMARY KEY, v1 int, v2 int, v3 int, v4 int, v5 int)");
SecondaryIndexManager indexManager = getCurrentColumnFamilyStore().indexManager;

View File

@ -31,6 +31,7 @@ import com.google.common.collect.Sets;
import org.junit.After;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.SystemKeyspace;
@ -109,6 +110,7 @@ public class SecondaryIndexManagerTest extends CQLTester
@Test
public void addingSSTablesMarksTheIndexAsBuilt()
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, b))");
String indexName = createIndex("CREATE INDEX ON %s(c)");

View File

@ -27,6 +27,7 @@ import com.google.common.base.Joiner;
import com.google.common.collect.*;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
@ -480,6 +481,7 @@ public class CassandraIndexTest extends CQLTester
@Test
public void updateTTLOnIndexedClusteringValue() throws Throwable
{
Util.assumeLegacySecondaryIndex();
int basePk = 1;
int indexedVal = 2;
int initialTtl = 3600;

View File

@ -19,6 +19,7 @@ package org.apache.cassandra.index.sai.cql;
import org.junit.Test;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
import org.apache.cassandra.index.sai.SAITester;
import org.apache.cassandra.index.sai.StorageAttachedIndex;
@ -81,6 +82,8 @@ public class MixedIndexImplementationsTest extends SAITester
@Test
public void shouldRequireAllowFilteringWithOtherIndex() throws Throwable
{
Util.assumeLegacySecondaryIndex();
createTable("CREATE TABLE %s (" +
"k1 int, k2 int, " +
"s1 int static, " +

View File

@ -48,6 +48,7 @@ public class CQLSSTableWriterClientTest extends CQLSSTableWriterTest
@After
public void tearDown()
{
DatabaseDescriptor.setPartitionerUnsafe(oldPartitioner);
if (oldPartitioner != null)
DatabaseDescriptor.setPartitionerUnsafe(oldPartitioner);
}
}

View File

@ -476,7 +476,7 @@ public class LegacySSTableTest
{
// Only perform test if format uses cache.
SSTableReader sstable = Iterables.getFirst(Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple", legacyVersion)).getLiveSSTables(), null);
if (!(sstable instanceof KeyCacheSupport))
if (!(sstable instanceof KeyCacheSupport) || DatabaseDescriptor.getKeyCacheSizeInMiB() == 0)
return;
//For https://issues.apache.org/jira/browse/CASSANDRA-10778

View File

@ -56,6 +56,7 @@ public class StorageProxyTest
@Test
public void testSetGetPaxosVariant()
{
StorageProxy.instance.setPaxosVariant("v1"); // test-latest uses v2 as default, ensure we are starting with a known state
Assert.assertEquals(Config.PaxosVariant.v1, DatabaseDescriptor.getPaxosVariant());
Assert.assertEquals("v1", StorageProxy.instance.getPaxosVariant());
StorageProxy.instance.setPaxosVariant("v2");

View File

@ -49,7 +49,7 @@ public class CompactionStressTest extends OfflineToolUtils
"-p",
profileFile,
"-t",
"4");
"8");
tool.assertOnCleanExit();
tool = ToolRunner.invokeClass("org.apache.cassandra.stress.CompactionStress",
@ -59,7 +59,7 @@ public class CompactionStressTest extends OfflineToolUtils
"-p",
profileFile,
"-t",
"4");
"8");
tool.assertOnCleanExit();
}
}