Skip to content

Add configurable variable for Sentinel Test file#9260

Closed
hwware wants to merge 12 commits intoredis:unstablefrom
hwware:sentinel-delay-time-configuration
Closed

Add configurable variable for Sentinel Test file#9260
hwware wants to merge 12 commits intoredis:unstablefrom
hwware:sentinel-delay-time-configuration

Conversation

@hwware
Copy link
Contributor

@hwware hwware commented Jul 20, 2021

For test purpose, adding configurable variable for delayed time in Sentinel Test file
It is mentioned in the following 2 PR:
#8891 and #8710

oranagra and others added 4 commits July 20, 2021 21:48
…E, ASKING (redis#9208)

- SELECT and WAIT don't read or write from the keyspace (unlike DEL, EXISTS, EXPIRE, DBSIZE, KEYS, etc).
they're more similar to AUTH and HELLO (and maybe PING and COMMAND).
they only affect the current connection, not the server state, so they should be `@connection`, not `@keyspace`

- ROLE, like LASTSAVE is `@admin` (and `@dangerous` like INFO) 

- ASKING, READONLY, READWRITE are `@connection` too (not `@keyspace`)

- Additionally, i'm now documenting the exact meaning of each ACL category so it's clearer which commands belong where.
…NT,BITPOS may overflow (see CVE-2021-32761) (redis#9191)

GETBIT, SETBIT may access wrong address because of wrap.
BITCOUNT and BITPOS may return wrapped results.
BITFIELD may access the wrong address but also allocate insufficient memory and segfault (see CVE-2021-32761).

This commit uses `uint64_t` or `long long` instead of `size_t`.
related redis#8096

At 32bit platform:
> setbit bit 4294967295 1
(integer) 0
> config set proto-max-bulk-len 536870913
OK
> append bit "\xFF"
(integer) 536870913
> getbit bit 4294967296
(integer) 0

When the bit index is larger than 4294967295, size_t can't hold bit index. In the past,  `proto-max-bulk-len` is limit to 536870912, so there is no problem.

After this commit, bit position is stored in `uint64_t` or `long long`. So when `proto-max-bulk-len > 536870912`, 32bit platforms can still be correct.

For 64bit platform, this problem still exists. The major reason is bit pos 8 times of byte pos. When proto-max-bulk-len is very larger, bit pos may overflow.
But at 64bit platform, we don't have so long string. So this bug may never happen.

Additionally this commit add a test cost `512MB` memory which is tag as `large-memory`. Make freebsd ci and valgrind ci ignore this test.
This fixes an issue with zslGetRank which will happen only if the
skiplist data stracture is added two entries with the same element name,
this can't happen in redis zsets (we use dict), but in theory this is a
bug in the underlaying skiplist code.

Fixes redis#3081 and redis#4032

Co-authored-by: minjian.cai <[email protected]>
@yossigo
Copy link
Collaborator

yossigo commented Jul 25, 2021

@hwware I think the intention of a configurable delay in the issue you mentioned was to reduce some delays which are currently hard coded in Sentinel. For example:

#define SENTINEL_INFO_PERIOD 10000
#define SENTINEL_PING_PERIOD 1000
#define SENTINEL_ASK_PERIOD 1000
#define SENTINEL_PUBLISH_PERIOD 2000
#define SENTINEL_DEFAULT_DOWN_AFTER 30000
#define SENTINEL_TILT_TRIGGER 2000
#define SENTINEL_TILT_PERIOD (SENTINEL_PING_PERIOD*30)
#define SENTINEL_SLAVE_RECONF_TIMEOUT 10000
#define SENTINEL_MIN_LINK_RECONNECT_PERIOD 15000
#define SENTINEL_ELECTION_TIMEOUT 10000

Because of that, some test conditions cannot be re-created without introducing significant delays that slow down the entire suite. So, at least for testing purposes (and arguably, ONLY for those purposes - so users don't mess things up) we may want to be able to control these hard coded values.

…ded_time (redis#9031)

Add two INFO metrics:
```
total_eviction_exceeded_time:69734
current_eviction_exceeded_time:10230
```
`current_eviction_exceeded_time` if greater than 0, means how much time current used memory is greater than `maxmemory`. And we are still over the maxmemory. If used memory is below `maxmemory`, this metric is reset to 0.
`total_eviction_exceeded_time` means total time used memory is greater than `maxmemory` since server startup. 
The units of these two metrics are ms.

Co-authored-by: Oran Agra <[email protected]>
@daniel-house
Copy link

@yossigo Since you are referring to '#define xxx', it appears that you want to see a change to

#define SENTINEL_INFO_PERIOD 10000
and related lines so that they become default values that can be overridden in redis.conf.

That should be easy, but would expose them to the users. We could choose config property names that would scare the users off (for example, _TEST_PARAM_SENTINEL_INFO_PERIOD) and leave them undocumented, but they would still be exposed.

@yossigo
Copy link
Collaborator

yossigo commented Jul 27, 2021

@daniel-house We're already taking this approach in other areas of Redis, where the DEBUG command is used to manipulate Redis configuration or behavior in a way that is only useful for tests and otherwise dangerous.

I think we could follow the same pattern with Sentinel and have a SENTINEL DEBUG command that manipulates those parameters in a way that makes it obvious it's not intended for use in any real world system.

This is basically what you're suggesting, but aligned with existing conventions.

@hwware hwware closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants