valkey-io / valkey

A flexible distributed key-value datastore that supports both caching and beyond caching workloads.
https://valkey.io
Other
16.36k stars 611 forks source link

[BUG] Lua libs and functions aren't replicated on a cluster #1005

Open Yury-Fridlyand opened 3 weeks ago

Yury-Fridlyand commented 3 weeks ago

Describe the bug

Lua libs and functions aren't replicated on 8-rc{1,2}

To reproduce

  1. Start cluster
  2. Load a function to a primary node
  3. Go to the corresponding replica

Expected behavior

Replica should have same libraries/functions

Additional information

Reproduced on 8-rc1 and 8-rc2

$ redis-cli -p 7000

127.0.0.1:7000> info server
# Server
redis_version:7.2.4
server_name:valkey
valkey_version:7.9.240
redis_git_sha1:85a58478
redis_git_dirty:0
redis_build_id:7b4de39a69b62106
server_mode:cluster
os:Linux 5.15.153.1-microsoft-standard-WSL2 x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
gcc_version:11.4.0
process_id:88075
process_supervised:no
run_id:028cdb4df3c159de43c15ec136a07099cd06eaba
tcp_port:7000
server_time_usec:1725910954615302
uptime_in_seconds:20
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:14634922
executable:/mnt/c/GitHub/cluster-test/redis-server
config_file:/mnt/c/GitHub/cluster-test/7000/redis.conf
io_threads_active:0
availability_zone:
listener0:name=tcp,bind=*,bind=-::*,port=7000

127.0.0.1:7000> info replication
# Replication
role:master
connected_slaves:1
slave0:ip=127.0.0.1,port=7004,state=wait_bgsave,offset=0,lag=0,type=replica
replicas_waiting_psync:0
master_failover_state:no-failover
master_replid:f1bfd55cd8e8f559106f106b0abb8c69c7b73bf5
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:19251
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:10485760
repl_backlog_first_byte_offset:1
repl_backlog_histlen:19251

127.0.0.1:7000> function list
1) 1) "library_name"
   2) "fcall_readonly_function"
   3) "engine"
   4) "LUA"
   5) "functions"
   6) 1) 1) "name"
         2) "fcall_readonly_function"
         3) "description"
         4) (nil)
         5) "flags"
         6) (empty array)

127.0.0.1:7000> fcall fcall_readonly_function 0
(integer) 42

$ redis-cli -p 7004
127.0.0.1:7004> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:7000
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:0
slave_read_repl_offset:1
slave_repl_offset:1
replicas_repl_buffer_size:0
replicas_repl_buffer_peak:0
master_link_down_since_seconds:-1
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
replicas_waiting_psync:0
master_failover_state:no-failover
master_replid:1c35917c1910642bb7c56d58cc0729b0f3885a7c
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:10485760
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

127.0.0.1:7004> function list
(empty array)

127.0.0.1:7004> fcall fcall_readonly_function 0
(error) ERR Function not found
madolson commented 3 weeks ago

The replica is not in sync with the primary. You can see from the error message:

role:slave
master_host:127.0.0.1
master_port:7000
master_link_status:**down**
master_last_io_seconds_ago:-1

and

slave0:ip=127.0.0.1,port=7004,state=**wait_bgsave**,offset=0,lag=0,type=replica

You should wait for master_link_status:online.

Yury-Fridlyand commented 3 weeks ago

Strange, I have the same picture on version 7, but everything works... Keep testing.

madolson commented 4 days ago

@Yury-Fridlyand Any update or can we close this?