Skip to content

RedisKeyExpiredEvent is published when entity expiring was changed from positive to -1, resulting in dropping meta information (indexes etc) #1955

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

Closed
muchnik opened this issue Feb 1, 2021 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@muchnik
Copy link
Contributor

muchnik commented Feb 1, 2021

Hi,
I'am using spring boot data redis 2.2.4Release with lettuce 5.2.1 and faced some strange behaviour.
When im persisting some expiring entities (changing ttl from positive to -1), there is still (after :phantom expiring hits) meta information deleting, dropping indexes and so on.

Reproduction

  1. Save an entity with any field @Indexed and @TimeToLive field > 0
  2. Spring data creates :phantom entity with TTL(base ttl + some seconds), :idx and some SET meta entries (for indexing)
  3. Get our entity, change @TimeToLive field to -1 (no expiry), save via repository interface method
  4. :phantom copy expiry TTL is not changed, and still counting down
  5. After :phantom expire hits, spring expiry event published, :idx and meta set is deleted from space

Expected behaviour:
When entity updated with @TimeToLive field changed from expiry (>0) to no_expire (-1) - :phantom entity is removed or event incoming from :phantom expire not doing anything

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 1, 2021
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 1, 2021
@muchnik
Copy link
Contributor Author

muchnik commented Feb 8, 2021

Added pull request #1961

@christophstrobl christophstrobl self-assigned this Feb 10, 2021
christophstrobl pushed a commit that referenced this issue Feb 16, 2021
This commit makes sure to clean up resources when a previously expiring entity is persisted by setting the time to live to zero or negative.
In case a phantom copy exists for the changed entity, it is removed to free space on the server and prevent expiration events from being sent.

See #1955
Original Pull Request: #1961

# Conflicts:
#	src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java
christophstrobl pushed a commit that referenced this issue Feb 16, 2021
This commit makes sure to clean up resources when a previously expiring entity is persisted by setting the time to live to zero or negative.
In case a phantom copy exists for the changed entity, it is removed to free space on the server and prevent expiration events from being sent.

See #1955
Original Pull Request: #1961
@christophstrobl christophstrobl added this to the 2.3.7 (Neumann SR7) milestone Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment