mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-18 06:03:39 +03:00
Added debug information to LogDB operations
This commit is contained in:
parent
5e5cd7f4c8
commit
fa9e5d947b
@ -196,13 +196,16 @@ private:
|
|||||||
void finalize_action(const ActionRequest& ar);
|
void finalize_action(const ActionRequest& ar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the nest record to replicate in a zone
|
* Get the nerxt record to replicate in a zone
|
||||||
* @param zone_id of the zone
|
* @param zone_id of the zone
|
||||||
* @param index of the next record to send
|
* @param zedp zone endpoint
|
||||||
* @param sql command to replicate
|
* @param lr log record
|
||||||
|
* @param error description if any
|
||||||
|
*
|
||||||
* @return 0 on success, -1 otherwise
|
* @return 0 on success, -1 otherwise
|
||||||
*/
|
*/
|
||||||
int get_next_record(int zone_id, std::string& zedp, LogDBRecord& lr);
|
int get_next_record(int zone_id, std::string& zedp, LogDBRecord& lr,
|
||||||
|
std::string& error);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ ReplicaThread * FedReplicaManager::thread_factory(int zone_id)
|
|||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int FedReplicaManager::get_next_record(int zone_id, std::string& zedp,
|
int FedReplicaManager::get_next_record(int zone_id, std::string& zedp,
|
||||||
LogDBRecord& lr)
|
LogDBRecord& lr, std::string& error)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
|
|
||||||
@ -303,6 +303,16 @@ int FedReplicaManager::get_next_record(int zone_id, std::string& zedp,
|
|||||||
|
|
||||||
int rc = logdb->get_log_record(zs->next, lr);
|
int rc = logdb->get_log_record(zs->next, lr);
|
||||||
|
|
||||||
|
if ( rc == -1 )
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
|
||||||
|
oss << "Failed to load federation log record " << zs->next
|
||||||
|
<< " for zone " << zs->zone_id;
|
||||||
|
|
||||||
|
error = oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -380,9 +390,8 @@ int FedReplicaManager::xmlrpc_replicate_log(int zone_id, bool& success,
|
|||||||
|
|
||||||
LogDBRecord lr;
|
LogDBRecord lr;
|
||||||
|
|
||||||
if ( get_next_record(zone_id, zedp, lr) != 0 )
|
if ( get_next_record(zone_id, zedp, lr, error) != 0 )
|
||||||
{
|
{
|
||||||
error = "Failed to load federation log record";
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,14 @@ int LogDBRecord::select_cb(void *nil, int num, char **values, char **names)
|
|||||||
|
|
||||||
if ( _sql == 0 )
|
if ( _sql == 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
|
||||||
|
oss << "Error zlib inflate for " << index << ", " << fed_index
|
||||||
|
<< ", " << zsql;
|
||||||
|
|
||||||
|
NebulaLog::log("DBM", Log::ERROR, oss);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +199,14 @@ int LogDB::get_log_record(unsigned int index, LogDBRecord& lr)
|
|||||||
|
|
||||||
if ( lr.index != index )
|
if ( lr.index != index )
|
||||||
{
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
|
||||||
|
oss << "Log record " << index << " loaded incorrectly. Record index: "
|
||||||
|
<< lr.index << " fed. index: " << lr.fed_index << " sql command: "
|
||||||
|
<< lr.sql << ". Operation return code: " << rc;
|
||||||
|
|
||||||
|
NebulaLog::log("DBM", Log::ERROR, oss);
|
||||||
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user