]> git.proxmox.com Git - pmg-api.git/blobdiff - src/PMG/DBTools.pm
fix #5189: cluster: avoid sync errors for statistics and quarantine
[pmg-api.git] / src / PMG / DBTools.pm
index 6112566b414f6d03c90c8889af95bd5d70ac987b..8770d06554e1c9e90b5f6fa7f0ddc590d4efe687 100644 (file)
@@ -1132,6 +1132,14 @@ sub update_master_clusterinfo {
        $dbh->do ("INSERT INTO ClusterInfo (cid, name, ivalue) select $clientcid, 'lastmt_$table', " .
                  "EXTRACT(EPOCH FROM now())::INTEGER");
     }
+
+    my @lastid_tables = ('CStatistic', 'CMailStore');
+
+    for my $table (@lastid_tables) {
+        $dbh->do("INSERT INTO ClusterInfo (cid, name, ivalue) " .
+           "SELECT $clientcid, 'lastid_$table', COALESCE (max (rid), -1) FROM $table " .
+           "WHERE cid = $clientcid");
+    }
 }
 
 sub update_client_clusterinfo {