Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

SET key value KEEPTTL deletes the key when it has a TTL and the new value does not fit in place

Closed
#2,232 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@TedHartMS is already working on this.

Since Oct 10, 2026.

  • #2259 by @TedHartMS — open

Assessment

This issue has not been assessed yet.

Description

Describe the bug

SET key value KEEPTTL on a key that has an expiration replies +OK but removes the key when the new value needs more space than the existing record has. Afterwards EXISTS returns 0, TTL returns -2 and the key is no longer counted by DBSIZE.

Any client that updates a value with KEEPTTL to preserve its expiration can lose the key silently, because the reply is a success.

Steps to reproduce the bug
> SET k ab
OK
> EXPIRE k 120
1
> SET k abcdefgh KEEPTTL
OK
> EXISTS k
0
> TTL k
-2
> GET k
(nil)
> DBSIZE
0
Expected behavior

The key holds the new value and keeps its TTL. The same commands on Redis 8.6.1:

> SET k abcdefgh KEEPTTL
OK
> EXISTS k
1
> TTL k
120
> GET k
abcdefgh
Screenshots

No response

Release version
  • Garnet 2.2.1, ghcr.io/microsoft/garnet:2.2.1, default configuration, standalone
  • linux/arm64 (Linux 6.12.28)
  • redis-cli 8.6.1
IDE

No response

OS version

No response

Additional context

No response

Dominant language
C#
Stars
12.1k
Forks
716
Avg merge
2d 2h
Merged PRs (30d)
68

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/garnet

All issues in microsoft/garnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.