Silence TSAN errors on ustime and mstime. Every CPU we support is atomic on aligned ints, but correctness matters

This commit is contained in:
John Sully 2022-05-17 03:49:59 +00:00
parent 8405c99017
commit a9d3490f9c
2 changed files with 6 additions and 2 deletions

View File

@ -3049,7 +3049,9 @@ void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) {
(r->keys_since_last_callback >= g_pserver->loading_process_events_interval_keys)))
{
rdbAsyncWorkThread *pwthread = reinterpret_cast<rdbAsyncWorkThread*>(r->chksum_arg);
bool fUpdateReplication = (g_pserver->mstime - r->last_update) > 1000;
mstime_t mstime;
__atomic_load(&g_pserver->mstime, &mstime, __ATOMIC_RELAXED);
bool fUpdateReplication = (mstime - r->last_update) > 1000;
if (fUpdateReplication) {
listIter li;

View File

@ -5534,6 +5534,8 @@ sds genRedisInfoString(const char *section) {
}
unsigned int lruclock = g_pserver->lruclock.load();
ustime_t ustime;
__atomic_load(&g_pserver->ustime, &ustime, __ATOMIC_RELAXED);
info = sdscatfmt(info,
"# Server\r\n"
"redis_version:%s\r\n"
@ -5576,7 +5578,7 @@ sds genRedisInfoString(const char *section) {
supervised,
g_pserver->runid,
g_pserver->port ? g_pserver->port : g_pserver->tls_port,
(int64_t)g_pserver->ustime,
(int64_t)ustime,
(int64_t)uptime,
(int64_t)(uptime/(3600*24)),
g_pserver->hz.load(),