Improved faukt tolerance of the server.sh process when master DB becomes inavailable during script run multiserver setup.
| | |
| | | |
| | | if($replication_error == false) { |
| | | if(is_array($data['old']) || is_array($data['new'])) { |
| | | $app->db->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']); |
| | | $this->raiseTableHook($d['dbtable'],$d['action'],$data); |
| | | } else { |
| | | $app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN); |
| | | } |
| | | //$this->raiseTableHook($d["dbtable"],$d["action"],$data); |
| | | //$app->dbmaster->query("DELETE FROM sys_datalog WHERE datalog_id = ".$d["datalog_id"]); |
| | | //$app->log("Deleting sys_datalog ID ".$d["datalog_id"],LOGLEVEL_DEBUG); |
| | | $app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']); |
| | | $app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG); |
| | | } else { |
| | |
| | | |
| | | if(!is_array($server_db_record)) die('Unable to load the server configuration from database.'); |
| | | |
| | | $conf['last_datalog_id'] = (int) $server_db_record['updated']; |
| | | //* Get the number of the last processed datalog_id, if the id of the local server |
| | | //* is > then the one of the remote system, then use the local ID as we might not have |
| | | //* reached the remote server during the last run then. |
| | | $local_server_db_record = $app->db->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']); |
| | | $conf['last_datalog_id'] = (int) max($server_db_record['updated'],$local_server_db_record['updated']); |
| | | unset($local_server_db_record); |
| | | |
| | | $conf['mirror_server_id'] = (int) $server_db_record['mirror_server_id']; |
| | | |
| | | // Load the ini_parser |