mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'mjmh' of ssh://github.com/triAGENS/ArangoDB into mjmh
This commit is contained in:
commit
ea837012f0
|
@ -210,18 +210,11 @@ static void UnlinkHeader (TRI_headers_t* h,
|
|||
if (headers->_nrLinked == 0) {
|
||||
TRI_ASSERT(headers->_begin == nullptr);
|
||||
TRI_ASSERT(headers->_end == nullptr);
|
||||
|
||||
if (headers->_totalSize != 0) {
|
||||
std::cout << "NONO HEADERS 1: " << headers->_totalSize << "\n";
|
||||
}
|
||||
TRI_ASSERT(headers->_totalSize == 0);
|
||||
}
|
||||
else {
|
||||
TRI_ASSERT(headers->_begin != nullptr);
|
||||
TRI_ASSERT(headers->_end != nullptr);
|
||||
if (headers->_totalSize <= 0) {
|
||||
std::cout << "NONO HEADERS 2: " << headers->_totalSize << "\n";
|
||||
}
|
||||
TRI_ASSERT(headers->_totalSize > 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -858,7 +858,7 @@ int TRI_AddOperationTransaction (triagens::wal::DocumentOperation& operation,
|
|||
trx->_waitForSync = true;
|
||||
}
|
||||
|
||||
triagens::wal::SlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(operation.marker->mem(), operation.marker->size(), waitForSync);
|
||||
triagens::wal::StandaloneSlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(operation.marker->mem(), operation.marker->size(), waitForSync);
|
||||
|
||||
if (slotInfo.errorCode != TRI_ERROR_NO_ERROR) {
|
||||
// some error occurred
|
||||
|
@ -873,7 +873,9 @@ int TRI_AddOperationTransaction (triagens::wal::DocumentOperation& operation,
|
|||
}
|
||||
|
||||
// set header file id
|
||||
operation.header->_fid = slotInfo.slot->logfileId();
|
||||
operation.header->_fid = slotInfo.logfileId;
|
||||
|
||||
TRI_ASSERT(operation.header->_fid > 0);
|
||||
|
||||
TRI_document_collection_t* document = trxCollection->_collection->_collection;
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
|||
}
|
||||
|
||||
// write marker into wal
|
||||
triagens::wal::SlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(marker.mem(), marker.size(), false);
|
||||
triagens::wal::StandaloneSlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(marker.mem(), marker.size(), false);
|
||||
|
||||
if (slotInfo.errorCode != TRI_ERROR_NO_ERROR) {
|
||||
LOG_WARNING("could not save attribute marker in log");
|
||||
|
@ -341,7 +341,7 @@ static TRI_shape_t const* FindShape (TRI_shaper_t* shaper,
|
|||
}
|
||||
|
||||
// write marker into wal
|
||||
triagens::wal::SlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(marker.mem(), marker.size(), false);
|
||||
triagens::wal::StandaloneSlotInfo slotInfo = triagens::wal::LogfileManager::instance()->allocateAndWrite(marker.mem(), marker.size(), false);
|
||||
|
||||
if (slotInfo.errorCode != TRI_ERROR_NO_ERROR) {
|
||||
LOG_WARNING("could not save shape marker in log");
|
||||
|
|
|
@ -491,22 +491,25 @@ void LogfileManager::finalise (SlotInfo& slotInfo,
|
|||
/// this is a convenience function that combines allocate, memcpy and finalise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SlotInfo LogfileManager::allocateAndWrite (void* src,
|
||||
uint32_t size,
|
||||
bool waitForSync) {
|
||||
StandaloneSlotInfo LogfileManager::allocateAndWrite (void* src,
|
||||
uint32_t size,
|
||||
bool waitForSync) {
|
||||
|
||||
SlotInfo slotInfo = allocate(size);
|
||||
|
||||
if (slotInfo.errorCode != TRI_ERROR_NO_ERROR) {
|
||||
return slotInfo;
|
||||
return StandaloneSlotInfo(slotInfo.errorCode);
|
||||
}
|
||||
|
||||
TRI_ASSERT(slotInfo.slot != nullptr);
|
||||
|
||||
slotInfo.slot->fill(src, size);
|
||||
|
||||
// we must copy the slotinfo because finalise() will set its internal to 0 again
|
||||
StandaloneSlotInfo copy(slotInfo.slot);
|
||||
|
||||
finalise(slotInfo, waitForSync);
|
||||
return slotInfo;
|
||||
return copy;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -251,9 +251,9 @@ namespace triagens {
|
|||
/// this is a convenience function that combines allocate, memcpy and finalise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SlotInfo allocateAndWrite (void*,
|
||||
uint32_t,
|
||||
bool);
|
||||
StandaloneSlotInfo allocateAndWrite (void*,
|
||||
uint32_t,
|
||||
bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief re-inserts a logfile back into the inventory only
|
||||
|
|
|
@ -195,6 +195,7 @@ SlotInfo Slots::nextUnused (uint32_t size) {
|
|||
return SlotInfo(TRI_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
// only in this case we return a valid slot
|
||||
slot->setUsed(static_cast<void*>(mem), size, _logfile->id(), handout());
|
||||
|
||||
return SlotInfo(slot);
|
||||
|
|
|
@ -40,6 +40,34 @@ namespace triagens {
|
|||
|
||||
class LogfileManager;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- struct StandaloneSlotInfo
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct StandaloneSlotInfo {
|
||||
explicit StandaloneSlotInfo (Slot const* slot)
|
||||
: mem(slot->mem()),
|
||||
size(slot->size()),
|
||||
logfileId(slot->logfileId()),
|
||||
tick(slot->tick()),
|
||||
errorCode(TRI_ERROR_NO_ERROR) {
|
||||
}
|
||||
|
||||
explicit StandaloneSlotInfo (int errorCode)
|
||||
: mem(nullptr),
|
||||
size(0),
|
||||
logfileId(0),
|
||||
tick(0),
|
||||
errorCode(errorCode) {
|
||||
}
|
||||
|
||||
void const* mem;
|
||||
uint32_t const size;
|
||||
Logfile::IdType const logfileId;
|
||||
Slot::TickType const tick;
|
||||
int const errorCode;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- struct SlotInfo
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue