mirror of
https://github.com/Icinga/icinga2.git
synced 2025-05-29 10:50:19 +02:00
Bugfix: Replicated objects weren't removed on peer instances when they were removed on the source instance.
This commit is contained in:
parent
a2f099e0d0
commit
a5046ae7bf
@ -110,6 +110,13 @@ RequestMessage ReplicationComponent::MakeObjectMessage(const DynamicObject::Ptr&
|
|||||||
params.Set("name", object->GetName());
|
params.Set("name", object->GetName());
|
||||||
params.Set("type", object->GetType());
|
params.Set("type", object->GetType());
|
||||||
|
|
||||||
|
String source = object->GetSource();
|
||||||
|
|
||||||
|
if (source.IsEmpty())
|
||||||
|
source = EndpointManager::GetInstance()->GetIdentity();
|
||||||
|
|
||||||
|
params.Set("source", source);
|
||||||
|
|
||||||
if (includeProperties)
|
if (includeProperties)
|
||||||
params.Set("update", object->BuildUpdate(sinceTx, Attribute_Replicated | Attribute_Config));
|
params.Set("update", object->BuildUpdate(sinceTx, Attribute_Replicated | Attribute_Config));
|
||||||
|
|
||||||
@ -171,6 +178,10 @@ void ReplicationComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender
|
|||||||
if (!params.Get("type", &type))
|
if (!params.Get("type", &type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
String source;
|
||||||
|
if (!params.Get("source", &source))
|
||||||
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr update;
|
Dictionary::Ptr update;
|
||||||
if (!params.Get("update", &update))
|
if (!params.Get("update", &update))
|
||||||
return;
|
return;
|
||||||
@ -182,7 +193,7 @@ void ReplicationComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender
|
|||||||
if (!object) {
|
if (!object) {
|
||||||
object = DynamicObject::Create(type, update);
|
object = DynamicObject::Create(type, update);
|
||||||
|
|
||||||
if (object->GetSource() == EndpointManager::GetInstance()->GetIdentity()) {
|
if (source == EndpointManager::GetInstance()->GetIdentity()) {
|
||||||
/* the peer sent us an object that was originally created by us -
|
/* the peer sent us an object that was originally created by us -
|
||||||
* however it was deleted locally so we have to tell the peer to destroy
|
* however it was deleted locally so we have to tell the peer to destroy
|
||||||
* its copy of the object. */
|
* its copy of the object. */
|
||||||
@ -192,9 +203,9 @@ void ReplicationComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object->GetSource().IsEmpty())
|
Logger::Write(LogInformation, "replication", "Received object from source: " + source);
|
||||||
object->SetSource(sender->GetName());
|
|
||||||
|
|
||||||
|
object->SetSource(source);
|
||||||
object->Register();
|
object->Register();
|
||||||
} else {
|
} else {
|
||||||
if (object->IsLocal())
|
if (object->IsLocal())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user