From 0fd9d3406b7d722eb31a16cf81a9753c8a50f556 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 15 Sep 2015 17:56:34 +0200 Subject: [PATCH] Prevent object deletion on shutdown when checking !IsActive() This is fairly ugly and sets an extension for the ConfigObjectUtility delete handler to signal the OnActiveChanged handler inside the cluster configsync to send a delete event to the other nodes. refs #9927 --- lib/remote/apilistener-configsync.cpp | 2 +- lib/remote/configobjectutility.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/remote/apilistener-configsync.cpp b/lib/remote/apilistener-configsync.cpp index a0e992971..3a3fed389 100644 --- a/lib/remote/apilistener-configsync.cpp +++ b/lib/remote/apilistener-configsync.cpp @@ -53,7 +53,7 @@ void ApiListener::ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, con if (object->IsActive()) { /* Sync object config */ listener->UpdateConfigObject(object, cookie); - } else { + } else if (!object->IsActive() && object->GetExtension("ConfigObjectDeleted")) { /* Delete object */ listener->DeleteConfigObject(object, cookie); } diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index e59868a74..77106cc8d 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -154,6 +154,9 @@ bool ConfigObjectUtility::DeleteObjectHelper(const ConfigObject::Ptr& object, bo ConfigItem::Ptr item = ConfigItem::GetByTypeAndName(type->GetName(), object->GetName()); try { + /* mark this object for cluster delete event */ + object->SetExtension("ConfigObjectDeleted", true); + /* triggers signal for DB IDO and other interfaces */ object->Deactivate(); if (item) -- 2.40.0