dragonflydb / dragonfly

A modern replacement for Redis and Memcached
https://www.dragonflydb.io/
Other
25.96k stars 954 forks source link

fix: enforce load limits when loading snapshot #4136

Closed romange closed 2 days ago

romange commented 6 days ago

Prevent loading snapshots with used memory higher than max memory limit.

  1. Store the used memory metadata only inside the summary file
  2. Load the summary file before loading anything else, and if the used-memory is higher, abort the load.
adiholden commented 4 days ago

What about dfly load append command? you will not flush the database before you load the snapshot file. If we want to enforce this we need to check current_used_memory + snapshot used memory < max_memory_limit

romange commented 4 days ago

This command is not interesting as is only used for migrations which are ad hoc at this point.