summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/zabbix_server/nodewatcher/nodesender.c30
-rw-r--r--src/zabbix_server/nodewatcher/nodewatcher.c6
-rw-r--r--src/zabbix_server/trapper/nodesync.c10
4 files changed, 33 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e4fe7de..81f013d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@ Changes for 1.5:
Changes for 1.4.2:
+ - fixed synchronisation of delete operation between nodes (Alexei)
- fixed problem with libresolv under Solaris 8 (Alexei)
- improved SMS sender (Eugene)
- improved item and trigger filtering (Eugene)
diff --git a/src/zabbix_server/nodewatcher/nodesender.c b/src/zabbix_server/nodewatcher/nodesender.c
index a9d9dbe8..ffe5bfea 100644
--- a/src/zabbix_server/nodewatcher/nodesender.c
+++ b/src/zabbix_server/nodewatcher/nodesender.c
@@ -97,7 +97,18 @@ static int send_config_data(int nodeid, int dest_nodeid, zbx_uint64_t maxlogid,
{
found = 1;
-/* zabbix_log( LOG_LEVEL_WARNING, "Fetched [%s,%s,%s]",row[0],row[1],row[2]);*/
+ zabbix_log( LOG_LEVEL_DEBUG, "Fetched [%s,%s,%s]",row[0],row[1],row[2]);
+ /* Special (simpler) processing for operation DELETE */
+ if(atoi(row[2]) == NODE_CONFIGLOG_OP_DELETE)
+ {
+ zbx_snprintf_alloc(&xml, &allocated, &offset, 16*1024, "\n%s%c%s%c%s",
+ row[0],
+ ZBX_DM_DELIMITER,
+ row[1],
+ ZBX_DM_DELIMITER,
+ row[2]);
+ continue;
+ }
for(i=0;tables[i].table!=0;i++)
{
if(strcmp(tables[i].table, row[0])==0) break;
@@ -120,7 +131,6 @@ static int send_config_data(int nodeid, int dest_nodeid, zbx_uint64_t maxlogid,
row[0],
tables[i].recid,
row[1]);
-/* zabbix_log( LOG_LEVEL_WARNING,"select %s from %s where %s=%s",fields, row[0], tables[i].recid,row[1]);*/
row2=DBfetch(result2);
@@ -161,9 +171,19 @@ static int send_config_data(int nodeid, int dest_nodeid, zbx_uint64_t maxlogid,
}
else
{
- zabbix_log( LOG_LEVEL_WARNING, "Cannot select %s from table [%s]",
- tables[i].fields[j],
- row[0]);
+ /* We assume that the record was just deleted, so we change operation to DELETE */
+ zabbix_log( LOG_LEVEL_DEBUG, "Cannot select %s from table %s where %s=%s",
+ fields,
+ row[0],
+ tables[i].recid,
+ row[1]);
+
+ zbx_snprintf_alloc(&xml, &allocated, &offset, 16*1024, "\n%s%c%s%c%d",
+ row[0],
+ ZBX_DM_DELIMITER,
+ row[1],
+ ZBX_DM_DELIMITER,
+ NODE_CONFIGLOG_OP_DELETE);
}
DBfree_result(result2);
}
diff --git a/src/zabbix_server/nodewatcher/nodewatcher.c b/src/zabbix_server/nodewatcher/nodewatcher.c
index 041cd901..6c706a9b 100644
--- a/src/zabbix_server/nodewatcher/nodewatcher.c
+++ b/src/zabbix_server/nodewatcher/nodewatcher.c
@@ -218,7 +218,7 @@ static int compare_checksums()
NODE_CKSUM_TYPE_OLD);
while((row=DBfetch(result)))
{
-/* zabbix_log( LOG_LEVEL_WARNING, "Adding record to node_configlog");*/
+ zabbix_log( LOG_LEVEL_DEBUG, "Adding record to node_configlog NODE_CONFIGLOG_OP_UPDATE");
DBexecute("insert into node_configlog (conflogid,nodeid,tablename,recordid,operation)" \
"values (" ZBX_FS_UI64 ",%s,'%s',%s,%d)",
/* DBget_nextid("node_configlog","conflogid"),*/
@@ -239,7 +239,7 @@ static int compare_checksums()
while((row=DBfetch(result)))
{
-/* zabbix_log( LOG_LEVEL_WARNING, "Adding record to node_configlog"); */
+ zabbix_log( LOG_LEVEL_DEBUG, "Adding record to node_configlog NODE_CONFIGLOG_OP_ADD");
DBexecute("insert into node_configlog (conflogid,nodeid,tablename,recordid,operation)" \
"values (" ZBX_FS_UI64 ",%s,'%s',%s,%d)",
/* DBget_nextid("node_configlog","conflogid"),*/
@@ -260,7 +260,7 @@ static int compare_checksums()
while((row=DBfetch(result)))
{
-/* zabbix_log( LOG_LEVEL_WARNING, "Adding record to node_configlog");*/
+ zabbix_log( LOG_LEVEL_DEBUG, "Adding record to node_configlog NODE_CONFIGLOG_OP_DELETE");
DBexecute("insert into node_configlog (conflogid,nodeid,tablename,recordid,operation)" \
"values (" ZBX_FS_UI64 ",%s,'%s',%s,%d)",
/* DBget_nextid("node_configlog","conflogid"),*/
diff --git a/src/zabbix_server/trapper/nodesync.c b/src/zabbix_server/trapper/nodesync.c
index 968ea37a..12a6d477 100644
--- a/src/zabbix_server/trapper/nodesync.c
+++ b/src/zabbix_server/trapper/nodesync.c
@@ -79,7 +79,7 @@ static int process_record(int nodeid, char *record)
DB_RESULT result;
DB_ROW row;
-/* zabbix_log( LOG_LEVEL_WARNING, "In process_record [%s]", record);*/
+ zabbix_log( LOG_LEVEL_DEBUG, "In process_record [%s]", record);
zbx_get_field(record,tablename,0,ZBX_DM_DELIMITER);
zbx_get_field(record,tmp,1,ZBX_DM_DELIMITER);
@@ -104,13 +104,11 @@ static int process_record(int nodeid, char *record)
}
if(op==NODE_CONFIGLOG_OP_DELETE)
{
- zbx_snprintf(tmp,sizeof(tmp),"delete from %s where %s=" ZBX_FS_UI64 " and nodeid=%d",
+ zbx_snprintf(sql,sizeof(sql),"delete from %s where %s=" ZBX_FS_UI64,
tablename,
key,
- recid,
- nodeid);
- zabbix_log( LOG_LEVEL_DEBUG, "SQL [%s]",
- sql);
+ recid);
+ DBexecute("%s", sql);
return SUCCEED;
}