From 2fcb0ebdb69d101561d107587522f5b9f6ce3a4f Mon Sep 17 00:00:00 2001 From: Georgy Moshkin <gmoshkin@picodata.io> Date: Mon, 12 Aug 2024 23:25:27 +0300 Subject: [PATCH] chore: document why I'm not removing redundant RemovePlugin raft op --- src/traft/node.rs | 5 ++++- src/traft/op.rs | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/traft/node.rs b/src/traft/node.rs index 0fd8813103..fb1d9ffd12 100644 --- a/src/traft/node.rs +++ b/src/traft/node.rs @@ -1303,7 +1303,10 @@ impl NodeImpl { } } - // FIXME: this should just be BatchDml + // TODO: this operation is just a set of Dml::Delete operations, + // however doing this via CaS would be nightmare. It would be much + // simpler if we supported FOREIGN KEY/ON DELETE CASCADE + // semantics, but we don't... Op::Plugin(PluginRaftOp::RemovePlugin { ident }) => { let maybe_plugin = self .storage diff --git a/src/traft/op.rs b/src/traft/op.rs index 3cb317cef2..93ff29bf58 100644 --- a/src/traft/op.rs +++ b/src/traft/op.rs @@ -816,7 +816,12 @@ pub enum PluginRaftOp { }, /// Disable selected plugin. DisablePlugin { ident: PluginIdentifier }, - /// Remove selected plugin. + /// Remove records for the given plugin and records in other tables which + /// indirectly depend on it (foreign keys). + /// + /// Note that in an ideal world this Op can be replaced with a BatchDml, but + /// in practice the code would be a nightmare to write and maintain. + /// It would be much easier if we supported FOREIGN KEY/ON DELETE CASCADE. RemovePlugin { ident: PluginIdentifier }, } -- GitLab