- 28 Feb, 2023 1 commit
-
-
uriyage authored
In #7875 (Redis 6.2), we changed the sds alloc to be the usable allocation size in order to: > reduce the need for realloc calls by making the sds implicitly take over the internal fragmentation This change was done most sds functions, excluding `sdsRemoveFreeSpace` and `sdsResize`, the reason is that in some places (e.g. clientsCronResizeQueryBuffer) we call sdsRemoveFreeSpace when we see excessive free space and want to trim it. so if we don't trim it exactly to size, the caller may still see excessive free space and call it again and again. However, this resulted in some excessive calls to realloc, even when there's no need and it's gonna be a no-op (e.g. when reducing 15 bytes allocation to 13). It turns out that a call for realloc with jemalloc can be expensive even if it ends up doing nothing, so this PR adds a check using `je_nallocx`, which is cheap to avoid the call for realloc. in addition to that this PR unifies sdsResize and sdsRemoveFreeSpace into common code. the difference between them was that sdsResize would avoid using SDS_TYPE_5, since it want to keep the string ready to be resized again, while sdsRemoveFreeSpace would permit using SDS_TYPE_5 and get an optimal memory consumption. now both methods take a `would_regrow` argument that makes it more explicit. the only actual impact of that is that in clientsCronResizeQueryBuffer we call both sdsResize and sdsRemoveFreeSpace for in different cases, and we now prevent the use of SDS_TYPE_5 in both. The new test that was added to cover this concern used to pass before this PR as well, this PR is just a performance optimization and cleanup. Benchmark: `redis-benchmark -c 100 -t set -d 512 -P 10 -n 100000000` on i7-9850H with jemalloc, shows improvement from 1021k ops/sec to 1067k (average of 3 runs). some 4.5% improvement. Co-authored-by:
Oran Agra <oran@redislabs.com> (cherry picked from commit 46393f98) (cherry picked from commit b12eeccddd9318a5d97a5aee2dad88999dfad53f)
-
- 21 Jul, 2021 1 commit
-
-
Oran Agra authored
- Introduce a new sdssubstr api as a building block for sdsrange. The API of sdsrange is many times hard to work with and also has corner case that cause bugs. sdsrange is easy to work with and also simplifies the implementation of sdsrange. - Revert the fix to RM_StringTruncate and just use sdssubstr instead of sdsrange. - Solve valgrind warnings from the new tests introduced by the previous PR. (cherry picked from commit ae418eca)
-
- 10 Mar, 2021 1 commit
-
-
sundb authored
1. Add `redis-server test all` support to run all tests. 2. Add redis test to daily ci. 3. Add `--accurate` option to run slow tests for more iterations (so that by default we run less cycles (shorter time, and less prints). 4. Move dict benchmark to REDIS_TEST. 5. fix some leaks in tests 6. make quicklist tests run on a specific fill set of options rather than huge ranges 7. move some prints in quicklist test outside their loops to reduce prints 8. removing sds.h from dict.c since it is now used in both redis-server and redis-cli (uses hiredis sds)
-
- 28 Jan, 2021 1 commit
-
-
Yossi Gottlieb authored
Make it possible to customize the process title, i.e. include custom strings, immutable configuration like port, tls-port, unix socket name, etc.
-
- 06 Dec, 2020 1 commit
-
-
Oran Agra authored
When RDB input attempts to make a huge memory allocation that fails, RESTORE should fail gracefully rather than die with panic
-
- 21 Dec, 2019 1 commit
-
-
Khem Raj authored
This helps in avoiding multiple definition of this variable, its also defined globally in sds.c Signed-off-by:
Khem Raj <raj.khem@gmail.com>
-
- 29 Dec, 2017 1 commit
-
-
Oran Agra authored
- protocol parsing (processMultibulkBuffer) was limitted to 32big positions in the buffer readQueryFromClient potential overflow - rioWriteBulkCount used int, although rioWriteBulkString gave it size_t - several places in sds.c that used int for string length or index. - bugfix in RM_SaveAuxField (return was 1 or -1 and not length) - RM_SaveStringBuffer was limitted to 32bit length
-
- 23 Feb, 2017 1 commit
-
-
oranagra authored
this commit also contains small bugfix in rdbLoadLzfStringObject a bug that currently has no implications.
-
- 17 Nov, 2015 1 commit
-
-
antirez authored
Redis-cli handles the debugger "eval" command in a special way since sdssplitargs() would not be ok: we need to send the Redis debugger the whole Lua script without any parsing. However in order to later free the argument vector inside redis-cli using just sdsfreesplitres(), we need to allocate the array of SDS pointers using the same allocator SDS is using, that may differ to what Redis is using. So now a newer version of SDS exports sds_malloc() and other allocator functions to give access, to the program it is linked to, the allocator used internally by SDS.
-
- 25 Jul, 2015 4 commits
- 15 Jul, 2015 1 commit
-
-
antirez authored
This is an attempt to use the refcount feature of the sds.c fork provided in the Pull Request #2509. A new type, SDS_TYPE_5 is introduced having a one byte header with just the string length, without information about the available additional length at the end of the string (this means that sdsMakeRoomFor() will be required each time we want to append something, since the string will always report to have 0 bytes available). More work needed in order to avoid common SDS functions will pay the cost of this type. For example both sdscatprintf() and sdscatfmt() should try to upgrade to SDS_TYPE_8 ASAP when appending chars.
-
- 14 Jul, 2015 1 commit
-
-
Oran Agra authored
-
- 08 Jan, 2015 1 commit
-
-
antirez authored
-
- 02 Jan, 2015 1 commit
-
-
Matt Stancliff authored
Use the existing memory space for an SDS to convert it to a regular character buffer so we don't need to allocate duplicate space just to extract a usable buffer for native operations.
-
- 23 Dec, 2014 1 commit
-
-
Matt Stancliff authored
Previously, many files had individual main() functions for testing, but each required being compiled with their own testing flags. That gets difficult when you have 8 different flags you need to set just to run all tests (plus, some test files required other files to be compiled aaginst them, and it seems some didn't build at all without including the rest of Redis). Now all individual test main() funcions are renamed to a test function for the file itself and one global REDIS_TEST define enables testing across the entire codebase. Tests can now be run with: - `./redis-server test <test>` e.g. ./redis-server test ziplist If REDIS_TEST is not defined, then no tests get included and no tests are included in the final redis-server binary.
-
- 11 Dec, 2014 2 commits
-
-
antirez authored
Specialized single-use function. Not the best match for sds.c btw. Also genClientPeerId() is no longer static: we need symbols.
-
Matt Stancliff authored
This stops us from needing to manually check against ":" to add brackets around IPv6 addresses everywhere.
-
- 13 Aug, 2014 1 commit
-
-
antirez authored
This raises the max string to 4GB without any downside.
-
- 28 Apr, 2014 1 commit
-
-
antirez authored
-
- 12 Aug, 2013 1 commit
-
-
antirez authored
-
- 24 Jul, 2013 1 commit
-
-
antirez authored
Actaully the string is modified in-place and a reallocation is never needed, so there is no need to return the new sds string pointer as return value of the function, that is now just "void".
-
- 04 Jul, 2013 1 commit
-
-
antirez authored
-
- 06 Mar, 2013 1 commit
-
-
antirez authored
-
- 30 Mar, 2012 1 commit
-
-
Erik Dubbelboer authored
-
- 14 Mar, 2012 1 commit
-
-
antirez authored
-
- 16 Jan, 2012 1 commit
-
-
antirez authored
-
- 21 Nov, 2011 1 commit
-
-
antirez authored
-
- 02 Nov, 2011 1 commit
-
-
antirez authored
sdsMakeRoomFor() exposed as public API. sdsIncrLen() added. Both the changes make it possible to copy stuff from a system call to an sds buffer without the need of an additional buffer and copying overhead.
-
- 13 Sep, 2011 1 commit
-
-
Pieter Noordhuis authored
-
- 25 May, 2011 1 commit
-
-
antirez authored
Make sure error and status replies emitted by Lua scripts can never have more than a newline, otherwise it is a protocol violation and clients will desync.
-
- 05 May, 2011 1 commit
-
-
Pieter Noordhuis authored
-
- 07 Apr, 2011 1 commit
-
-
antirez authored
-
- 10 Dec, 2010 2 commits
-
-
Pieter Noordhuis authored
-
Pieter Noordhuis authored
Move logic concerned with setting a bit in an sds to the SETBIT command instead of keeping it in sds.c. The function to grow an sds can and will be reused for a command to set a range within a string value.
-
- 09 Dec, 2010 1 commit
-
-
Pieter Noordhuis authored
-
- 02 Sep, 2010 1 commit
-
-
Pieter Noordhuis authored
-
- 05 Aug, 2010 1 commit
-
-
antirez authored
-