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)); 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 /// @brief generate tests
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -205,7 +205,7 @@ void TRI_collection_t::iterateIndexes(std::function<bool(std::string const&, voi
if (!ok) { if (!ok) {
LOG(ERR) << "cannot load index '" << filename << "' for collection '" LOG(ERR) << "cannot load index '" << filename << "' for collection '"
<< _info.namec_str() << "'"; << _info.name() << "'";
} }
} }
} }
@ -745,7 +745,7 @@ TRI_collection_t* TRI_CreateCollection(
parameters.maximalSize()) { parameters.maximalSize()) {
TRI_set_errno(TRI_ERROR_ARANGO_DATAFILE_FULL); 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 '" << path << "', maximal size '"
<< (unsigned int)parameters.maximalSize() << "' is too small"; << (unsigned int)parameters.maximalSize() << "' is too small";
@ -768,7 +768,7 @@ TRI_collection_t* TRI_CreateCollection(
if (TRI_ExistsFile(dirname.c_str())) { if (TRI_ExistsFile(dirname.c_str())) {
TRI_set_errno(TRI_ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS); 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 << "' in directory '" << dirname
<< "': directory already exists"; << "': directory already exists";
@ -786,7 +786,7 @@ TRI_collection_t* TRI_CreateCollection(
int res = TRI_CreateDirectory(tmpname.c_str(), systemError, errorMessage); int res = TRI_CreateDirectory(tmpname.c_str(), systemError, errorMessage);
if (res != TRI_ERROR_NO_ERROR) { 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) << "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage; << " - " << systemError << " - " << errorMessage;
@ -803,7 +803,7 @@ TRI_collection_t* TRI_CreateCollection(
TRI_IF_FAILURE("CreateCollection::tempFile") { return nullptr; } TRI_IF_FAILURE("CreateCollection::tempFile") { return nullptr; }
if (res != TRI_ERROR_NO_ERROR) { 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) << "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage; << " - " << systemError << " - " << errorMessage;
TRI_RemoveDirectory(tmpname.c_str()); TRI_RemoveDirectory(tmpname.c_str());
@ -816,7 +816,7 @@ TRI_collection_t* TRI_CreateCollection(
res = TRI_RenameFile(tmpname.c_str(), dirname.c_str()); res = TRI_RenameFile(tmpname.c_str(), dirname.c_str());
if (res != TRI_ERROR_NO_ERROR) { 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) << "' in directory '" << path << "': " << TRI_errno_string(res)
<< " - " << systemError << " - " << errorMessage; << " - " << systemError << " - " << errorMessage;
TRI_RemoveDirectory(tmpname.c_str()); TRI_RemoveDirectory(tmpname.c_str());
@ -1143,7 +1143,7 @@ VocbaseCollectionInfo VocbaseCollectionInfo::fromFile(
if (info.name()[0] != '\0') { if (info.name()[0] != '\0') {
// only warn if the collection version is older than expected, and if it's // only warn if the collection version is older than expected, and if it's
// not a shape collection // not a shape collection
LOG(WARN) << "collection '" << info.namec_str() LOG(WARN) << "collection '" << info.name()
<< "' has an old version and needs to be upgraded."; << "' 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; return datafile->_lastError;
} else { } 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; wasBlocked = true;
if (_vocbase->_deadlockDetector.setReaderBlocked(this) == TRI_ERROR_DEADLOCK) { if (_vocbase->_deadlockDetector.setReaderBlocked(this) == TRI_ERROR_DEADLOCK) {
// 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; 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) { } else if (++iterations >= 5) {
// periodically check for deadlocks // periodically check for deadlocks
TRI_ASSERT(wasBlocked); 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) { if (_vocbase->_deadlockDetector.detectDeadlock(this, false) == TRI_ERROR_DEADLOCK) {
// deadlock // deadlock
_vocbase->_deadlockDetector.unsetReaderBlocked(this); _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; return TRI_ERROR_DEADLOCK;
} }
} }
@ -350,7 +350,7 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
if (waited > timeout) { if (waited > timeout) {
_vocbase->_deadlockDetector.unsetReaderBlocked(this); _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; return TRI_ERROR_LOCK_TIMEOUT;
} }
} }
@ -402,10 +402,10 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
wasBlocked = true; wasBlocked = true;
if (_vocbase->_deadlockDetector.setWriterBlocked(this) == TRI_ERROR_DEADLOCK) { if (_vocbase->_deadlockDetector.setWriterBlocked(this) == TRI_ERROR_DEADLOCK) {
// 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; 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) { } else if (++iterations >= 5) {
// periodically check for deadlocks // periodically check for deadlocks
TRI_ASSERT(wasBlocked); 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) { if (_vocbase->_deadlockDetector.detectDeadlock(this, true) == TRI_ERROR_DEADLOCK) {
// deadlock // deadlock
_vocbase->_deadlockDetector.unsetWriterBlocked(this); _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; return TRI_ERROR_DEADLOCK;
} }
} }
@ -436,7 +436,7 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
if (waited > timeout) { if (waited > timeout) {
_vocbase->_deadlockDetector.unsetWriterBlocked(this); _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; return TRI_ERROR_LOCK_TIMEOUT;
} }
} }
@ -1182,7 +1182,7 @@ static int IterateMarkersCollection(arangodb::Transaction* trx,
// read all documents and fill primary index // read all documents and fill primary index
TRI_IterateCollection(collection, OpenIterator, &openState); 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 // update the real statistics for the collection
try { try {
@ -2288,7 +2288,7 @@ static int PathBasedIndexFromVelocyPack(
} }
if (idx == nullptr) { 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(); 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" // collection is too "old"
if (!isUpgrade) { if (!isUpgrade) {
LOG(ERR) << "collection '" << info.namec_str() LOG(ERR) << "collection '" << info.name()
<< "' has a too old version. Please start the server " << "' has a too old version. Please start the server "
"with the --upgrade option."; "with the --upgrade option.";
return TRI_set_errno(res); return TRI_set_errno(res);
} else { } else {
if (info.version() < TRI_COL_VERSION_20) { 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 " << "' is too old to be upgraded with this ArangoDB "
"version."; "version.";
res = TRI_ERROR_ARANGO_ILLEGAL_STATE; 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); TRI_UpdateTickServer(tick);
} }
LOG(DEBUG) << "added document collection '" << info.namec_str() LOG(DEBUG) << "added document collection '" << info.name()
<< "' from '" << file << "'"; << "' from '" << file << "'";
} }

View File

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