Skip to content

Commit d3577f3

Browse files
authored
Robj/workflow parallelism (#656)
* remove experimental status on shared memory support * new test infra * increase parallelism and reduce waste * clean up list of tests to run * use my version of space maximizer to workaround bugs in upstream * fix deadlock in shard_log_write * make clockcache_get_free_page always succeed * fix log_test --perf forced failure exit code --------- Signed-off-by: Rob Johnson <rob@robjohnson.io>
1 parent 0731678 commit d3577f3

22 files changed

Lines changed: 287 additions & 1163 deletions

.github/workflows/run-tests.yml

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,66 +19,52 @@ jobs:
1919
run-test-matrix:
2020
strategy:
2121
matrix:
22-
compiler_mode: [gcc, clang, gcc-asan, clang-msan]
23-
build_mode: [release, debug]
24-
target: [all] # Just compile most configs
25-
include_slow_tests: ['true']
26-
run_nightly_tests: ['false']
22+
compiler_mode: [clang-msan, gcc-asan, clang, gcc]
23+
build_mode: [debug, release]
24+
target: [run-tests]
25+
tests_function: [cache_tests_1, cache_tests_2, cache_tests_3, functionality_tests, parallel_perf_test_1, parallel_perf_test_2, parallel_perf_test_3, parallel_perf_test_4, perf_tests_1, perf_tests_2, splinter_misc_tests_1, splinter_misc_tests_2, large_insert_stress_tests_1, large_insert_stress_tests_2, large_insert_stress_tests_3, misc_tests, filter_tests, unit_tests]
2726
exclude:
28-
# Don't do a compile job on these, since we will do run-tests on them below
2927
- compiler_mode: gcc-asan
30-
build_mode: release
31-
target: all
28+
build_mode: debug
29+
target: run-tests
3230
- compiler_mode: clang-msan
33-
build_mode: release
34-
target: all
35-
- compiler_mode: clang
3631
build_mode: debug
37-
target: all
38-
- compiler_mode: gcc
39-
build_mode: release
40-
target: all
32+
target: run-tests
33+
# The following tests are excluded because they take too long to run with sanitizers
34+
- build_mode: debug
35+
tests_function: large_insert_stress_tests_2
36+
- build_mode: debug
37+
tests_function: large_insert_stress_tests_3
38+
- compiler_mode: gcc-asan
39+
tests_function: large_insert_stress_tests_2
40+
- compiler_mode: gcc-asan
41+
tests_function: large_insert_stress_tests_3
42+
- compiler_mode: clang-msan
43+
tests_function: large_insert_stress_tests_2
44+
- compiler_mode: clang-msan
45+
tests_function: large_insert_stress_tests_3
4146
include:
42-
# Compile and run tests on these configs
4347
- compiler_mode: gcc-asan
44-
build_mode: release
45-
target: run-tests
46-
include_slow_tests: 'true'
47-
run_nightly_tests: 'false'
48+
build_mode: debug
49+
target: all
4850
- compiler_mode: clang-msan
49-
build_mode: release
50-
target: run-tests
51-
include_slow_tests: 'true'
52-
run_nightly_tests: 'false'
53-
- compiler_mode: clang
5451
build_mode: debug
55-
target: run-tests
56-
include_slow_tests: 'true'
57-
run_nightly_tests: 'false'
58-
- compiler_mode: gcc
59-
build_mode: release
60-
target: run-tests
61-
include_slow_tests: 'false'
62-
run_nightly_tests: 'true'
63-
name: >
64-
${{ matrix.target == 'all' && 'Compile' || 'Run' }}
65-
${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }}
66-
${{ matrix.target == 'run-tests' && matrix.include_slow_tests == 'true' && '(slow tests)' || '' }}
67-
${{ matrix.target == 'run-tests' && matrix.run_nightly_tests == 'true' && '(nightly tests)' || '' }}
52+
target: all
53+
name: ${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }} ${{ matrix.tests_function }}
6854
runs-on: ubuntu-latest
6955
env:
7056
CC: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
7157
LD: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
7258
BUILD_MODE: ${{ matrix.build_mode }}
7359
BUILD_ASAN: ${{ endsWith(matrix.compiler_mode, 'asan') && 1 || 0 }}
7460
BUILD_MSAN: ${{ endsWith(matrix.compiler_mode, 'msan') && 1 || 0 }}
75-
INCLUDE_SLOW_TESTS: ${{ matrix.include_slow_tests }}
76-
RUN_NIGHTLY_TESTS: ${{ matrix.run_nightly_tests }}
61+
TESTS_FUNCTION: ${{ matrix.tests_function }}
7762
steps:
7863
- name: Maximize build space
79-
uses: easimon/maximize-build-space@master
64+
uses: rtjohnso/maximize-build-space@master
8065
with:
81-
root-reserve-mb: 2048
66+
root-reserve-mb: 4096
67+
temp-reserve-mb: 4096
8268
swap-size-mb: 1
8369
remove-dotnet: true
8470
remove-android: true
@@ -90,4 +76,4 @@ jobs:
9076
with:
9177
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-19 clang-format-19
9278
- name: make ${{ matrix.target }}
93-
run: pwd; make ${{ matrix.target }}
79+
run: df -h; make ${{ matrix.target }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ run-tests: all-tests
558558
BINDIR=$(BINDIR) ./test.sh
559559

560560
test-results: all-tests
561-
INCLUDE_SLOW_TESTS=true BINDIR=$(BINDIR) ./test.sh 2>&1 | tee ./test-results
561+
BINDIR=$(BINDIR) ./test.sh 2>&1 | tee ./test-results
562562

563563
run-examples: all-examples
564564
for i in $(EXAMPLES_BINS); do $$i || exit; done

ci/steps.lib.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ config:
5757
run:
5858
path: sh
5959
args: ["-c", "cd /splinterdb && ./test.sh"]
60-
params:
61-
INCLUDE_SLOW_TESTS: "true"
6260
#@ end
6361

6462
---
@@ -96,8 +94,6 @@ config:
9694
params:
9795
CC: #@ compiler
9896
LD: #@ compiler
99-
INCLUDE_SLOW_TESTS: #@ str(not quick).lower()
100-
RUN_NIGHTLY_TESTS: #@ str(test_nightly).lower()
10197
BUILD_VERBOSE: "1"
10298
VERBOSE: "3"
10399

docs/testing.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,16 @@ _Audience: All users and contributors._
77

88

99
## Testing Overview
10-
In CI, we execute these tests against the following build modes
11-
- All tests on optimized and debug builds using clang
12-
- All tests on optimized and debug builds using gcc
13-
- All tests using address-sanitizer debug builds using the clang compiler
14-
- All tests using memory-sanitizer debug builds using the gcc compiler
15-
- clang-format checks
16-
- [shellcheck](https://www.shellcheck.net) and shfmt checks run against shell scripts
17-
18-
To run a small collection of unit-tests to give you a very quick
19-
baseline stability of the library, do: `$ make run-tests`
10+
To run the full test-suite, do: `$ make run-tests` or `$make test-results`. The former runs the tests and outputs the results to the terminal. The `test-results` target generates a file with the test results.
2011

2112
The [`make run-tests`](../Makefile#:~:text=run%2Dtests) target invokes the
2213
underlying [`test.sh`](../test.sh) script to run quick tests.
2314

24-
To execute a larger set of tests, including functional and performance tests,
25-
you can do one of the following:
26-
15+
To execute a smaller set of tests, you can do the following:
2716
```shell
28-
$ make test-results
29-
$ INCLUDE_SLOW_TESTS=true make run-tests
30-
$ INCLUDE_SLOW_TESTS=true ./test.sh
17+
$ TESTS_FUNCTION=<func> make <test-results | run-tests>
3118
```
19+
See `test.sh` for valid values for `TESTS_FUNCTION`.
3220

3321
In CI, all test execution is driven by the top-level [test.sh](../test.sh)
3422
script, which exercises individual build artifacts produced for testing, as

docs/unit-testing.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ unit-test binary with the `--list` argument.
7373
----
7474
## How To Run unit-tests
7575

76-
Quick **smoke-tests** run of unit tests: `$ make run-tests`
77-
78-
This runs a small subset of unit tests, which execute very quickly, so that you
79-
get a quick turnaround on the overall stability of your changes.
80-
81-
You can achieve the same result by executing the following test driver script
82-
[test.sh](../test.sh#:~:text=if%20\[%20"$INCLUDE%5FSLOW%5FTESTS"%20!=%20"true"%20\]): `$ ./test.sh`
83-
8476
To **run** all the unit-test suites: `$ bin/unit_test`
8577

8678
To run a specific suite, optionally filtering on a specific test case:

include/splinterdb/splinterdb.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ splinterdb_get_version();
3434
* for all structures (default), or choose to setup a shared segment
3535
* which will be used for shared structures.
3636
*
37-
* ******************* EXPERIMENTAL FEATURES ********************
38-
*
39-
* - use_shmem: Support for shared memory segments:
40-
* This flag will configure a shared memory segment. All (most) run-time
41-
* memory allocation will be done from this shared segment. Currently,
42-
* we do not support free(), so you will likely run out of shared memory
43-
* and run into shared-memory OOM errors. This functionality is
44-
* solely meant for internal development uses.
45-
*
46-
* ******************* EXPERIMENTAL FEATURES ********************
4737
*/
4838
typedef struct splinterdb_config {
4939
// required configuration

src/clockcache.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,9 +1223,7 @@ clockcache_get_free_page(clockcache *cc,
12231223
* not give up after 3 passes on the cache. At least wait for the
12241224
* max latency of an IO and keep making passes.
12251225
*/
1226-
while (num_passes < 3
1227-
|| (blocking && !io_max_latency_elapsed(cc->io, wait_start)))
1228-
{
1226+
while (num_passes < 3 || blocking) {
12291227
uint64 start_entry = cc->per_thread[tid].free_hand * CC_ENTRIES_PER_BATCH;
12301228
uint64 end_entry = start_entry + CC_ENTRIES_PER_BATCH;
12311229
for (entry_no = start_entry; entry_no < end_entry; entry_no++) {

src/platform_linux/platform_io.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ struct iovec;
3737
#define IO_DEFAULT_FLAGS (O_RDWR | O_CREAT)
3838
#define IO_DEFAULT_PERMS (0755)
3939
#define IO_DEFAULT_KERNEL_QUEUE_SIZE (256)
40-
#define IO_DEFAULT_FILENAME "db"
4140
#define IO_DEFAULT_ASYNC_QUEUE_DEPTH (256)
4241

4342
/*

src/shard_log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ shard_log_write(log_handle *logh, key tuple_key, message msg, uint64 generation)
227227
page = cache_get(cc, thread_data->addr, TRUE, PAGE_TYPE_LOG);
228228
uint64 wait = 1;
229229
while (!cache_try_claim(cc, page)) {
230+
cache_unget(cc, page);
230231
platform_sleep_ns(wait);
231232
wait = wait > 1024 ? wait : 2 * wait;
233+
page = cache_get(cc, thread_data->addr, TRUE, PAGE_TYPE_LOG);
232234
}
233235
cache_lock(cc, page);
234236
}

0 commit comments

Comments
 (0)