From 48230fa5bd3cae7311ed22c8213b48a893d370e7 Mon Sep 17 00:00:00 2001 From: Georgy Moshkin <gmoshkin@picodata.io> Date: Thu, 8 Aug 2024 16:08:12 +0300 Subject: [PATCH] fix: used to leave dead _pico_plugin_migration records around --- src/storage.rs | 14 ++++++-------- src/traft/node.rs | 4 ++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/storage.rs b/src/storage.rs index 376d1d54b9..61f77ee12e 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -3893,14 +3893,12 @@ impl PluginMigration { }] } - #[inline] - pub fn put( - &self, - plugin_name: &str, - migration_file: &str, - hash: md5::Digest, - ) -> tarantool::Result<()> { - self.space.replace(&(plugin_name, migration_file, hash.0))?; + pub fn delete_all_by_plugin(&self, plugin_name: &str) -> tarantool::Result<()> { + let records = self.get_files_by_plugin(plugin_name)?; + for record in records { + self.space + .delete(&(record.plugin_name, record.migration_file))?; + } Ok(()) } diff --git a/src/traft/node.rs b/src/traft/node.rs index af00be49e3..7c664df079 100644 --- a/src/traft/node.rs +++ b/src/traft/node.rs @@ -1349,6 +1349,10 @@ impl NodeImpl { .plugin .delete(&ident) .expect("storage should not fail"); + self.storage + .plugin_migration + .delete_all_by_plugin(&ident.name) + .expect("say it with me"); } } -- GitLab