Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport Redis 7.4 features to the 5.0 branch #3312

Merged
merged 37 commits into from
Jul 11, 2024

Conversation

gerzse
Copy link
Contributor

@gerzse gerzse commented Jul 11, 2024

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

The goal is to bring everything except client side caching from master to the 5.0 branch, so we can release a non-beta version from there.

jakob-keller and others added 30 commits July 10, 2024 11:22
redis#3001)

* Update repr of important classes with module name and recommended "< ... >" syntax.

* update tests which examine repr

* formatting
…bled flag (redis#3158)

* change if the cluster-mode is enabled by trying run CLUSTER SLOT insted of INFO

* fix typo

* fixing cluster mode is not enabled on this node tests

* remove changes on asyncio

* rename mock flag to be more consistent

* optimizing async cluster creation using CLUSTER SLOT command instead of INFO command

* fixing test. Before INFO and CLUSTER_SLOT was used for performing the connection, now only the CLUSTER_SLOT, so the total commands is minus 1

* remove dot at the end of string

* remove unecessary print from test

* fix lint problems

---------

Co-authored-by: Willian Moreira <[email protected]>
clarified wording + one case of deprecated .close() changed to .aclose()
Issue redis#3154

The CLIENT KILL command has a new option, called MAXAGE, to kill
clients older than a given age. Add support for this new option.

Co-authored-by: Gabriel Erzse <[email protected]>
* Support NOVALUES parameter for HSCAN

Issue redis#3153

The NOVALUES parameter instructs HSCAN to only return the hash keys,
without values.

Co-authored-by: Gabriel Erzse <[email protected]>
The CNs in the test certificates (CA, server and client) were all the
same, which is not right. Make them different.

Cleanup the Jupyter notebook that documents how SSL connections work.
Make the code blocks actually run, by using the test certificates from
devenv. Simplify a bit the OCSP examples, since they can't run anyway,
due to lack of OCSP in our test infrastructure, so they are rather informative.

Co-authored-by: Gabriel Erzse <[email protected]>
XREAD now supports reading the last message in the stream, with the +
special Id. The code already supports this, so just add some
documentation to an existing Jupyter notebook.

Fixes redis#3155

Co-authored-by: Gabriel Erzse <[email protected]>
Adopt the Google docstrings style as the preferred way to document code.
Update one of the existing docstrings to the new format, to showcase how
it would look like.

Enable the `napoleon` preprocessor in Sphinx, to be able to process
Google style docstrings.

Take the opportunity to make the copyright year dynamic, so we don't
have to manually keep it up to date.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
Pyright treats explicit and implicit `Any` differently, with implicit `Any` being treated as `Unknown`. Pyright raised a warning indicating an unknown member type for 'Awaitable' when used in 'ResponseT'. Using the `incr` method as an example, the warning is:

```
"warning: Type of 'incr' is partially unknown
 Type of 'incr' is '(name: bytes | str | memoryview, amount: int = 1) -> (Awaitable[Unknown] | Any)' (reportUnknownMemberType)"
```

By explicitly specifying 'Awaitable[Any]' in the union for 'ResponseT', this resolves the ambiguity about the member type.
Use the new logo, and use the SVG version of the logo in all places,
including the README.

Replace most of the redis.com URLs with their new redis.io counterparts.

Co-authored-by: Gabriel Erzse <[email protected]>
The address_remap callback received a tuple with the host and the port.
Make this clear in the typing hints.
Make the parsing of memory stats response more robust, to not break on
changes that will be added to the Redis server.

Also make a test related to client kill by maxage more resilient.

Co-authored-by: Gabriel Erzse <[email protected]>
Adapt the tests to use the standard Redis docker image where possible,
instead of using the Redis Stack image in all places. This way we can
run the CI against different versions of Redis and Redis Stack.

Run the test cluster based on the default Redis docker image, i.e.
without Stack support. This is needed in order to make the CI pass until
Stack gets a new release. What is needed is to mark all Stack related
tests accordingly, and then they don't get executed in the cluster
tests (they are already filtered out in `invoke cluster-tests`).

Take the opportunity to remove some empty tests and to fix the naming in
two tests.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
Support hash field expiration commands that become available with
Redis 7.4.

Adapt some tests to match recent server-side changes. Update tests
related to memory stats. Make CLIENT KILL test not run with cluster.
Disable tests related to Graph module. The Graph module is no longer
part of Redis Stack, so for the moment disable all related tests.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
Support timeseries insertion filters for samples that are close to each
other in time and value.

Use the documented way to disable compression, i.e. `ENCODING
UNCOMPRESSED` instead of `UNCOMPRESSED`.

Polish the documentation related to timeseries.

Align things needed around CI, to make sure all tests are actually executed.

BREAKING CHANGES:

1. Remove the `uncompressed` flag from TS.ALTER, since compression of
existing timeseries cannot be changed. This should not have been used, so
there should be no real impact.

2. For the TS.ADD command (TimeSeriesCommands.add method): the
`duplicate_policy` Python parameter that was mapping to
`ON DUPLICATE` was now rewired to map to `DUPLICATE POLICY`.
A new Python parameter called `on_duplicate` was added, that maps to
`ON DUPLICATE`. The expected impact of this change is low.
Add more tests for GEO search, to cover the query operators `within`,
`contains`, `intersects` and `disjoint`, for POINT and POLYGON, i.e. the
currently supported shapes and operators.
Add support for indexing and searching missing and empty values.

Currently there are some limitation from the server side, for example
empty values are supported only for TEXT and TAG fields.
With RediSearch dialect 5 less special characters need escaping when
searching, given that TAG fields are used. Add a test to show some
examples.
…#3260)

Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.36.0 to 0.37.0.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](rojopolis/spellcheck-github-actions@0.36.0...0.37.0)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix some some statements with missing asserts.
Bumps [actions/stale](https://github.com/actions/stale) from 3 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v3...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Make the parsing of XINFO STREAM response more resilient, by
handling the case when first and last entries are None after XTRIM.

Improve the parsing of consumers related info.
The CI tests were not running with RESP3 protocol, it was just an
illusion that they do. Fix this, and also preserve coverage and test
artifacts from those runs too.

Some issues have surfaced after the change.

The most notable issue is a bug in hiredis-py, which prevents it
from being used in cluster mode at least. Make sure cluster tests do
not run with hiredis-py. Also make sure some specific unit tests do
not run with hiredis-py.

One other issue with hiredis-py is fixed in this commit. Use a
sentinel object instance to signal lack of data in hiredis-py, instead
of piggybacking of `False`, which can also be returned by parsing
valid RESP payloads.

Some of the unit tests, mostly for modules, were failing, they are now
updated so that they pass.

Remove async parser from test fixture params. Leave the decision for
the async parser to be used in tests to be taken based on the availability
of hiredis-py, and on the protocol that is set for the tests. Otherwise
when hiredis-py is available we would also run the non-hiredis tests.
We did not push code coverage from the master branch
since a while. Try to add a Codecov token, to get back on
track.
Try to not restrict the versions of pytest dependencies, see if we can
get rid of the segmentation faults that we see pretty often in the CI.

Take the opportunity to sort the dev_requirements.txt file.
Although the Graph module was deprecated, we want to have tests running
as long as we keep the client code. Therefore re-enable the Graph tests, by
adding to the docker-compose stack an older redis-stack-server image. The
Graph tests run only with RESP2.

Tweak the CI so that it runs against the latest RC release for now. This way
we get all the features in RC release of server, so we can execute all tests,
including the ones for hash field expiration.

Some test failures brought to light issues with the RESP3 push message
invalidation handler, align a bit the code in that area.

Some more housekeeping around tests, here and there.
dependabot bot and others added 6 commits July 11, 2024 11:19
…#3301)

Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.37.0 to 0.38.0.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](rojopolis/spellcheck-github-actions@0.37.0...0.38.0)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Add missing type hints in the retry.py file and related tests.
For asyncio connection errors, include the details in the error message,
instead of only including the error code.

Co-authored-by: dmitry.kanev <[email protected]>
Co-authored-by: Gabriel Erzse <[email protected]>
Adapt the code and some of the tests to match the changes done in the
Redis 7.4 RC2 release.
Connection errors are formatted in four places, sync and async, network
socket and unix socket. Each place has some small differences compared
to the others, while they could be, and should be, formatted in an
uniform way. Factor out the logic in a helper method and call that
method in all four places. Arguably we lose some specificity, e.g. the
words "unix socket" won't be there anymore, but it is more valuable to not
have code duplication.
…version) (redis#3165)

* fix disconnects

* skip test in cluster

* add test

* save return value from handle_push_response (without it 'read_response' return the push message)

* insert return response from cache to the try block to prevent connection leak

* enable to get connection with data avaliable to read in csc mode and change can_read_destructive to not read data

* fix check if socket is empty (at_eof() can return False but this doesn't mean there's definitely more data to read)

---------

Co-authored-by: Chayim <[email protected]>
@gerzse gerzse requested a review from vladvildanov July 11, 2024 08:41
Make it possible to configure at field level how search
results are decoded.

Fixes: redis#2772, redis#2275
@gerzse gerzse force-pushed the backport-redis74-features branch from 8c79060 to 62fc873 Compare July 11, 2024 08:56
@gerzse gerzse merged commit 6a2a636 into redis:5.0 Jul 11, 2024
53 checks passed
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.