commit ad6b92cdb4552171dbf1d0c7a065513c6f463bb9
Author: Andris Zeila <andris.zeila@zabbix.com>
Date:   Fri Jun 20 09:22:56 2025 +0300

    Revert ".......PS. [ZBX-26426] fixed preprocessing to flush values for an item in the same order they were sent to preprocessing"
    
    This reverts commit cf55baf3db90db26b77877bc742636bd61abf22b, reversing
    changes made to e1488ac1f0a95a68fb686b3d0d48afcfb21b0374.

diff --git a/include/zbxpreproc.h b/include/zbxpreproc.h
index 18b20f9e2e6..9802de62490 100644
--- a/include/zbxpreproc.h
+++ b/include/zbxpreproc.h
@@ -53,17 +53,9 @@ typedef enum
 }
 zbx_pp_task_type_t;
 
-typedef enum
-{
-	ZBX_PP_TASK_PENDING,
-	ZBX_PP_TASK_FINISHED,
-}
-zbx_pp_task_state_t;
-
 typedef struct
 {
 	zbx_pp_task_type_t	type;
-	zbx_pp_task_state_t	state;
 	zbx_uint64_t		itemid;
 	zbx_uint64_t		hostid;
 	void			*data;
diff --git a/src/libs/zbxpreproc/pp_queue.c b/src/libs/zbxpreproc/pp_queue.c
index 08b528362fa..3bf609b3f08 100644
--- a/src/libs/zbxpreproc/pp_queue.c
+++ b/src/libs/zbxpreproc/pp_queue.c
@@ -31,13 +31,6 @@ typedef struct
 }
 zbx_pp_item_task_sequence_t;
 
-typedef struct
-{
-	zbx_uint64_t	itemid;
-	zbx_list_t	tasks;
-}
-zbx_pp_item_tasks_t;
-
 /******************************************************************************
  *                                                                            *
  * Purpose: initialize task queue                                             *
@@ -62,7 +55,6 @@ int	pp_task_queue_init(zbx_pp_queue_t *queue, char **error)
 	zbx_list_create(&queue->finished);
 
 	zbx_hashset_create(&queue->sequences, 100, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
-	zbx_hashset_create(&queue->tasks, 100, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
 
 	if (0 != (err = pthread_mutex_init(&queue->lock, NULL)))
 	{
@@ -122,7 +114,6 @@ void	pp_task_queue_destroy(zbx_pp_queue_t *queue)
 	zbx_list_destroy(&queue->finished);
 
 	zbx_hashset_destroy(&queue->sequences);
-	zbx_hashset_destroy(&queue->tasks);
 
 	queue->init_flags = PP_TASK_QUEUE_INIT_NONE;
 }
@@ -276,22 +267,6 @@ void	pp_task_queue_push(zbx_pp_queue_t *queue, zbx_pp_task_t *task)
 	zbx_pp_task_value_t	*d = (zbx_pp_task_value_t *)PP_TASK_DATA(task);
 	queue->pending_num++;
 
-	/* track input value order to have the same output order for non sequential tasks */
-	if (ZBX_PP_TASK_VALUE == task->type)
-	{
-		zbx_pp_item_tasks_t	item_tasks_local, *item_tasks;
-		int			tasks_num = queue->tasks.num_data;
-
-		item_tasks_local.itemid = task->itemid;
-		item_tasks = (zbx_pp_item_tasks_t *)zbx_hashset_insert(&queue->tasks, &item_tasks_local,
-				sizeof(item_tasks_local));
-
-		if (tasks_num != queue->tasks.num_data)
-			zbx_list_create(&item_tasks->tasks);
-
-		zbx_list_append(&item_tasks->tasks, task, NULL);
-	}
-
 	if (ITEM_TYPE_INTERNAL != d->preproc->type)
 	{
 		(void)zbx_list_append(&queue->pending, task, NULL);
@@ -369,26 +344,9 @@ zbx_pp_task_t	*pp_task_queue_pop_new(zbx_pp_queue_t *queue)
  ******************************************************************************/
 void	pp_task_queue_push_finished(zbx_pp_queue_t *queue, zbx_pp_task_t *task)
 {
-	zbx_pp_item_tasks_t	*item_tasks;
 	queue->finished_num++;
 	queue->processing_num--;
-	task->state = ZBX_PP_TASK_FINISHED;
-
-	if (NULL != (item_tasks = (zbx_pp_item_tasks_t *)zbx_hashset_search(&queue->tasks, &task->itemid)))
-	{
-		while (SUCCEED == zbx_list_peek(&item_tasks->tasks, (void **)&task))
-		{
-			if (ZBX_PP_TASK_FINISHED != task->state)
-				return;
-
-			zbx_list_pop(&item_tasks->tasks, NULL);
-			(void)zbx_list_append(&queue->finished, task, NULL);
-		}
-
-		zbx_hashset_remove_direct(&queue->tasks, item_tasks);
-	}
-	else
-		(void)zbx_list_append(&queue->finished, task, NULL);
+	(void)zbx_list_append(&queue->finished, task, NULL);
 }
 
 /******************************************************************************
diff --git a/src/libs/zbxpreproc/pp_queue.h b/src/libs/zbxpreproc/pp_queue.h
index 5b17634772d..3ebdbac8323 100644
--- a/src/libs/zbxpreproc/pp_queue.h
+++ b/src/libs/zbxpreproc/pp_queue.h
@@ -27,7 +27,6 @@ typedef struct
 	zbx_uint64_t	processing_num;
 
 	zbx_hashset_t	sequences;
-	zbx_hashset_t	tasks;
 
 	zbx_list_t	pending;
 	zbx_list_t	immediate;
diff --git a/src/libs/zbxpreproc/pp_task.c b/src/libs/zbxpreproc/pp_task.c
index 2f24587993b..201133b08e7 100644
--- a/src/libs/zbxpreproc/pp_task.c
+++ b/src/libs/zbxpreproc/pp_task.c
@@ -119,7 +119,6 @@ zbx_pp_task_t	*pp_task_value_create(zbx_uint64_t itemid, zbx_pp_item_preproc_t *
 
 	task->itemid = itemid;
 	task->type = ZBX_PP_TASK_VALUE;
-	task->state = ZBX_PP_TASK_PENDING;
 
 	if (NULL != value)
 		d->value = *value;
