mirror of
				https://github.com/Icinga/icinga2.git
				synced 2025-10-30 18:53:54 +01:00 
			
		
		
		
	DB IDO: Ensure that delete queries for comments/downtimes are matching the index
fixes #11993
This commit is contained in:
		
							parent
							
								
									f10289aa71
								
							
						
					
					
						commit
						409a385590
					
				| @ -403,19 +403,21 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen | |||||||
| { | { | ||||||
| 	Checkable::Ptr checkable = comment->GetCheckable(); | 	Checkable::Ptr checkable = comment->GetCheckable(); | ||||||
| 
 | 
 | ||||||
|  | 	unsigned long entry_time = static_cast<long>(comment->GetEntryTime()); | ||||||
|  | 
 | ||||||
| 	/* Status */ | 	/* Status */ | ||||||
| 	DbQuery query1; | 	DbQuery query1; | ||||||
| 	query1.Table = "comments"; | 	query1.Table = "comments"; | ||||||
| 	query1.Type = DbQueryDelete; | 	query1.Type = DbQueryDelete; | ||||||
| 	query1.Category = DbCatComment; | 	query1.Category = DbCatComment; | ||||||
| 	query1.WhereCriteria = new Dictionary(); | 	query1.WhereCriteria = new Dictionary(); | ||||||
| 	query1.WhereCriteria->Set("object_id", checkable); |  | ||||||
| 	query1.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId()); | 	query1.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId()); | ||||||
|  | 	query1.WhereCriteria->Set("object_id", checkable); | ||||||
|  | 	query1.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time)); | ||||||
|  | 	query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ | ||||||
| 	queries.push_back(query1); | 	queries.push_back(query1); | ||||||
| 
 | 
 | ||||||
| 	/* History - update deletion time for service/host */ | 	/* History - update deletion time for service/host */ | ||||||
| 	unsigned long entry_time = static_cast<long>(comment->GetEntryTime()); |  | ||||||
| 
 |  | ||||||
| 	double now = Utility::GetTime(); | 	double now = Utility::GetTime(); | ||||||
| 	std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now); | 	std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now); | ||||||
| 
 | 
 | ||||||
| @ -582,6 +584,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt | |||||||
| 	query1.WhereCriteria = new Dictionary(); | 	query1.WhereCriteria = new Dictionary(); | ||||||
| 	query1.WhereCriteria->Set("object_id", checkable); | 	query1.WhereCriteria->Set("object_id", checkable); | ||||||
| 	query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId()); | 	query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId()); | ||||||
|  | 	query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime())); | ||||||
| 	query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ | 	query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ | ||||||
| 	queries.push_back(query1); | 	queries.push_back(query1); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user