1
0
Fork 0

fixed log output

This commit is contained in:
jsteemann 2016-03-14 18:05:20 +01:00
parent 9cb9dfd8af
commit 2ade0ef3d0
6 changed files with 41 additions and 28 deletions

View File

@ -134,6 +134,20 @@ BOOST_AUTO_TEST_CASE (tst_col_header_marker) {
BOOST_CHECK_EQUAL(24, (int) offsetOf(&TRI_col_header_marker_t::_type));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test sizeof TRI_df_prologue_marker_t
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (tst_df_prologue_marker) {
size_t s = sizeof(TRI_df_prologue_marker_t);
BOOST_CHECK_EQUAL(16 + 16, (int) s);
BOOST_CHECK_EQUAL(true, s % 8 == 0);
BOOST_CHECK_EQUAL(16, (int) offsetOf(&TRI_df_prologue_marker_t::_databaseId));
BOOST_CHECK_EQUAL(24, (int) offsetOf(&TRI_df_prologue_marker_t::_collectionId));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief generate tests
////////////////////////////////////////////////////////////////////////////////

View File

@ -205,7 +205,7 @@ void TRI_collection_t::iterateIndexes(std::function<bool(std::string const&, voi
if (!ok) {
LOG(ERR) << "cannot load index '" << filename << "' for collection '"
<< _info.namec_str() << "'";
<< _info.name() << "'";
}
}
}
@ -745,7 +745,7 @@ TRI_collection_t* TRI_CreateCollection(
parameters.maximalSize()) {
TRI_set_errno(TRI_ERROR_ARANGO_DATAFILE_FULL);
LOG(ERR) << "cannot create datafile '" << parameters.namec_str() << "' in '"
LOG(ERR) << "cannot create datafile '" << parameters.name() << "' in '"
<< path << "', maximal size '"
<< (unsigned int)parameters.maximalSize() << "' is too small";
@ -768,7 +768,7 @@ TRI_collection_t* TRI_CreateCollection(
if (TRI_ExistsFile(dirname.c_str())) {
TRI_set_errno(TRI_ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS);
LOG(ERR) << "cannot create collection '" << parameters.namec_str()
LOG(ERR) << "cannot create collection '" << parameters.name()
<< "' in directory '" << dirname
<< "': directory already exists";
@ -786,7 +786,7 @@ TRI_collection_t* TRI_CreateCollection(
int res = TRI_CreateDirectory(tmpname.c_str(), systemError, errorMessage);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "cannot create collection '" << parameters.namec_str()
LOG(ERR) << "cannot create collection '" << parameters.name()
<< "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage;
@ -803,7 +803,7 @@ TRI_collection_t* TRI_CreateCollection(
TRI_IF_FAILURE("CreateCollection::tempFile") { return nullptr; }
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "cannot create collection '" << parameters.namec_str()
LOG(ERR) << "cannot create collection '" << parameters.name()
<< "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage;
TRI_RemoveDirectory(tmpname.c_str());
@ -816,7 +816,7 @@ TRI_collection_t* TRI_CreateCollection(
res = TRI_RenameFile(tmpname.c_str(), dirname.c_str());
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "cannot create collection '" << parameters.namec_str()
LOG(ERR) << "cannot create collection '" << parameters.name()
<< "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage;
TRI_RemoveDirectory(tmpname.c_str());
@ -1143,7 +1143,7 @@ VocbaseCollectionInfo VocbaseCollectionInfo::fromFile(
if (info.name()[0] != '\0') {
// only warn if the collection version is older than expected, and if it's
// not a shape collection
LOG(WARN) << "collection '" << info.namec_str()
LOG(WARN) << "collection '" << info.name()
<< "' has an old version and needs to be upgraded.";
}
}

View File

@ -1389,7 +1389,7 @@ int TRI_WriteElementDatafile(TRI_datafile_t* datafile, void* position,
return datafile->_lastError;
} else {
LOG(TRACE) << "msync succeeded " << position << ", size " << marker->getSize();
LOG(TRACE) << "msync succeeded " << (void*) position << ", size " << marker->getSize();
}
}

View File

@ -316,10 +316,10 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
wasBlocked = true;
if (_vocbase->_deadlockDetector.setReaderBlocked(this) == TRI_ERROR_DEADLOCK) {
// deadlock
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.name() << "'";
return TRI_ERROR_DEADLOCK;
}
LOG(TRACE) << "waiting for read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "waiting for read-lock on collection '" << _info.name() << "'";
} else if (++iterations >= 5) {
// periodically check for deadlocks
TRI_ASSERT(wasBlocked);
@ -327,7 +327,7 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
if (_vocbase->_deadlockDetector.detectDeadlock(this, false) == TRI_ERROR_DEADLOCK) {
// deadlock
_vocbase->_deadlockDetector.unsetReaderBlocked(this);
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.name() << "'";
return TRI_ERROR_DEADLOCK;
}
}
@ -350,7 +350,7 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
if (waited > timeout) {
_vocbase->_deadlockDetector.unsetReaderBlocked(this);
LOG(TRACE) << "timed out waiting for read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "timed out waiting for read-lock on collection '" << _info.name() << "'";
return TRI_ERROR_LOCK_TIMEOUT;
}
}
@ -402,10 +402,10 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
wasBlocked = true;
if (_vocbase->_deadlockDetector.setWriterBlocked(this) == TRI_ERROR_DEADLOCK) {
// deadlock
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.name() << "'";
return TRI_ERROR_DEADLOCK;
}
LOG(TRACE) << "waiting for write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "waiting for write-lock on collection '" << _info.name() << "'";
} else if (++iterations >= 5) {
// periodically check for deadlocks
TRI_ASSERT(wasBlocked);
@ -413,7 +413,7 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
if (_vocbase->_deadlockDetector.detectDeadlock(this, true) == TRI_ERROR_DEADLOCK) {
// deadlock
_vocbase->_deadlockDetector.unsetWriterBlocked(this);
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.name() << "'";
return TRI_ERROR_DEADLOCK;
}
}
@ -436,7 +436,7 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
if (waited > timeout) {
_vocbase->_deadlockDetector.unsetWriterBlocked(this);
LOG(TRACE) << "timed out waiting for write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "timed out waiting for write-lock on collection '" << _info.name() << "'";
return TRI_ERROR_LOCK_TIMEOUT;
}
}
@ -1182,7 +1182,7 @@ static int IterateMarkersCollection(arangodb::Transaction* trx,
// read all documents and fill primary index
TRI_IterateCollection(collection, OpenIterator, &openState);
LOG(TRACE) << "found " << openState._documents << " document markers, " << openState._deletions << " deletion markers for collection '" << collection->_info.namec_str() << "'";
LOG(TRACE) << "found " << openState._documents << " document markers, " << openState._deletions << " deletion markers for collection '" << collection->_info.name() << "'";
// update the real statistics for the collection
try {
@ -2288,7 +2288,7 @@ static int PathBasedIndexFromVelocyPack(
}
if (idx == nullptr) {
LOG(ERR) << "cannot create index " << iid << " in collection '" << document->_info.namec_str() << "'";
LOG(ERR) << "cannot create index " << iid << " in collection '" << document->_info.name() << "'";
return TRI_errno();
}

View File

@ -731,14 +731,14 @@ static int ScanPath(TRI_vocbase_t* vocbase, char const* path, bool isUpgrade,
// collection is too "old"
if (!isUpgrade) {
LOG(ERR) << "collection '" << info.namec_str()
LOG(ERR) << "collection '" << info.name()
<< "' has a too old version. Please start the server "
"with the --upgrade option.";
return TRI_set_errno(res);
} else {
if (info.version() < TRI_COL_VERSION_20) {
LOG(ERR) << "collection '" << info.namec_str()
LOG(ERR) << "collection '" << info.name()
<< "' is too old to be upgraded with this ArangoDB "
"version.";
res = TRI_ERROR_ARANGO_ILLEGAL_STATE;
@ -776,7 +776,7 @@ static int ScanPath(TRI_vocbase_t* vocbase, char const* path, bool isUpgrade,
TRI_UpdateTickServer(tick);
}
LOG(DEBUG) << "added document collection '" << info.namec_str()
LOG(DEBUG) << "added document collection '" << info.name()
<< "' from '" << file << "'";
}

View File

@ -738,7 +738,7 @@ int CollectorThread::processCollectionOperations(CollectorCache* cache) {
if (res != TRI_ERROR_NO_ERROR) {
// this includes TRI_ERROR_LOCK_TIMEOUT!
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "wal collector couldn't acquire write lock for collection '"
<< document->_info.id() << "': " << TRI_errno_string(res);
<< document->_info.name() << "': " << TRI_errno_string(res);
return res;
}
@ -746,7 +746,7 @@ int CollectorThread::processCollectionOperations(CollectorCache* cache) {
try {
// now we have the write lock on the collection
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "wal collector processing operations for collection '"
<< document->_info.namec_str() << "'";
<< document->_info.name() << "'";
TRI_ASSERT(!cache->operations->empty());
@ -756,7 +756,7 @@ int CollectorThread::processCollectionOperations(CollectorCache* cache) {
// finally update all datafile statistics
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "updating datafile statistics for collection '"
<< document->_info.namec_str() << "'";
<< document->_info.name() << "'";
updateDatafileStatistics(document, cache);
document->_uncollectedLogfileEntries -= cache->totalOperationsCount;
@ -775,8 +775,7 @@ int CollectorThread::processCollectionOperations(CollectorCache* cache) {
trx.finish(res);
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "wal collector processed operations for collection '"
<< document->_info.namec_str()
<< "' with status: " << TRI_errno_string(res);
<< document->_info.name() << "' with status: " << TRI_errno_string(res);
return res;
}
@ -942,7 +941,7 @@ int CollectorThread::transferMarkers(Logfile* logfile,
TRI_ASSERT(document != nullptr);
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "collector transferring markers for '"
<< document->_info.namec_str()
<< document->_info.name()
<< "', totalOperationsCount: " << totalOperationsCount;
CollectorCache* cache =
@ -1154,7 +1153,7 @@ int CollectorThread::syncDatafileCollection(
bool ok = datafile->sync(datafile, synced, written);
if (ok) {
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "msync succeeded " << synced << ", size "
LOG_TOPIC(TRACE, Logger::COLLECTOR) << "msync succeeded " << (void*) synced << ", size "
<< (written - synced);
datafile->_synced = written;
} else {