CLIENT-I...T-SOURCE(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ CLIENT IMPORT-SOURCE ✨

okay bestie, welcome to the Valkey Command Manual πŸ’– this one's called CLIENT-I...T-SOURCE(3valkey) (yes the title is squished, it's giving ctrl+c ctrl+v energy, we move) and it's lowkey one of the most underrated glow-ups in the whole client family. let's get into it 🫢


🌸 NAME 🌸

client-import-source β€” mark this client as an import source when the server is in import mode. periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

CLIENT IMPORT-SOURCE <ON | OFF>

πŸ’œ DESCRIPTION πŸ’œ

so here's the situation, and it's kind of a big deal. when a client syncs data from a Redis-like server over to Valkey using some sync tool (think RedisShake and friends), Valkey is out here doing expiration and eviction like it normally does, because it's a primary β€” and that can cause data corruption. not cute. 😭

let me give you the actual example from the page, because it ate:

the client calls set key 1 ex 1 on the source server, and that command gets transferred to the destination server. then the client calls incr key on the source server before the key expired, so now there's a key on the source server with the value of 2. but when the command arrives at the destination server, the key may have already expired and been deleted. so the destination server ends up with a key with the value of 1, which is just not consistent with the source server. inconsistent data? in this economy? πŸ™ˆ

sync tools can fix this by setting the import-mode config to yes and declaring their connections as IMPORT-SOURCE.

so the CLIENT IMPORT-SOURCE command marks this client as an import source β€” but only if import-mode is enabled β€” and then it can visit expired keys. ✨

the modes available are, and I'm obsessed:

  • ON. in this mode the client can visit expired keys. go off πŸ‘‘
  • OFF. this is the default mode, in which the client works as a normal client. just a regular girlie doing regular client things πŸ’…

πŸ’– REPLY πŸ’–

valkey-protocol(7) simple string reply: OK.


⭐ COMPLEXITY ⭐

O(1) β€” constant time, she's fast, she's efficient, she's the moment.


πŸŽ€ ACL CATEGORIES πŸŽ€

@connection @slow


🌈 HISTORY 🌈

  • Available since: 8.1.0

🧚 NOTES 🧚

the server needs to be configured with import-mode yes before marking a client connection as an import source. no skipping steps bestie, the order matters fr fr.

πŸ‘‘ SEE ALSO πŸ‘‘

auth(3valkey), client(3valkey), client-caching(3valkey), client-capa(3valkey), client-getname(3valkey), client-getredir(3valkey), client-help(3valkey), client-id(3valkey), client-info(3valkey), client-kill(3valkey), client-list(3valkey), client-no-evict(3valkey), client-no-touch(3valkey), client-pause(3valkey), client-reply(3valkey), client-setinfo(3valkey), client-setname(3valkey), client-tracking(3valkey), client-trackinginfo(3valkey), client-unblock(3valkey), client-unpause(3valkey), echo(3valkey), hello(3valkey), ping(3valkey), quit(3valkey), reset(3valkey), select(3valkey)


and that's the whole page, you're welcome 🫢 this was version 9.0.0, dated 2025-10-21, straight from the Valkey Command Manual. mwah πŸ’‹ go mark some import sources, but like, responsibly. slay βœ¨πŸŒΈπŸ’–

πŸ“¦ where this page comes from