mirror of https://gitee.com/bigwinds/arangodb
issue #642
This commit is contained in:
parent
97e6a42620
commit
c751cc80fc
|
@ -394,8 +394,7 @@ static int TruncateAndSealDatafile (TRI_datafile_t* datafile,
|
|||
TRI_FreeString(TRI_CORE_MEM_ZONE, filename);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, oldname);
|
||||
|
||||
TRI_SealDatafile(datafile);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
return TRI_SealDatafile(datafile);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -540,7 +540,7 @@ void TRI_FillCrcKeyMarkerDatafile (TRI_datafile_t* datafile,
|
|||
int TRI_ReserveElementDatafile (TRI_datafile_t* datafile,
|
||||
TRI_voc_size_t size,
|
||||
TRI_df_marker_t** position,
|
||||
TRI_voc_size_t maximalJournalSize);
|
||||
TRI_voc_size_t maximalJournalSize) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief writes a marker to the datafile
|
||||
|
@ -551,7 +551,7 @@ int TRI_WriteElementDatafile (TRI_datafile_t* datafile,
|
|||
void* position,
|
||||
TRI_df_marker_t const* marker,
|
||||
TRI_voc_size_t markerSize,
|
||||
bool sync);
|
||||
bool sync) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checksums and writes a marker to the datafile
|
||||
|
@ -563,7 +563,7 @@ int TRI_WriteCrcElementDatafile (TRI_datafile_t* datafile,
|
|||
void* position,
|
||||
TRI_df_marker_t* marker,
|
||||
TRI_voc_size_t markerSize,
|
||||
bool sync);
|
||||
bool sync) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief iterates over a datafile
|
||||
|
@ -598,7 +598,7 @@ bool TRI_CloseDatafile (TRI_datafile_t* datafile);
|
|||
/// @brief seals a database, writes a footer, sets it to read-only
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_SealDatafile (TRI_datafile_t* datafile);
|
||||
int TRI_SealDatafile (TRI_datafile_t* datafile) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief renames a datafile
|
||||
|
|
|
@ -803,8 +803,14 @@ int TRI_StopReplicationApplier (TRI_replication_applier_t* applier,
|
|||
res = TRI_JoinThread(&applier->_thread);
|
||||
}
|
||||
else {
|
||||
// keep original error code
|
||||
TRI_JoinThread(&applier->_thread);
|
||||
// stop the thread but keep original error code
|
||||
int res2 = TRI_JoinThread(&applier->_thread);
|
||||
|
||||
if (res2 != TRI_ERROR_NO_ERROR) {
|
||||
LOG_ERROR("could not join replication applier for database '%s': %s",
|
||||
applier->_databaseName,
|
||||
TRI_errno_string(res2));
|
||||
}
|
||||
}
|
||||
|
||||
SetTerminateFlag(applier, false);
|
||||
|
|
|
@ -130,12 +130,22 @@ Thread::Thread (std::string const& name)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Thread::~Thread () {
|
||||
int res;
|
||||
|
||||
if (_running != 0) {
|
||||
LOG_WARNING("forcefully shutting down thread '%s'", _name.c_str());
|
||||
TRI_StopThread(&_thread);
|
||||
res = TRI_StopThread(&_thread);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_WARNING("unable to stop thread '%s': %s", _name.c_str(), TRI_errno_string(res));
|
||||
}
|
||||
}
|
||||
|
||||
TRI_DetachThread(&_thread);
|
||||
res = TRI_DetachThread(&_thread);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_WARNING("unable to detached thread '%s': %s", _name.c_str(), TRI_errno_string(res));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -2034,8 +2034,11 @@ bool TRI_ShutdownLogging (bool clearBuffers) {
|
|||
TRI_SignalCondition(&LogCondition);
|
||||
TRI_UnlockCondition(&LogCondition);
|
||||
|
||||
// ignore all errors here as we cannot log them anywhere...
|
||||
TRI_JoinThread(&LoggingThread);
|
||||
if (TRI_JoinThread(&LoggingThread) != TRI_ERROR_NO_ERROR) {
|
||||
// ignore all errors for now as we cannot log them anywhere...
|
||||
// TODO: find some means to signal errors on shutdown
|
||||
}
|
||||
|
||||
TRI_DestroyMutex(&LogMessageQueueLock);
|
||||
TRI_DestroyVector(&LogMessageQueue);
|
||||
TRI_DestroyCondition(&LogCondition);
|
||||
|
@ -2048,7 +2051,7 @@ bool TRI_ShutdownLogging (bool clearBuffers) {
|
|||
// cleanup prefix
|
||||
TRI_LockSpin(&OutputPrefixLock);
|
||||
|
||||
if (OutputPrefix) {
|
||||
if (OutputPrefix != NULL) {
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, OutputPrefix);
|
||||
OutputPrefix = NULL;
|
||||
}
|
||||
|
|
|
@ -736,6 +736,7 @@ typedef unsigned char bool;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define TRI_HAVE_GCC_UNUSED 1
|
||||
#define TRI_HAVE_GCC_ATTRIBUTE 1
|
||||
#define TRI_HAVE_GCC_BUILTIN 1
|
||||
#endif
|
||||
|
|
|
@ -45,14 +45,24 @@ extern "C" {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief mark a value as unused
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_HAVE_GCC_UNUSED
|
||||
#define TRI_UNUSED __attribute__ ((unused))
|
||||
#else
|
||||
#define TRI_UNUSED /* unused */
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief warn if return is unused
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_GCC_ATTRIBUTE
|
||||
#define WARN_UNUSED __attribute__ ((warn_unused_result))
|
||||
#ifdef TRI_HAVE_GCC_ATTRIBUTE
|
||||
#define TRI_WARN_UNUSED __attribute__ ((warn_unused_result))
|
||||
#else
|
||||
#define WARN_UNUSED /* unused */
|
||||
#define TRI_WARN_UNUSED /* unused */
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -62,7 +72,7 @@ extern "C" {
|
|||
/// a the value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_GCC_BUILTIN
|
||||
#ifdef TRI_HAVE_GCC_BUILTIN
|
||||
#define EF(a) __builtin_expect(a, false)
|
||||
#else
|
||||
#define EF(a) a
|
||||
|
@ -75,7 +85,7 @@ extern "C" {
|
|||
/// a the value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_GCC_BUILTIN
|
||||
#ifdef TRI_HAVE_GCC_BUILTIN
|
||||
#define ET(a) __builtin_expect(a, true)
|
||||
#else
|
||||
#define ET(a) a
|
||||
|
@ -88,7 +98,7 @@ extern "C" {
|
|||
/// a the value to prefetch
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_GCC_BUILTIN
|
||||
#ifdef TRI_HAVE_GCC_BUILTIN
|
||||
#define PR(a) __builtin_prefetch(a, 0, 0)
|
||||
#else
|
||||
#define PR(a) /* prefetch read */
|
||||
|
@ -101,7 +111,7 @@ extern "C" {
|
|||
/// a the value to prefetch
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_GCC_BUILTIN
|
||||
#ifdef TRI_HAVE_GCC_BUILTIN
|
||||
#define PW(a) __builtin_prefetch(a, 1, 0)
|
||||
#else
|
||||
#define PW(a) /* prefetch write */
|
||||
|
|
|
@ -110,19 +110,19 @@ bool TRI_StartThread (TRI_thread_t*, char const*, void (*starter)(void*), void*
|
|||
/// @brief trys to stops a thread
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_StopThread (TRI_thread_t*);
|
||||
int TRI_StopThread (TRI_thread_t*) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief detachs a thread
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DetachThread (TRI_thread_t*);
|
||||
int TRI_DetachThread (TRI_thread_t*) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief waits for a thread to finish
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_JoinThread (TRI_thread_t*);
|
||||
int TRI_JoinThread (TRI_thread_t*) TRI_WARN_UNUSED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sends a signal to the thread
|
||||
|
|
Loading…
Reference in New Issue