2020-05-03 02:31:50 -04:00
name : Daily
on :
2020-07-20 06:57:54 -04:00
pull_request :
branches :
# any PR to a release branch.
- '[0-9].[0-9]'
2020-05-03 02:31:50 -04:00
schedule :
2020-07-12 06:55:26 -04:00
- cron : '0 0 * * *'
2021-06-22 10:23:59 -04:00
workflow_dispatch :
inputs :
2021-06-23 15:13:24 -04:00
skipjobs :
2021-07-05 01:46:19 -04:00
description : 'jobs to skip (delete the ones you wanna keep, do not leave empty)'
Reclaim page cache of RDB file (#11248)
# Background
The RDB file is usually generated and used once and seldom used again, but the content would reside in page cache until OS evicts it. A potential problem is that once the free memory exhausts, the OS have to reclaim some memory from page cache or swap anonymous page out, which may result in a jitters to the Redis service.
Supposing an exact scenario, a high-capacity machine hosts many redis instances, and we're upgrading the Redis together. The page cache in host machine increases as RDBs are generated. Once the free memory drop into low watermark(which is more likely to happen in older Linux kernel like 3.10, before [watermark_scale_factor](https://lore.kernel.org/lkml/1455813719-2395-1-git-send-email-hannes@cmpxchg.org/) is introduced, the `low watermark` is linear to `min watermark`, and there'is not too much buffer space for `kswapd` to be wake up to reclaim memory), a `direct reclaim` happens, which means the process would stall to wait for memory allocation.
# What the PR does
The PR introduces a capability to reclaim the cache when the RDB is operated. Generally there're two cases, read and write the RDB. For read it's a little messy to address the incremental reclaim, so the reclaim is done in one go in background after the load is finished to avoid blocking the work thread. For write, incremental reclaim amortizes the work of reclaim so no need to put it into background, and the peak watermark of cache can be reduced in this way.
Two cases are addresses specially, replication and restart, for both of which the cache is leveraged to speed up the processing, so the reclaim is postponed to a right time. To do this, a flag is added to`rdbSave` and `rdbLoad` to control whether the cache need to be kept, with the default value false.
# Something deserve noting
1. Though `posix_fadvise` is the POSIX standard, but only few platform support it, e.g. Linux, FreeBSD 10.0.
2. In Linux `posix_fadvise` only take effect on writeback-ed pages, so a `sync`(or `fsync`, `fdatasync`) is needed to flush the dirty page before `posix_fadvise` if we reclaim write cache.
# About test
A unit test is added to verify the effect of `posix_fadvise`.
In integration test overall cache increase is checked, as well as the cache backed by RDB as a specific TCL test is executed in isolated Github action job.
2023-02-12 02:23:29 -05:00
default : 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,centos,malloc,specific'
2021-06-23 15:13:24 -04:00
skiptests :
2021-07-05 01:46:19 -04:00
description : 'tests to skip (delete the ones you wanna keep, do not leave empty)'
2022-02-13 10:43:19 -05:00
default : 'redis,modules,sentinel,cluster,unittest'
2021-06-22 10:23:59 -04:00
test_args :
description : 'extra test arguments'
default : ''
cluster_test_args :
description : 'extra cluster / sentinel test arguments'
default : ''
2021-06-23 15:13:24 -04:00
use_repo :
description : 'repo owner and name'
default : 'redis/redis'
use_git_ref :
description : 'git branch or sha to use'
default : 'unstable'
2021-06-22 10:23:59 -04:00
2020-05-03 02:31:50 -04:00
jobs :
2020-05-24 01:00:12 -04:00
2020-07-30 06:25:10 -04:00
test-ubuntu-jemalloc :
2020-05-03 02:31:50 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'ubuntu')
2020-07-12 06:55:26 -04:00
timeout-minutes : 14400
2020-05-03 02:31:50 -04:00
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2021-06-24 05:50:10 -04:00
echo "skipping: ${{github.event.inputs.skipjobs}} and ${{github.event.inputs.skiptests}}"
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-05-03 02:31:50 -04:00
- name : make
2021-03-10 02:13:11 -05:00
run : make REDIS_CFLAGS='-Werror -DREDIS_TEST'
2021-06-22 10:23:59 -04:00
- name : testprep
run : sudo apt-get install tcl8.6 tclx
2020-05-03 02:31:50 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-05-03 02:31:50 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-12 06:55:26 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2020-07-12 06:55:26 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2021-03-10 02:13:11 -05:00
- name : unittest
2022-02-13 10:43:19 -05:00
if : true && !contains(github.event.inputs.skiptests, 'unittest')
2021-11-16 14:00:13 -05:00
run : ./src/redis-server test all --accurate
2020-05-03 02:31:50 -04:00
2020-07-30 06:25:10 -04:00
test-ubuntu-libc-malloc :
2020-05-03 02:31:50 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'malloc')
2020-07-12 06:55:26 -04:00
timeout-minutes : 14400
2020-05-03 02:31:50 -04:00
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-05-03 02:31:50 -04:00
- name : make
2021-11-29 03:30:35 -05:00
run : make MALLOC=libc REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
run : sudo apt-get install tcl8.6 tclx
2020-05-03 02:31:50 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-05-03 02:31:50 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-12 06:55:26 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2020-07-12 06:55:26 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2020-05-03 02:31:50 -04:00
2021-02-25 02:24:41 -05:00
test-ubuntu-no-malloc-usable-size :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'malloc')
2021-02-25 02:24:41 -05:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-02-25 02:24:41 -05:00
- name : make
2021-11-29 03:30:35 -05:00
run : make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
run : sudo apt-get install tcl8.6 tclx
2021-02-25 02:24:41 -05:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-25 02:24:41 -05:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-25 02:24:41 -05:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2021-02-25 02:24:41 -05:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2021-02-25 02:24:41 -05:00
2020-07-30 06:25:10 -04:00
test-ubuntu-32bit :
2020-05-24 01:00:12 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, '32bit')
2020-07-12 06:55:26 -04:00
timeout-minutes : 14400
2020-05-24 01:00:12 -04:00
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-05-24 01:00:12 -04:00
- name : make
run : |
sudo apt-get update && sudo apt-get install libc6-dev-i386
2021-03-10 02:13:11 -05:00
make 32bit REDIS_CFLAGS='-Werror -DREDIS_TEST'
2021-06-22 10:23:59 -04:00
- name : testprep
run : sudo apt-get install tcl8.6 tclx
2020-05-24 01:00:12 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-05-24 01:00:12 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2020-05-27 11:09:09 -04:00
run : |
make -C tests/modules 32bit # the script below doesn't have an argument, we must build manually ahead of time
2021-11-09 15:37:18 -05:00
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-12 06:55:26 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2020-07-12 06:55:26 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2021-03-10 02:13:11 -05:00
- name : unittest
2022-02-13 10:43:19 -05:00
if : true && !contains(github.event.inputs.skiptests, 'unittest')
2021-11-16 14:00:13 -05:00
run : ./src/redis-server test all --accurate
2020-05-24 01:00:12 -04:00
2020-07-30 06:25:10 -04:00
test-ubuntu-tls :
2020-05-25 10:25:23 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'tls')
2020-07-12 06:55:26 -04:00
timeout-minutes : 14400
2020-05-25 10:25:23 -04:00
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-05-25 10:25:23 -04:00
- name : make
run : |
2021-11-29 03:30:35 -05:00
make BUILD_TLS=yes REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
2020-05-25 10:25:23 -04:00
run : |
2021-04-25 06:08:46 -04:00
sudo apt-get install tcl8.6 tclx tcl-tls
2020-05-25 10:25:23 -04:00
./utils/gen-test-certs.sh
2021-06-22 10:23:59 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : |
2022-03-22 11:38:01 -04:00
./runtest --accurate --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
- name : module api test
if : true && !contains(github.event.inputs.skiptests, 'modules')
run : |
./runtest-moduleapi --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
- name : sentinel tests
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
run : |
./runtest-sentinel --tls ${{github.event.inputs.cluster_test_args}}
- name : cluster tests
if : true && !contains(github.event.inputs.skiptests, 'cluster')
run : |
./runtest-cluster --tls ${{github.event.inputs.cluster_test_args}}
test-ubuntu-tls-no-tls :
runs-on : ubuntu-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'tls')
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : |
make BUILD_TLS=yes REDIS_CFLAGS='-Werror'
- name : testprep
run : |
sudo apt-get install tcl8.6 tclx tcl-tls
./utils/gen-test-certs.sh
- name : test
if : true && !contains(github.event.inputs.skiptests, 'redis')
run : |
2021-06-22 10:23:59 -04:00
./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-05-25 10:25:23 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2020-08-17 10:36:50 -04:00
run : |
2021-11-09 15:37:18 -05:00
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-12 06:55:26 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2020-08-17 10:36:50 -04:00
run : |
2021-06-22 10:23:59 -04:00
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2020-07-12 06:55:26 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2020-08-17 10:36:50 -04:00
run : |
2021-06-22 10:23:59 -04:00
./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2020-05-25 10:25:23 -04:00
2021-01-17 08:48:48 -05:00
test-ubuntu-io-threads :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'iothreads')
2021-01-17 08:48:48 -05:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-01-17 08:48:48 -05:00
- name : make
run : |
2021-11-29 03:30:35 -05:00
make REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
run : sudo apt-get install tcl8.6 tclx
2021-01-17 08:48:48 -05:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs ${{github.event.inputs.test_args}}
2021-01-17 08:48:48 -05:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes ${{github.event.inputs.cluster_test_args}}
2021-01-17 08:48:48 -05:00
Reclaim page cache of RDB file (#11248)
# Background
The RDB file is usually generated and used once and seldom used again, but the content would reside in page cache until OS evicts it. A potential problem is that once the free memory exhausts, the OS have to reclaim some memory from page cache or swap anonymous page out, which may result in a jitters to the Redis service.
Supposing an exact scenario, a high-capacity machine hosts many redis instances, and we're upgrading the Redis together. The page cache in host machine increases as RDBs are generated. Once the free memory drop into low watermark(which is more likely to happen in older Linux kernel like 3.10, before [watermark_scale_factor](https://lore.kernel.org/lkml/1455813719-2395-1-git-send-email-hannes@cmpxchg.org/) is introduced, the `low watermark` is linear to `min watermark`, and there'is not too much buffer space for `kswapd` to be wake up to reclaim memory), a `direct reclaim` happens, which means the process would stall to wait for memory allocation.
# What the PR does
The PR introduces a capability to reclaim the cache when the RDB is operated. Generally there're two cases, read and write the RDB. For read it's a little messy to address the incremental reclaim, so the reclaim is done in one go in background after the load is finished to avoid blocking the work thread. For write, incremental reclaim amortizes the work of reclaim so no need to put it into background, and the peak watermark of cache can be reduced in this way.
Two cases are addresses specially, replication and restart, for both of which the cache is leveraged to speed up the processing, so the reclaim is postponed to a right time. To do this, a flag is added to`rdbSave` and `rdbLoad` to control whether the cache need to be kept, with the default value false.
# Something deserve noting
1. Though `posix_fadvise` is the POSIX standard, but only few platform support it, e.g. Linux, FreeBSD 10.0.
2. In Linux `posix_fadvise` only take effect on writeback-ed pages, so a `sync`(or `fsync`, `fdatasync`) is needed to flush the dirty page before `posix_fadvise` if we reclaim write cache.
# About test
A unit test is added to verify the effect of `posix_fadvise`.
In integration test overall cache increase is checked, as well as the cache backed by RDB as a specific TCL test is executed in isolated Github action job.
2023-02-12 02:23:29 -05:00
test-ubuntu-reclaim-cache :
runs-on : ubuntu-latest
if : |
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'specific')
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
- uses : actions/checkout@v3
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : |
make REDIS_CFLAGS='-Werror'
- name : testprep
run : |
sudo apt-get install vmtouch
mkdir /tmp/master
mkdir /tmp/slave
- name : warm up
run : |
./src/redis-server --daemonize yes --logfile /dev/null
./src/redis-benchmark -n 1 > /dev/null
./src/redis-cli save | grep OK > /dev/null
vmtouch -v ./dump.rdb > /dev/null
- name : test
run : |
echo "test SAVE doesn't increase cache"
CACHE0=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')
./src/redis-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 --repl-diskless-sync no --pidfile /tmp/master/redis.pid
./src/redis-server --daemonize yes --logfile /dev/null --dir /tmp/slave --port 8081 --repl-diskless-load disabled
./src/redis-benchmark -p 8080 -d 102400 -t set -r 100000 -n 10000 > /dev/null
./src/redis-cli -p 8080 save > /dev/null
VMOUT=$(vmtouch -v /tmp/master/dump.rdb)
echo $VMOUT
grep -q "0%" <<< $VMOUT
CACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')
if [ "$(( $CACHE-$CACHE0 ))" -gt "500000" ]; then echo "$CACHE0 $CACHE"; exit 1; fi
echo "test replication doesn't increase cache"
./src/redis-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null
while [ $(./src/redis-cli -p 8081 info replication | grep "master_link_status:down") ]; do sleep 1; done;
sleep 1 # wait for the completion of cache reclaim bio
VMOUT=$(vmtouch -v /tmp/master/dump.rdb)
echo $VMOUT
grep -q "0%" <<< $VMOUT
VMOUT=$(vmtouch -v /tmp/slave/dump.rdb)
echo $VMOUT
grep -q "0%" <<< $VMOUT
CACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')
if [ "$(( $CACHE-$CACHE0 ))" -gt "500000" ]; then echo "$CACHE0 $CACHE"; exit 1; fi
echo "test reboot doesn't increase cache"
PID=$(cat /tmp/master/redis.pid)
kill -15 $PID
while [ -x /proc/${PID} ]; do sleep 1; done
./src/redis-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080
while [ $(./src/redis-cli -p 8080 info persistence | grep "loading:1") ]; do sleep 1; done;
sleep 1 # wait for the completion of cache reclaim bio
VMOUT=$(vmtouch -v /tmp/master/dump.rdb)
echo $VMOUT
grep -q "0%" <<< $VMOUT
CACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')
if [ "$(( $CACHE-$CACHE0 ))" -gt "500000" ]; then echo "$CACHE0 $CACHE"; exit 1; fi
2022-03-22 11:38:01 -04:00
test-valgrind-test :
2020-05-03 02:31:50 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'redis')
2020-05-03 02:31:50 -04:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-05-03 02:31:50 -04:00
- name : make
2021-03-10 02:13:11 -05:00
run : make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST'
2021-06-22 10:23:59 -04:00
- name : testprep
2020-05-03 02:31:50 -04:00
run : |
2020-09-13 06:51:21 -04:00
sudo apt-get update
2021-04-25 06:08:46 -04:00
sudo apt-get install tcl8.6 tclx valgrind -y
2021-06-22 10:23:59 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-11-16 14:00:13 -05:00
run : ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
test-valgrind-misc :
runs-on : ubuntu-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest'))
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST'
- name : testprep
run : |
sudo apt-get update
sudo apt-get install tcl8.6 tclx valgrind -y
2020-05-03 02:31:50 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-10 12:38:58 -05:00
run : ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
2021-03-10 02:13:11 -05:00
- name : unittest
2022-02-13 10:43:19 -05:00
if : true && !contains(github.event.inputs.skiptests, 'unittest')
2021-03-10 02:13:11 -05:00
run : |
valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
2020-07-30 06:25:10 -04:00
2022-03-22 11:38:01 -04:00
test-valgrind-no-malloc-usable-size-test :
2021-02-25 02:24:41 -05:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'redis')
2021-02-25 02:24:41 -05:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-02-25 02:24:41 -05:00
- name : make
2022-03-22 11:38:01 -04:00
run : make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE -DREDIS_TEST" REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
2021-02-25 02:24:41 -05:00
run : |
sudo apt-get update
2021-04-25 06:08:46 -04:00
sudo apt-get install tcl8.6 tclx valgrind -y
2021-06-22 10:23:59 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-11-16 14:00:13 -05:00
run : ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
test-valgrind-no-malloc-usable-size-misc :
runs-on : ubuntu-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest'))
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE -DREDIS_TEST" REDIS_CFLAGS='-Werror'
- name : testprep
run : |
sudo apt-get update
sudo apt-get install tcl8.6 tclx valgrind -y
2021-02-25 02:24:41 -05:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-10 12:38:58 -05:00
run : ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
- name : unittest
if : true && !contains(github.event.inputs.skiptests, 'unittest')
run : |
valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
2021-02-25 02:24:41 -05:00
2021-11-11 06:51:33 -05:00
test-sanitizer-address :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'sanitizer')
2021-11-11 06:51:33 -05:00
timeout-minutes : 14400
strategy :
matrix :
compiler : [ gcc, clang ]
env :
CC : ${{ matrix.compiler }}
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-11-11 06:51:33 -05:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
2021-11-29 03:30:35 -05:00
run : make SANITIZER=address REDIS_CFLAGS='-DREDIS_TEST -Werror'
2021-11-11 06:51:33 -05:00
- name : testprep
run : |
sudo apt-get update
sudo apt-get install tcl8.6 tclx -y
- name : test
if : true && !contains(github.event.inputs.skiptests, 'redis')
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
- name : module api test
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-18 09:04:01 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-11-11 06:51:33 -05:00
- name : sentinel tests
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
- name : cluster tests
if : true && !contains(github.event.inputs.skiptests, 'cluster')
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
- name : unittest
2022-02-13 10:43:19 -05:00
if : true && !contains(github.event.inputs.skiptests, 'unittest')
2021-11-21 11:27:54 -05:00
run : ./src/redis-server test all
2021-11-11 06:51:33 -05:00
test-sanitizer-undefined :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'sanitizer')
2021-11-11 06:51:33 -05:00
timeout-minutes : 14400
strategy :
matrix :
compiler : [ gcc, clang ]
env :
CC : ${{ matrix.compiler }}
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-11-11 06:51:33 -05:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
2021-11-29 03:30:35 -05:00
run : make SANITIZER=undefined REDIS_CFLAGS='-DREDIS_TEST -Werror' LUA_DEBUG=yes # we (ab)use this flow to also check Lua C API violations
2021-11-11 06:51:33 -05:00
- name : testprep
run : |
sudo apt-get update
sudo apt-get install tcl8.6 tclx -y
- name : test
if : true && !contains(github.event.inputs.skiptests, 'redis')
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
- name : module api test
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-18 09:04:01 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-11-11 06:51:33 -05:00
- name : sentinel tests
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
- name : cluster tests
if : true && !contains(github.event.inputs.skiptests, 'cluster')
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
- name : unittest
2022-02-13 10:43:19 -05:00
if : true && !contains(github.event.inputs.skiptests, 'unittest')
2021-11-16 14:00:13 -05:00
run : ./src/redis-server test all --accurate
2021-11-11 06:51:33 -05:00
2020-07-30 06:25:10 -04:00
test-centos7-jemalloc :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'centos')
2020-07-30 06:25:10 -04:00
container : centos:7
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-07-30 06:25:10 -04:00
- name : make
run : |
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
yum -y install gcc make
2021-11-29 03:30:35 -05:00
make REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
run : yum -y install which tcl tclx
2020-07-30 06:25:10 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
2022-11-21 15:53:13 -05:00
test-centos7-tls-module :
2020-07-30 06:25:10 -04:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'tls')
2020-07-30 06:25:10 -04:00
container : centos:7
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-07-30 06:25:10 -04:00
- name : make
run : |
yum -y install centos-release-scl epel-release
yum -y install devtoolset-7 openssl-devel openssl
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
scl enable devtoolset-7 "make BUILD_TLS=module REDIS_CFLAGS='-Werror'"
2021-06-22 10:23:59 -04:00
- name : testprep
2020-07-30 06:25:10 -04:00
run : |
2021-04-25 06:08:46 -04:00
yum -y install tcl tcltls tclx
2020-07-30 06:25:10 -04:00
./utils/gen-test-certs.sh
2021-06-22 10:23:59 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : |
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
./runtest --accurate --verbose --dump-logs --tls-module --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
- name : module api test
if : true && !contains(github.event.inputs.skiptests, 'modules')
run : |
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
./runtest-moduleapi --verbose --dump-logs --tls-module --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
- name : sentinel tests
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
run : |
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2022-03-22 11:38:01 -04:00
- name : cluster tests
if : true && !contains(github.event.inputs.skiptests, 'cluster')
run : |
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
./runtest-cluster --tls-module ${{github.event.inputs.cluster_test_args}}
2022-03-22 11:38:01 -04:00
2022-11-21 15:53:13 -05:00
test-centos7-tls-module-no-tls :
2022-03-22 11:38:01 -04:00
runs-on : ubuntu-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'tls')
2022-03-22 11:38:01 -04:00
container : centos:7
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : |
yum -y install centos-release-scl epel-release
yum -y install devtoolset-7 openssl-devel openssl
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
scl enable devtoolset-7 "make BUILD_TLS=module REDIS_CFLAGS='-Werror'"
2022-03-22 11:38:01 -04:00
- name : testprep
run : |
yum -y install tcl tcltls tclx
./utils/gen-test-certs.sh
- name : test
if : true && !contains(github.event.inputs.skiptests, 'redis')
run : |
2021-06-22 10:23:59 -04:00
./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-30 06:25:10 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2020-08-17 10:36:50 -04:00
run : |
2021-11-09 15:37:18 -05:00
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2020-07-30 06:25:10 -04:00
- name : sentinel tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2020-08-17 10:36:50 -04:00
run : |
2021-06-22 10:23:59 -04:00
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2020-07-30 06:25:10 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2020-08-17 10:36:50 -04:00
run : |
2021-06-22 10:23:59 -04:00
./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2020-07-30 06:25:10 -04:00
2020-09-08 03:59:25 -04:00
test-macos-latest :
runs-on : macos-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'macos') && !(contains(github.event.inputs.skiptests, 'redis') && contains(github.event.inputs.skiptests, 'modules'))
2020-09-08 03:59:25 -04:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2020-09-08 03:59:25 -04:00
- name : make
2021-11-29 03:30:35 -05:00
run : make REDIS_CFLAGS='-Werror'
2020-09-08 03:59:25 -04:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --no-latency --dump-logs ${{github.event.inputs.test_args}}
2020-09-08 03:59:25 -04:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-16 14:00:13 -05:00
run : ./runtest-moduleapi --verbose --no-latency --dump-logs ${{github.event.inputs.test_args}}
2022-03-22 11:38:01 -04:00
test-macos-latest-sentinel :
runs-on : macos-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'sentinel')
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : make REDIS_CFLAGS='-Werror'
2020-09-08 03:59:25 -04:00
- name : sentinel tests
2021-07-05 01:46:19 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2022-03-22 11:38:01 -04:00
test-macos-latest-cluster :
runs-on : macos-latest
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'cluster')
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : make
run : make REDIS_CFLAGS='-Werror'
2020-09-08 03:59:25 -04:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2020-09-08 03:59:25 -04:00
2021-01-20 07:07:09 -05:00
test-freebsd :
2022-07-19 08:30:06 -04:00
runs-on : macos-12
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'freebsd') && !(contains(github.event.inputs.skiptests, 'redis') && contains(github.event.inputs.skiptests, 'modules'))
2021-01-20 07:07:09 -05:00
timeout-minutes : 14400
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-01-20 07:07:09 -05:00
- name : test
2022-11-04 14:28:27 -04:00
uses : vmactions/freebsd-vm@v0.3.0
2021-01-20 07:07:09 -05:00
with :
usesh : true
2021-02-03 10:35:28 -05:00
sync : rsync
2022-02-02 03:39:34 -05:00
copyback : false
2021-04-25 06:08:46 -04:00
prepare : pkg install -y bash gmake lang/tcl86 lang/tclx
2021-02-03 10:35:28 -05:00
run : >
2021-06-24 05:50:10 -04:00
gmake || exit 1 ;
2021-11-16 14:00:13 -05:00
if echo "${{github.event.inputs.skiptests}}" | grep -vq redis ; then ./runtest --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ;
if echo "${{github.event.inputs.skiptests}}" | grep -vq modules ; then MAKE=gmake ./runtest-moduleapi --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ;
2022-03-22 11:38:01 -04:00
test-freebsd-sentinel :
2022-07-19 08:30:06 -04:00
runs-on : macos-12
2022-03-22 11:38:01 -04:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'freebsd') && !contains(github.event.inputs.skiptests, 'sentinel')
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : test
2022-11-04 14:28:27 -04:00
uses : vmactions/freebsd-vm@v0.3.0
2022-03-22 11:38:01 -04:00
with :
usesh : true
sync : rsync
copyback : false
prepare : pkg install -y bash gmake lang/tcl86 lang/tclx
run : >
gmake || exit 1 ;
2021-06-24 05:50:10 -04:00
if echo "${{github.event.inputs.skiptests}}" | grep -vq sentinel ; then ./runtest-sentinel ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ;
2022-03-22 11:38:01 -04:00
test-freebsd-cluster :
2022-07-19 08:30:06 -04:00
runs-on : macos-12
2022-03-22 11:38:01 -04:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'freebsd') && !contains(github.event.inputs.skiptests, 'cluster')
2022-03-22 11:38:01 -04:00
timeout-minutes : 14400
steps :
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2022-03-22 11:38:01 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
- name : test
2022-11-04 14:28:27 -04:00
uses : vmactions/freebsd-vm@v0.3.0
2022-03-22 11:38:01 -04:00
with :
usesh : true
sync : rsync
copyback : false
prepare : pkg install -y bash gmake lang/tcl86 lang/tclx
run : >
gmake || exit 1 ;
2021-06-24 05:50:10 -04:00
if echo "${{github.event.inputs.skiptests}}" | grep -vq cluster ; then ./runtest-cluster ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ;
2021-02-23 05:57:45 -05:00
2021-02-23 10:08:49 -05:00
test-alpine-jemalloc :
2021-02-23 05:57:45 -05:00
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'alpine')
2021-02-23 05:57:45 -05:00
container : alpine:latest
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-02-23 05:57:45 -05:00
- name : make
run : |
apk add build-base
make REDIS_CFLAGS='-Werror'
2021-06-22 10:23:59 -04:00
- name : testprep
run : apk add tcl procps tclx
2021-02-23 05:57:45 -05:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-23 05:57:45 -05:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-23 05:57:45 -05:00
- name : sentinel tests
2021-07-05 01:46:19 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2021-02-23 05:57:45 -05:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
2021-02-23 10:08:49 -05:00
test-alpine-libc-malloc :
runs-on : ubuntu-latest
2021-11-11 07:39:20 -05:00
if : |
2022-03-29 11:35:17 -04:00
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
!contains(github.event.inputs.skipjobs, 'alpine')
2021-02-23 10:08:49 -05:00
container : alpine:latest
steps :
2021-06-23 15:13:24 -04:00
- name : prep
if : github.event_name == 'workflow_dispatch'
run : |
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
2022-03-30 09:18:03 -04:00
- uses : actions/checkout@v3
2021-06-23 15:13:24 -04:00
with :
repository : ${{ env.GITHUB_REPOSITORY }}
ref : ${{ env.GITHUB_HEAD_REF }}
2021-02-23 10:08:49 -05:00
- name : make
run : |
apk add build-base
2021-02-25 02:24:41 -05:00
make REDIS_CFLAGS='-Werror' USE_JEMALLOC=no CFLAGS=-DUSE_MALLOC_USABLE_SIZE
2021-06-22 10:23:59 -04:00
- name : testprep
run : apk add tcl procps tclx
2021-02-23 10:08:49 -05:00
- name : test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'redis')
2021-06-22 10:23:59 -04:00
run : ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-23 10:08:49 -05:00
- name : module api test
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'modules')
2021-11-09 15:37:18 -05:00
run : ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
2021-02-23 10:08:49 -05:00
- name : sentinel tests
2021-07-05 01:46:19 -04:00
if : true && !contains(github.event.inputs.skiptests, 'sentinel')
2021-06-22 10:23:59 -04:00
run : ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
2021-02-23 10:08:49 -05:00
- name : cluster tests
2021-06-23 16:56:40 -04:00
if : true && !contains(github.event.inputs.skiptests, 'cluster')
2021-06-22 10:23:59 -04:00
run : ./runtest-cluster ${{github.event.inputs.cluster_test_args}}