mirror of https://gitee.com/bigwinds/arangodb
Merge remote-tracking branch 'origin/devel' into engine-api
This commit is contained in:
commit
85e438ee00
|
@ -159,6 +159,8 @@ v3.2.alpha1 (2017-02-05)
|
|||
v3.1.16 (2017-XX-XX)
|
||||
--------------------
|
||||
|
||||
* ui - aql editor improvements + updated ace editor version (memory leak)
|
||||
|
||||
* fixed lost HTTP requests
|
||||
|
||||
* ui - fixed some event issues
|
||||
|
|
|
@ -1385,6 +1385,7 @@ int ClusterInfo::setCollectionPropertiesCoordinator(
|
|||
|
||||
VPackBuilder temp;
|
||||
temp.openObject();
|
||||
temp.add("waitForSync", VPackValue(info->waitForSync()));
|
||||
info->getPhysical()->getPropertiesVPackCoordinator(temp);
|
||||
temp.close();
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ PhysicalCollection* MMFilesCollection::clone(LogicalCollection* logical,Physical
|
|||
}
|
||||
|
||||
/// @brief process a document (or edge) marker when opening a collection
|
||||
int MMFilesCollection::OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
|
||||
int MMFilesCollection::OpenIteratorHandleDocumentMarker(MMFilesMarker const* marker,
|
||||
MMFilesDatafile* datafile,
|
||||
MMFilesCollection::OpenIteratorState* state) {
|
||||
LogicalCollection* collection = state->_collection;
|
||||
|
@ -304,7 +304,7 @@ int MMFilesCollection::OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* m
|
|||
}
|
||||
|
||||
/// @brief process a deletion marker when opening a collection
|
||||
int MMFilesCollection::OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
|
||||
int MMFilesCollection::OpenIteratorHandleDeletionMarker(MMFilesMarker const* marker,
|
||||
MMFilesDatafile* datafile,
|
||||
MMFilesCollection::OpenIteratorState* state) {
|
||||
LogicalCollection* collection = state->_collection;
|
||||
|
@ -380,10 +380,10 @@ int MMFilesCollection::OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* m
|
|||
}
|
||||
|
||||
/// @brief iterator for open
|
||||
bool MMFilesCollection::OpenIterator(TRI_df_marker_t const* marker, MMFilesCollection::OpenIteratorState* data,
|
||||
bool MMFilesCollection::OpenIterator(MMFilesMarker const* marker, MMFilesCollection::OpenIteratorState* data,
|
||||
MMFilesDatafile* datafile) {
|
||||
TRI_voc_tick_t const tick = marker->getTick();
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
int res;
|
||||
|
||||
|
@ -779,7 +779,7 @@ int MMFilesCollection::reserveJournalSpace(TRI_voc_tick_t tick,
|
|||
TRI_ASSERT(datafile != nullptr);
|
||||
|
||||
// try to reserve space in the datafile
|
||||
TRI_df_marker_t* position = nullptr;
|
||||
MMFilesMarker* position = nullptr;
|
||||
int res = datafile->reserveElement(size, &position, targetSize);
|
||||
|
||||
// found a datafile with enough space left
|
||||
|
@ -953,8 +953,8 @@ MMFilesDatafile* MMFilesCollection::createDatafile(TRI_voc_fid_t fid,
|
|||
}
|
||||
|
||||
// create a collection header, still in the temporary file
|
||||
TRI_df_marker_t* position;
|
||||
int res = datafile->reserveElement(sizeof(TRI_col_header_marker_t), &position, journalSize);
|
||||
MMFilesMarker* position;
|
||||
int res = datafile->reserveElement(sizeof(MMFilesCollectionHeaderMarker), &position, journalSize);
|
||||
|
||||
TRI_IF_FAILURE("CreateJournalDocumentCollectionReserve1") {
|
||||
res = TRI_ERROR_DEBUG;
|
||||
|
@ -972,10 +972,10 @@ MMFilesDatafile* MMFilesCollection::createDatafile(TRI_voc_fid_t fid,
|
|||
THROW_ARANGO_EXCEPTION(res);
|
||||
}
|
||||
|
||||
TRI_col_header_marker_t cm;
|
||||
MMFilesCollectionHeaderMarker cm;
|
||||
MMFilesDatafileHelper::InitMarker(
|
||||
reinterpret_cast<TRI_df_marker_t*>(&cm), TRI_DF_MARKER_COL_HEADER,
|
||||
sizeof(TRI_col_header_marker_t), static_cast<TRI_voc_tick_t>(fid));
|
||||
reinterpret_cast<MMFilesMarker*>(&cm), TRI_DF_MARKER_COL_HEADER,
|
||||
sizeof(MMFilesCollectionHeaderMarker), static_cast<TRI_voc_tick_t>(fid));
|
||||
cm._cid = _logicalCollection->cid();
|
||||
|
||||
res = datafile->writeCrcElement(position, &cm.base, false);
|
||||
|
@ -1063,7 +1063,7 @@ bool MMFilesCollection::removeDatafile(MMFilesDatafile* df) {
|
|||
}
|
||||
|
||||
/// @brief iterates over a collection
|
||||
bool MMFilesCollection::iterateDatafiles(std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const& cb) {
|
||||
bool MMFilesCollection::iterateDatafiles(std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const& cb) {
|
||||
if (!iterateDatafilesVector(_datafiles, cb) ||
|
||||
!iterateDatafilesVector(_compactors, cb) ||
|
||||
!iterateDatafilesVector(_journals, cb)) {
|
||||
|
@ -1074,7 +1074,7 @@ bool MMFilesCollection::iterateDatafiles(std::function<bool(TRI_df_marker_t cons
|
|||
|
||||
/// @brief iterate over all datafiles in a vector
|
||||
bool MMFilesCollection::iterateDatafilesVector(std::vector<MMFilesDatafile*> const& files,
|
||||
std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const& cb) {
|
||||
std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const& cb) {
|
||||
for (auto const& datafile : files) {
|
||||
datafile->sequentialAccess();
|
||||
datafile->willNeed();
|
||||
|
@ -1273,7 +1273,7 @@ std::vector<MMFilesCollection::DatafileDescription> MMFilesCollection::datafiles
|
|||
}
|
||||
|
||||
bool MMFilesCollection::applyForTickRange(TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMax,
|
||||
std::function<bool(TRI_voc_tick_t foundTick, TRI_df_marker_t const* marker)> const& callback) {
|
||||
std::function<bool(TRI_voc_tick_t foundTick, MMFilesMarker const* marker)> const& callback) {
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "getting datafiles in data range " << dataMin << " - " << dataMax;
|
||||
|
||||
std::vector<DatafileDescription> datafiles = datafilesInRange(dataMin, dataMax);
|
||||
|
@ -1297,14 +1297,14 @@ bool MMFilesCollection::applyForTickRange(TRI_voc_tick_t dataMin, TRI_voc_tick_t
|
|||
char const* end = ptr + datafile->currentSize();
|
||||
|
||||
while (ptr < end) {
|
||||
auto const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
auto const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
|
||||
if (marker->getSize() == 0) {
|
||||
// end of datafile
|
||||
break;
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
|
||||
if (type <= TRI_DF_MARKER_MIN) {
|
||||
break;
|
||||
|
@ -1767,7 +1767,7 @@ int MMFilesCollection::iterateMarkersOnLoad(transaction::Methods* trx) {
|
|||
}
|
||||
|
||||
// read all documents and fill primary index
|
||||
auto cb = [&openState](TRI_df_marker_t const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
auto cb = [&openState](MMFilesMarker const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
return OpenIterator(marker, &openState, datafile);
|
||||
};
|
||||
|
||||
|
@ -2758,7 +2758,7 @@ uint8_t const* MMFilesCollection::lookupRevisionVPackConditional(TRI_voc_rid_t r
|
|||
uint8_t const* vpack = static_cast<uint8_t const*>(old.dataptr());
|
||||
|
||||
if (maxTick > 0) {
|
||||
TRI_df_marker_t const* marker = reinterpret_cast<TRI_df_marker_t const*>(vpack - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
MMFilesMarker const* marker = reinterpret_cast<MMFilesMarker const*>(vpack - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
if (marker->getTick() > maxTick) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2783,7 +2783,7 @@ void MMFilesCollection::updateRevision(TRI_voc_rid_t revisionId, uint8_t const*
|
|||
_revisionsCache.update(revisionId, dataptr, fid, isInWal);
|
||||
}
|
||||
|
||||
bool MMFilesCollection::updateRevisionConditional(TRI_voc_rid_t revisionId, TRI_df_marker_t const* oldPosition, TRI_df_marker_t const* newPosition, TRI_voc_fid_t newFid, bool isInWal) {
|
||||
bool MMFilesCollection::updateRevisionConditional(TRI_voc_rid_t revisionId, MMFilesMarker const* oldPosition, MMFilesMarker const* newPosition, TRI_voc_fid_t newFid, bool isInWal) {
|
||||
TRI_ASSERT(revisionId != 0);
|
||||
TRI_ASSERT(newPosition != nullptr);
|
||||
return _revisionsCache.updateConditional(revisionId, oldPosition, newPosition, newFid, isInWal);
|
||||
|
@ -2987,6 +2987,7 @@ int MMFilesCollection::update(arangodb::transaction::Methods* trx,
|
|||
ManagedDocumentResult& previous,
|
||||
TRI_voc_rid_t const& revisionId,
|
||||
VPackSlice const key) {
|
||||
|
||||
bool const isEdgeCollection =
|
||||
(_logicalCollection->type() == TRI_COL_TYPE_EDGE);
|
||||
TRI_IF_FAILURE("UpdateDocumentNoLock") { return TRI_ERROR_DEBUG; }
|
||||
|
@ -3034,6 +3035,9 @@ int MMFilesCollection::update(arangodb::transaction::Methods* trx,
|
|||
if (newSlice.length() <= 1) {
|
||||
// no need to do anything
|
||||
result = previous;
|
||||
if (_logicalCollection->waitForSync()) {
|
||||
options.waitForSync = true;
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -3107,7 +3111,6 @@ int MMFilesCollection::update(arangodb::transaction::Methods* trx,
|
|||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
int MMFilesCollection::replace(
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "VocBase/PhysicalCollection.h"
|
||||
|
||||
struct MMFilesDatafile;
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
|
||||
namespace arangodb {
|
||||
class LogicalCollection;
|
||||
|
@ -158,13 +158,13 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
|
||||
// datafile management
|
||||
bool applyForTickRange(TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMax,
|
||||
std::function<bool(TRI_voc_tick_t foundTick, TRI_df_marker_t const* marker)> const& callback) override;
|
||||
std::function<bool(TRI_voc_tick_t foundTick, MMFilesMarker const* marker)> const& callback);
|
||||
|
||||
/// @brief closes an open collection
|
||||
int close() override;
|
||||
|
||||
/// @brief rotate the active journal - will do nothing if there is no journal
|
||||
int rotateActiveJournal() override;
|
||||
int rotateActiveJournal();
|
||||
|
||||
/// @brief sync the active journal - will do nothing if there is no journal
|
||||
/// or if the journal is volatile
|
||||
|
@ -372,8 +372,8 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
TRI_voc_fid_t fid, bool isInWal);
|
||||
|
||||
bool updateRevisionConditional(TRI_voc_rid_t revisionId,
|
||||
TRI_df_marker_t const* oldPosition,
|
||||
TRI_df_marker_t const* newPosition,
|
||||
MMFilesMarker const* oldPosition,
|
||||
MMFilesMarker const* newPosition,
|
||||
TRI_voc_fid_t newFid, bool isInWal);
|
||||
|
||||
void removeRevision(TRI_voc_rid_t revisionId, bool updateStats);
|
||||
|
@ -407,13 +407,13 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
arangodb::velocypack::Slice const toRemove);
|
||||
|
||||
|
||||
static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
|
||||
static int OpenIteratorHandleDocumentMarker(MMFilesMarker const* marker,
|
||||
MMFilesDatafile* datafile,
|
||||
OpenIteratorState* state);
|
||||
static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
|
||||
static int OpenIteratorHandleDeletionMarker(MMFilesMarker const* marker,
|
||||
MMFilesDatafile* datafile,
|
||||
OpenIteratorState* state);
|
||||
static bool OpenIterator(TRI_df_marker_t const* marker,
|
||||
static bool OpenIterator(MMFilesMarker const* marker,
|
||||
OpenIteratorState* data, MMFilesDatafile* datafile);
|
||||
|
||||
/// @brief create statistics for a datafile, using the stats provided
|
||||
|
@ -424,7 +424,7 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
|
||||
/// @brief iterates over a collection
|
||||
bool iterateDatafiles(
|
||||
std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const&
|
||||
std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const&
|
||||
cb);
|
||||
|
||||
/// @brief creates a datafile
|
||||
|
@ -441,7 +441,7 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
|
||||
bool iterateDatafilesVector(
|
||||
std::vector<MMFilesDatafile*> const& files,
|
||||
std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const&
|
||||
std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const&
|
||||
cb);
|
||||
|
||||
MMFilesDocumentPosition lookupRevision(TRI_voc_rid_t revisionId) const;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "VocBase/voc-types.h"
|
||||
|
||||
struct MMFilesDatafile;
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
|
||||
namespace arangodb {
|
||||
class MMFilesWalLogfile;
|
||||
|
@ -142,11 +142,11 @@ struct MMFilesCollectorCache {
|
|||
};
|
||||
|
||||
/// @brief typedef key => document marker
|
||||
typedef std::unordered_map<std::string, struct TRI_df_marker_t const*>
|
||||
typedef std::unordered_map<std::string, struct MMFilesMarker const*>
|
||||
MMFilesDocumentOperationsType;
|
||||
|
||||
/// @brief typedef for structural operation (attributes, shapes) markers
|
||||
typedef std::vector<struct TRI_df_marker_t const*> MMFilesOperationsType;
|
||||
typedef std::vector<struct MMFilesMarker const*> MMFilesOperationsType;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -109,12 +109,12 @@ static bool ShouldIgnoreCollection(CollectorState const* state,
|
|||
}
|
||||
|
||||
/// @brief callback to handle one marker during collection
|
||||
static bool ScanMarker(TRI_df_marker_t const* marker, void* data,
|
||||
static bool ScanMarker(MMFilesMarker const* marker, void* data,
|
||||
MMFilesDatafile* datafile) {
|
||||
CollectorState* state = static_cast<CollectorState*>(data);
|
||||
|
||||
TRI_ASSERT(marker != nullptr);
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
switch (type) {
|
||||
case TRI_DF_MARKER_PROLOGUE: {
|
||||
|
@ -564,13 +564,13 @@ void MMFilesCollectorThread::processCollectionMarker(
|
|||
MMFilesCollectorOperation const& operation) {
|
||||
auto physical = static_cast<MMFilesCollection*>(collection->getPhysical());
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
auto const* walMarker = reinterpret_cast<TRI_df_marker_t const*>(operation.walPosition);
|
||||
auto const* walMarker = reinterpret_cast<MMFilesMarker const*>(operation.walPosition);
|
||||
TRI_ASSERT(walMarker != nullptr);
|
||||
TRI_ASSERT(reinterpret_cast<TRI_df_marker_t const*>(operation.datafilePosition));
|
||||
TRI_ASSERT(reinterpret_cast<MMFilesMarker const*>(operation.datafilePosition));
|
||||
TRI_voc_size_t const datafileMarkerSize = operation.datafileMarkerSize;
|
||||
TRI_voc_fid_t const fid = operation.datafileId;
|
||||
|
||||
TRI_df_marker_type_t const type = walMarker->getType();
|
||||
MMFilesMarkerType const type = walMarker->getType();
|
||||
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
|
||||
auto& dfi = cache->createDfi(fid);
|
||||
|
@ -589,7 +589,7 @@ void MMFilesCollectorThread::processCollectionMarker(
|
|||
if (element &&
|
||||
element.revisionId() == revisionId) {
|
||||
// make it point to datafile now
|
||||
TRI_df_marker_t const* newPosition = reinterpret_cast<TRI_df_marker_t const*>(operation.datafilePosition);
|
||||
MMFilesMarker const* newPosition = reinterpret_cast<MMFilesMarker const*>(operation.datafilePosition);
|
||||
wasAdjusted = physical->updateRevisionConditional(element.revisionId(), walMarker, newPosition, fid, false);
|
||||
}
|
||||
|
||||
|
@ -810,7 +810,7 @@ int MMFilesCollectorThread::collect(MMFilesWalLogfile* logfile) {
|
|||
|
||||
// sort vector by marker tick
|
||||
std::sort(sortedOperations.begin(), sortedOperations.end(),
|
||||
[](TRI_df_marker_t const* left, TRI_df_marker_t const* right) {
|
||||
[](MMFilesMarker const* left, MMFilesMarker const* right) {
|
||||
return (left->getTick() < right->getTick());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -243,13 +243,13 @@ int MMFilesCompactorThread::removeDatafile(LogicalCollection* collection,
|
|||
/// @brief calculate the target size for the compactor to be created
|
||||
MMFilesCompactorThread::CompactionInitialContext MMFilesCompactorThread::getCompactionContext(
|
||||
transaction::Methods* trx, LogicalCollection* collection,
|
||||
std::vector<compaction_info_t> const& toCompact) {
|
||||
std::vector<CompactionInfo> const& toCompact) {
|
||||
CompactionInitialContext context(trx, collection);
|
||||
|
||||
// this is the minimum required size
|
||||
context._targetSize =
|
||||
sizeof(TRI_df_header_marker_t) + sizeof(TRI_col_header_marker_t) +
|
||||
sizeof(TRI_df_footer_marker_t) + 256; // allow for some overhead
|
||||
sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesCollectionHeaderMarker) +
|
||||
sizeof(MMFilesDatafileFooterMarker) + 256; // allow for some overhead
|
||||
|
||||
size_t const n = toCompact.size();
|
||||
|
||||
|
@ -271,12 +271,12 @@ MMFilesCompactorThread::CompactionInitialContext MMFilesCompactorThread::getComp
|
|||
context._keepDeletions = compaction._keepDeletions;
|
||||
|
||||
/// @brief datafile iterator, calculates necessary total size
|
||||
auto calculateSize = [&context](TRI_df_marker_t const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
auto calculateSize = [&context](MMFilesMarker const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
LogicalCollection* collection = context._collection;
|
||||
TRI_ASSERT(collection != nullptr);
|
||||
auto physical = static_cast<MMFilesCollection*>(collection->getPhysical());
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
// new or updated document
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
|
||||
|
@ -287,12 +287,12 @@ MMFilesCompactorThread::CompactionInitialContext MMFilesCompactorThread::getComp
|
|||
|
||||
// check if the document is still active
|
||||
auto primaryIndex = physical->primaryIndex();
|
||||
TRI_df_marker_t const* markerPtr = nullptr;
|
||||
MMFilesMarker const* markerPtr = nullptr;
|
||||
MMFilesSimpleIndexElement element = primaryIndex->lookupKey(context._trx, keySlice);
|
||||
if (element) {
|
||||
MMFilesDocumentPosition const old =
|
||||
physical->lookupRevision(element.revisionId());
|
||||
markerPtr = reinterpret_cast<TRI_df_marker_t const*>(
|
||||
markerPtr = reinterpret_cast<MMFilesMarker const*>(
|
||||
static_cast<uint8_t const*>(old.dataptr()) -
|
||||
MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ MMFilesCompactorThread::CompactionInitialContext MMFilesCompactorThread::getComp
|
|||
|
||||
/// @brief compact the specified datafiles
|
||||
void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
||||
std::vector<compaction_info_t> const& toCompact) {
|
||||
std::vector<CompactionInfo> const& toCompact) {
|
||||
TRI_ASSERT(collection != nullptr);
|
||||
auto physical = static_cast<MMFilesCollection*>(collection->getPhysical());
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
|
@ -368,10 +368,10 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
/// file.
|
||||
/// IMPORTANT: if the logic inside this function is adjusted, the total size
|
||||
/// calculated by function CalculateSize might need adjustment, too!!
|
||||
auto compactifier = [&context, &physical, this](TRI_df_marker_t const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
auto compactifier = [&context, &physical, this](MMFilesMarker const* marker, MMFilesDatafile* datafile) -> bool {
|
||||
TRI_voc_fid_t const targetFid = context->_compactor->fid();
|
||||
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
// new or updated document
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
|
||||
|
@ -382,11 +382,11 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
|
||||
// check if the document is still active
|
||||
auto primaryIndex = physical->primaryIndex();
|
||||
TRI_df_marker_t const* markerPtr = nullptr;
|
||||
MMFilesMarker const* markerPtr = nullptr;
|
||||
MMFilesSimpleIndexElement element = primaryIndex->lookupKey(context->_trx, keySlice);
|
||||
if (element) {
|
||||
MMFilesDocumentPosition const old = physical->lookupRevision(element.revisionId());
|
||||
markerPtr = reinterpret_cast<TRI_df_marker_t const*>(static_cast<uint8_t const*>(old.dataptr()) - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
markerPtr = reinterpret_cast<MMFilesMarker const*>(static_cast<uint8_t const*>(old.dataptr()) - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
}
|
||||
|
||||
bool deleted = (markerPtr == nullptr || marker != markerPtr);
|
||||
|
@ -401,7 +401,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
context->_keepDeletions = true;
|
||||
|
||||
// write to compactor files
|
||||
TRI_df_marker_t* result;
|
||||
MMFilesMarker* result;
|
||||
int res = copyMarker(context->_compactor, marker, &result);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -422,7 +422,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
else if (type == TRI_DF_MARKER_VPACK_REMOVE) {
|
||||
if (context->_keepDeletions) {
|
||||
// write to compactor files
|
||||
TRI_df_marker_t* result;
|
||||
MMFilesMarker* result;
|
||||
int res = copyMarker(context->_compactor, marker, &result);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -661,7 +661,7 @@ bool MMFilesCompactorThread::compactCollection(LogicalCollection* collection, bo
|
|||
return false;
|
||||
}
|
||||
|
||||
std::vector<compaction_info_t> toCompact;
|
||||
std::vector<CompactionInfo> toCompact;
|
||||
toCompact.reserve(maxFiles());
|
||||
|
||||
// now we have datafiles that we can process
|
||||
|
@ -786,7 +786,7 @@ bool MMFilesCompactorThread::compactCollection(LogicalCollection* collection, bo
|
|||
LOG_TOPIC(DEBUG, Logger::COMPACTOR) << "found datafile #" << i << " eligible for compaction. fid: " << df->fid() << ", size: " << df->maximalSize() << ", reason: " << reason << ", numberDead: " << dfi.numberDead << ", numberAlive: " << dfi.numberAlive << ", numberDeletions: " << dfi.numberDeletions << ", numberUncollected: " << dfi.numberUncollected << ", sizeDead: " << dfi.sizeDead << ", sizeAlive: " << dfi.sizeAlive;
|
||||
totalSize += static_cast<uint64_t>(df->maximalSize());
|
||||
|
||||
compaction_info_t compaction;
|
||||
CompactionInfo compaction;
|
||||
compaction._datafile = df;
|
||||
compaction._keepDeletions = (numAlive > 0 && i > 0);
|
||||
// TODO: verify that keepDeletions actually works with wrong numAlive stats
|
||||
|
@ -999,8 +999,8 @@ uint64_t MMFilesCompactorThread::getNumberOfDocuments(LogicalCollection* collect
|
|||
}
|
||||
|
||||
/// @brief write a copy of the marker into the datafile
|
||||
int MMFilesCompactorThread::copyMarker(MMFilesDatafile* compactor, TRI_df_marker_t const* marker,
|
||||
TRI_df_marker_t** result) {
|
||||
int MMFilesCompactorThread::copyMarker(MMFilesDatafile* compactor, MMFilesMarker const* marker,
|
||||
MMFilesMarker** result) {
|
||||
int res = compactor->reserveElement(marker->getSize(), result, 0);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "VocBase/voc-types.h"
|
||||
|
||||
struct MMFilesDatafile;
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
struct TRI_vocbase_t;
|
||||
|
||||
namespace arangodb {
|
||||
|
@ -44,7 +44,7 @@ class Methods;
|
|||
class MMFilesCompactorThread final : public Thread {
|
||||
private:
|
||||
/// @brief compaction instruction for a single datafile
|
||||
struct compaction_info_t {
|
||||
struct CompactionInfo {
|
||||
MMFilesDatafile* _datafile;
|
||||
bool _keepDeletions;
|
||||
};
|
||||
|
@ -80,10 +80,10 @@ class MMFilesCompactorThread final : public Thread {
|
|||
/// @brief calculate the target size for the compactor to be created
|
||||
CompactionInitialContext getCompactionContext(
|
||||
transaction::Methods* trx, LogicalCollection* collection,
|
||||
std::vector<compaction_info_t> const& toCompact);
|
||||
std::vector<CompactionInfo> const& toCompact);
|
||||
|
||||
/// @brief compact the specified datafiles
|
||||
void compactDatafiles(LogicalCollection* collection, std::vector<compaction_info_t> const&);
|
||||
void compactDatafiles(LogicalCollection* collection, std::vector<CompactionInfo> const&);
|
||||
|
||||
/// @brief checks all datafiles of a collection
|
||||
bool compactCollection(LogicalCollection* collection, bool& wasBlocked);
|
||||
|
@ -97,8 +97,8 @@ class MMFilesCompactorThread final : public Thread {
|
|||
uint64_t getNumberOfDocuments(LogicalCollection* collection);
|
||||
|
||||
/// @brief write a copy of the marker into the datafile
|
||||
int copyMarker(MMFilesDatafile* compactor, TRI_df_marker_t const* marker,
|
||||
TRI_df_marker_t** result);
|
||||
int copyMarker(MMFilesDatafile* compactor, MMFilesMarker const* marker,
|
||||
MMFilesMarker** result);
|
||||
|
||||
/// @brief wait time between compaction runs when idle
|
||||
static constexpr unsigned compactionSleepTime() { return 1000 * 1000; }
|
||||
|
|
|
@ -111,7 +111,7 @@ static bool IsMarker28(void const* marker) {
|
|||
}
|
||||
|
||||
/// @brief calculates the actual CRC of a marker, without bounds checks
|
||||
static TRI_voc_crc_t CalculateCrcValue(TRI_df_marker_t const* marker) {
|
||||
static TRI_voc_crc_t CalculateCrcValue(MMFilesMarker const* marker) {
|
||||
TRI_voc_size_t zero = 0;
|
||||
off_t o = marker->offsetOfCrc();
|
||||
size_t n = sizeof(TRI_voc_crc_t);
|
||||
|
@ -130,10 +130,10 @@ static TRI_voc_crc_t CalculateCrcValue(TRI_df_marker_t const* marker) {
|
|||
}
|
||||
|
||||
/// @brief checks a CRC of a marker, with bounds checks
|
||||
static bool CheckCrcMarker(TRI_df_marker_t const* marker, char const* end) {
|
||||
static bool CheckCrcMarker(MMFilesMarker const* marker, char const* end) {
|
||||
TRI_voc_size_t const size = marker->getSize();
|
||||
|
||||
if (size < sizeof(TRI_df_marker_t)) {
|
||||
if (size < sizeof(MMFilesMarker)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ MMFilesDatafile* MMFilesDatafile::create(std::string const& filename, TRI_voc_fi
|
|||
(TRI_voc_size_t)(((maximalSize + pageSize - 1) / pageSize) * pageSize);
|
||||
|
||||
// sanity check maximal size
|
||||
if (sizeof(TRI_df_header_marker_t) + sizeof(TRI_df_footer_marker_t) >
|
||||
if (sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesDatafileFooterMarker) >
|
||||
maximalSize) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "cannot create datafile, maximal size '" << (unsigned int)maximalSize << "' is too small";
|
||||
TRI_set_errno(TRI_ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL);
|
||||
|
@ -374,7 +374,7 @@ MMFilesDatafile* MMFilesDatafile::create(std::string const& filename, TRI_voc_fi
|
|||
/// @brief returns the name for a marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_NameMarkerDatafile(TRI_df_marker_type_t type) {
|
||||
char const* TRI_NameMarkerDatafile(MMFilesMarkerType type) {
|
||||
switch (type) {
|
||||
// general markers
|
||||
case TRI_DF_MARKER_HEADER:
|
||||
|
@ -429,13 +429,13 @@ char const* TRI_NameMarkerDatafile(TRI_df_marker_type_t type) {
|
|||
/// @brief checks whether a marker is valid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IsValidMarkerDatafile(TRI_df_marker_t const* marker) {
|
||||
bool TRI_IsValidMarkerDatafile(MMFilesMarker const* marker) {
|
||||
if (marker == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check marker type
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
if (type <= TRI_DF_MARKER_MIN) {
|
||||
// marker type is less than minimum allowed type value
|
||||
|
@ -460,7 +460,7 @@ bool TRI_IsValidMarkerDatafile(TRI_df_marker_t const* marker) {
|
|||
/// note: maximalJournalSize is the collection's maximalJournalSize property,
|
||||
/// which may be different from the size of the current datafile
|
||||
/// some callers do not set the value of maximalJournalSize
|
||||
int MMFilesDatafile::reserveElement(TRI_voc_size_t size, TRI_df_marker_t** position,
|
||||
int MMFilesDatafile::reserveElement(TRI_voc_size_t size, MMFilesMarker** position,
|
||||
TRI_voc_size_t maximalJournalSize) {
|
||||
*position = nullptr;
|
||||
size = encoding::alignedSize<TRI_voc_size_t>(size);
|
||||
|
@ -508,7 +508,7 @@ int MMFilesDatafile::reserveElement(TRI_voc_size_t size, TRI_df_marker_t** posit
|
|||
return TRI_ERROR_ARANGO_DATAFILE_FULL;
|
||||
}
|
||||
|
||||
*position = reinterpret_cast<TRI_df_marker_t*>(_next);
|
||||
*position = reinterpret_cast<MMFilesMarker*>(_next);
|
||||
|
||||
TRI_ASSERT(*position != nullptr);
|
||||
|
||||
|
@ -566,7 +566,7 @@ int MMFilesDatafile::unlockFromMemory() {
|
|||
|
||||
/// @brief writes a marker to the datafile
|
||||
/// this function will write the marker as-is, without any CRC or tick updates
|
||||
int MMFilesDatafile::writeElement(void* position, TRI_df_marker_t const* marker, bool forceSync) {
|
||||
int MMFilesDatafile::writeElement(void* position, MMFilesMarker const* marker, bool forceSync) {
|
||||
TRI_ASSERT(marker->getTick() > 0);
|
||||
TRI_ASSERT(marker->getSize() > 0);
|
||||
|
||||
|
@ -621,8 +621,8 @@ int MMFilesDatafile::writeElement(void* position, TRI_df_marker_t const* marker,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_UpdateTicksDatafile(MMFilesDatafile* datafile,
|
||||
TRI_df_marker_t const* marker) {
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarker const* marker) {
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
if (type != TRI_DF_MARKER_HEADER && type != TRI_DF_MARKER_FOOTER &&
|
||||
type != TRI_DF_MARKER_COL_HEADER) {
|
||||
|
@ -652,7 +652,7 @@ void TRI_UpdateTicksDatafile(MMFilesDatafile* datafile,
|
|||
/// @brief checksums and writes a marker to the datafile
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int MMFilesDatafile::writeCrcElement(void* position, TRI_df_marker_t* marker, bool forceSync) {
|
||||
int MMFilesDatafile::writeCrcElement(void* position, MMFilesMarker* marker, bool forceSync) {
|
||||
TRI_ASSERT(marker->getTick() != 0);
|
||||
|
||||
if (isPhysical()) {
|
||||
|
@ -672,7 +672,7 @@ int MMFilesDatafile::writeCrcElement(void* position, TRI_df_marker_t* marker, bo
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IterateDatafile(MMFilesDatafile* datafile,
|
||||
bool (*iterator)(TRI_df_marker_t const*, void*,
|
||||
bool (*iterator)(MMFilesMarker const*, void*,
|
||||
MMFilesDatafile*),
|
||||
void* data) {
|
||||
TRI_ASSERT(iterator != nullptr);
|
||||
|
@ -692,7 +692,7 @@ bool TRI_IterateDatafile(MMFilesDatafile* datafile,
|
|||
TRI_DEFER(TRI_UpdateTickServer(maxTick));
|
||||
|
||||
while (ptr < end) {
|
||||
auto const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
auto const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
|
||||
if (marker->getSize() == 0) {
|
||||
return true;
|
||||
|
@ -720,7 +720,7 @@ bool TRI_IterateDatafile(MMFilesDatafile* datafile,
|
|||
/// @brief iterates over a datafile
|
||||
/// also may set datafile's min/max tick values
|
||||
bool TRI_IterateDatafile(MMFilesDatafile* datafile,
|
||||
std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const& cb) {
|
||||
std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const& cb) {
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "iterating over datafile '" << datafile->getName() << "', fid: " << datafile->fid();
|
||||
|
||||
char const* ptr = datafile->data();
|
||||
|
@ -736,7 +736,7 @@ bool TRI_IterateDatafile(MMFilesDatafile* datafile,
|
|||
TRI_DEFER(TRI_UpdateTickServer(maxTick));
|
||||
|
||||
while (ptr < end) {
|
||||
auto const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
auto const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
|
||||
if (marker->getSize() == 0) {
|
||||
return true;
|
||||
|
@ -807,12 +807,12 @@ int MMFilesDatafile::seal() {
|
|||
}
|
||||
|
||||
// create the footer
|
||||
TRI_df_footer_marker_t footer = MMFilesDatafileHelper::CreateFooterMarker(_tickMax);
|
||||
MMFilesDatafileFooterMarker footer = MMFilesDatafileHelper::CreateFooterMarker(_tickMax);
|
||||
|
||||
// reserve space and write footer to file
|
||||
_footerSize = 0;
|
||||
|
||||
TRI_df_marker_t* position;
|
||||
MMFilesMarker* position;
|
||||
int res = reserveElement(footer.base.getSize(), &position, 0);
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
|
@ -907,7 +907,7 @@ bool MMFilesDatafile::tryRepair(std::string const& path) {
|
|||
/// @brief diagnoses a marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string DiagnoseMarker(TRI_df_marker_t const* marker,
|
||||
static std::string DiagnoseMarker(MMFilesMarker const* marker,
|
||||
char const* end) {
|
||||
std::ostringstream result;
|
||||
|
||||
|
@ -916,7 +916,7 @@ static std::string DiagnoseMarker(TRI_df_marker_t const* marker,
|
|||
}
|
||||
|
||||
// check marker type
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
|
||||
if (type <= TRI_DF_MARKER_MIN) {
|
||||
// marker type is less than minimum allowed type value
|
||||
|
@ -943,9 +943,9 @@ static std::string DiagnoseMarker(TRI_df_marker_t const* marker,
|
|||
return result.str();
|
||||
}
|
||||
|
||||
if (size < sizeof(TRI_df_marker_t)) {
|
||||
if (size < sizeof(MMFilesMarker)) {
|
||||
result << "marker size is too small (" << size
|
||||
<< "). expecting at least " << sizeof(TRI_df_marker_t) << " bytes";
|
||||
<< "). expecting at least " << sizeof(MMFilesMarker) << " bytes";
|
||||
return result.str();
|
||||
}
|
||||
|
||||
|
@ -975,7 +975,7 @@ MMFilesDatafile::MMFilesDatafile(std::string const& filename, int fd, void* mmHa
|
|||
_initSize(maximalSize),
|
||||
_maximalSize(maximalSize),
|
||||
_currentSize(currentSize),
|
||||
_footerSize(sizeof(TRI_df_footer_marker_t)),
|
||||
_footerSize(sizeof(MMFilesDatafileFooterMarker)),
|
||||
_full(false),
|
||||
_isSealed(false),
|
||||
_lockedInMemory(false),
|
||||
|
@ -1092,11 +1092,11 @@ int MMFilesDatafile::truncateAndSeal(TRI_voc_size_t position) {
|
|||
|
||||
// use multiples of page-size
|
||||
size_t maximalSize =
|
||||
((position + sizeof(TRI_df_footer_marker_t) + pageSize - 1) / pageSize) *
|
||||
((position + sizeof(MMFilesDatafileFooterMarker) + pageSize - 1) / pageSize) *
|
||||
pageSize;
|
||||
|
||||
// sanity check
|
||||
if (sizeof(TRI_df_header_marker_t) + sizeof(TRI_df_footer_marker_t) >
|
||||
if (sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesDatafileFooterMarker) >
|
||||
maximalSize) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "cannot create datafile '" << getName() << "', maximal size " << maximalSize << " is too small";
|
||||
return TRI_ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL;
|
||||
|
@ -1247,10 +1247,10 @@ bool MMFilesDatafile::check(bool ignoreFailures) {
|
|||
TRI_DEFER(TRI_UpdateTickServer(maxTick));
|
||||
|
||||
while (ptr < end) {
|
||||
TRI_df_marker_t const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
MMFilesMarker const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
TRI_voc_size_t const size = marker->getSize();
|
||||
TRI_voc_tick_t const tick = marker->getTick();
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
#ifdef DEBUG_DATAFILE
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "MARKER: size " << size << ", tick " << tick << ", crc " << marker->getCrc() << ", type " << type;
|
||||
|
@ -1265,7 +1265,7 @@ bool MMFilesDatafile::check(bool ignoreFailures) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (size < sizeof(TRI_df_marker_t)) {
|
||||
if (size < sizeof(MMFilesMarker)) {
|
||||
if (ignoreFailures) {
|
||||
return fix(currentSize);
|
||||
}
|
||||
|
@ -1275,7 +1275,7 @@ bool MMFilesDatafile::check(bool ignoreFailures) {
|
|||
_next = _data + _currentSize;
|
||||
_state = TRI_DF_STATE_OPEN_ERROR;
|
||||
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "marker in datafile '" << getName() << "' too small, size " << size << ", should be at least " << sizeof(TRI_df_marker_t);
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "marker in datafile '" << getName() << "' too small, size " << size << ", should be at least " << sizeof(MMFilesMarker);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1360,10 +1360,10 @@ bool MMFilesDatafile::check(bool ignoreFailures) {
|
|||
if (next < end) {
|
||||
// there is a next marker
|
||||
auto nextMarker =
|
||||
reinterpret_cast<TRI_df_marker_t const*>(next);
|
||||
reinterpret_cast<MMFilesMarker const*>(next);
|
||||
|
||||
if (nextMarker->getType() != 0 &&
|
||||
nextMarker->getSize() >= sizeof(TRI_df_marker_t) &&
|
||||
nextMarker->getSize() >= sizeof(MMFilesMarker) &&
|
||||
next + nextMarker->getSize() <= end &&
|
||||
TRI_IsValidMarkerDatafile(nextMarker) &&
|
||||
CheckCrcMarker(nextMarker, end)) {
|
||||
|
@ -1436,7 +1436,7 @@ bool MMFilesDatafile::check(bool ignoreFailures) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void MMFilesDatafile::printMarker(TRI_df_marker_t const* marker, TRI_voc_size_t size, char const* begin, char const* end) const {
|
||||
void MMFilesDatafile::printMarker(MMFilesMarker const* marker, TRI_voc_size_t size, char const* begin, char const* end) const {
|
||||
LOG_TOPIC(INFO, arangodb::Logger::FIXME) << "raw marker data following:";
|
||||
LOG_TOPIC(INFO, arangodb::Logger::FIXME) << "type: " << TRI_NameMarkerDatafile(marker) << ", size: " << marker->getSize() << ", crc: " << marker->getCrc();
|
||||
LOG_TOPIC(INFO, arangodb::Logger::FIXME) << "(expected layout: size (4 bytes), crc (4 bytes), type and tick (8 bytes), payload following)";
|
||||
|
@ -1529,7 +1529,7 @@ DatafileScan MMFilesDatafile::scanHelper() {
|
|||
}
|
||||
|
||||
while (ptr < end) {
|
||||
TRI_df_marker_t* marker = reinterpret_cast<TRI_df_marker_t*>(ptr);
|
||||
MMFilesMarker* marker = reinterpret_cast<MMFilesMarker*>(ptr);
|
||||
|
||||
DatafileScanEntry entry;
|
||||
entry.position = static_cast<TRI_voc_size_t>(ptr - _data);
|
||||
|
@ -1560,7 +1560,7 @@ DatafileScan MMFilesDatafile::scanHelper() {
|
|||
return scan;
|
||||
}
|
||||
|
||||
if (marker->getSize() < sizeof(TRI_df_marker_t)) {
|
||||
if (marker->getSize() < sizeof(MMFilesMarker)) {
|
||||
entry.status = 4;
|
||||
|
||||
entry.diagnosis = DiagnoseMarker(marker, end);
|
||||
|
@ -1591,7 +1591,7 @@ DatafileScan MMFilesDatafile::scanHelper() {
|
|||
scan.status = 4;
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE) {
|
||||
|
@ -1620,11 +1620,11 @@ DatafileScan MMFilesDatafile::scanHelper() {
|
|||
/// @brief create the initial datafile header marker
|
||||
int MMFilesDatafile::writeInitialHeaderMarker(TRI_voc_fid_t fid, TRI_voc_size_t maximalSize) {
|
||||
// create the header
|
||||
TRI_df_header_marker_t header = MMFilesDatafileHelper::CreateHeaderMarker(
|
||||
MMFilesDatafileHeaderMarker header = MMFilesDatafileHelper::CreateHeaderMarker(
|
||||
maximalSize, static_cast<TRI_voc_tick_t>(fid));
|
||||
|
||||
// reserve space and write header to file
|
||||
TRI_df_marker_t* position;
|
||||
MMFilesMarker* position;
|
||||
int res = reserveElement(header.base.getSize(), &position, 0);
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
|
@ -1650,7 +1650,7 @@ bool MMFilesDatafile::tryRepair() {
|
|||
TRI_voc_size_t currentSize = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
TRI_df_marker_t* marker = reinterpret_cast<TRI_df_marker_t*>(ptr);
|
||||
MMFilesMarker* marker = reinterpret_cast<MMFilesMarker*>(ptr);
|
||||
TRI_voc_size_t const size = marker->getSize();
|
||||
|
||||
if (size == 0) {
|
||||
|
@ -1658,7 +1658,7 @@ bool MMFilesDatafile::tryRepair() {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (size < sizeof(TRI_df_marker_t) || ptr + size > end) {
|
||||
if (size < sizeof(MMFilesMarker) || ptr + size > end) {
|
||||
// marker too small or too big
|
||||
return false;
|
||||
}
|
||||
|
@ -1698,10 +1698,10 @@ bool MMFilesDatafile::tryRepair() {
|
|||
|
||||
if (next < end) {
|
||||
// there is a next marker
|
||||
auto nextMarker = reinterpret_cast<TRI_df_marker_t const*>(next);
|
||||
auto nextMarker = reinterpret_cast<MMFilesMarker const*>(next);
|
||||
|
||||
if (nextMarker->getType() != 0 &&
|
||||
nextMarker->getSize() >= sizeof(TRI_df_marker_t) &&
|
||||
nextMarker->getSize() >= sizeof(MMFilesMarker) &&
|
||||
next + nextMarker->getSize() <= end &&
|
||||
TRI_IsValidMarkerDatafile(nextMarker) &&
|
||||
CheckCrcMarker(nextMarker, end)) {
|
||||
|
@ -1711,9 +1711,9 @@ bool MMFilesDatafile::tryRepair() {
|
|||
auto buffer = std::unique_ptr<char[]>(new char[size]);
|
||||
|
||||
// create a new marker in the temporary buffer
|
||||
auto temp = reinterpret_cast<TRI_df_marker_t*>(buffer.get());
|
||||
auto temp = reinterpret_cast<MMFilesMarker*>(buffer.get());
|
||||
MMFilesDatafileHelper::InitMarker(
|
||||
reinterpret_cast<TRI_df_marker_t*>(buffer.get()), TRI_DF_MARKER_BLANK,
|
||||
reinterpret_cast<MMFilesMarker*>(buffer.get()), TRI_DF_MARKER_BLANK,
|
||||
static_cast<uint32_t>(size));
|
||||
temp->setCrc(CalculateCrcValue(temp));
|
||||
|
||||
|
@ -1831,7 +1831,7 @@ MMFilesDatafile* MMFilesDatafile::openHelper(std::string const& filename, bool i
|
|||
// check that file is not too small
|
||||
TRI_voc_size_t size = static_cast<TRI_voc_size_t>(status.st_size);
|
||||
|
||||
if (size < sizeof(TRI_df_header_marker_t) + sizeof(TRI_df_footer_marker_t)) {
|
||||
if (size < sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesDatafileFooterMarker)) {
|
||||
TRI_set_errno(TRI_ERROR_ARANGO_CORRUPTED_DATAFILE);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
|
@ -1844,7 +1844,7 @@ MMFilesDatafile* MMFilesDatafile::openHelper(std::string const& filename, bool i
|
|||
char buffer[128];
|
||||
memset(&buffer[0], 0, sizeof(buffer));
|
||||
|
||||
ssize_t len = sizeof(TRI_df_header_marker_t);
|
||||
ssize_t len = sizeof(MMFilesDatafileHeaderMarker);
|
||||
|
||||
ssize_t toRead = sizeof(buffer);
|
||||
if (toRead > static_cast<ssize_t>(status.st_size)) {
|
||||
|
@ -1862,10 +1862,10 @@ MMFilesDatafile* MMFilesDatafile::openHelper(std::string const& filename, bool i
|
|||
|
||||
char const* ptr = reinterpret_cast<char*>(&buffer[0]);
|
||||
char const* end = static_cast<char const*>(ptr) + len;
|
||||
TRI_df_header_marker_t const* header = reinterpret_cast<TRI_df_header_marker_t const*>(&buffer[0]);
|
||||
MMFilesDatafileHeaderMarker const* header = reinterpret_cast<MMFilesDatafileHeaderMarker const*>(&buffer[0]);
|
||||
|
||||
// check CRC
|
||||
ok = CheckCrcMarker(reinterpret_cast<TRI_df_marker_t const*>(ptr), end);
|
||||
ok = CheckCrcMarker(reinterpret_cast<MMFilesMarker const*>(ptr), end);
|
||||
|
||||
if (!ok) {
|
||||
if (IsMarker28(ptr)) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "Basics/Common.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
|
||||
/// @brief state of the datafile
|
||||
enum TRI_df_state_e {
|
||||
|
@ -40,7 +40,7 @@ enum TRI_df_state_e {
|
|||
};
|
||||
|
||||
/// @brief type of the marker
|
||||
enum TRI_df_marker_type_t : uint8_t {
|
||||
enum MMFilesMarkerType : uint8_t {
|
||||
TRI_DF_MARKER_MIN = 9, // not a real marker type,
|
||||
// but used for bounds checking
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct DatafileScanEntry {
|
|||
TRI_voc_size_t realSize;
|
||||
TRI_voc_tick_t tick;
|
||||
|
||||
TRI_df_marker_type_t type;
|
||||
MMFilesMarkerType type;
|
||||
uint32_t status;
|
||||
|
||||
char const* typeName;
|
||||
|
@ -133,17 +133,17 @@ struct DatafileScan {
|
|||
///
|
||||
/// @section DatafileMarker Datafile Marker
|
||||
///
|
||||
/// @copydetails TRI_df_marker_t
|
||||
/// @copydetails MMFilesMarker
|
||||
///
|
||||
/// @copydetails TRI_df_header_marker_t
|
||||
/// @copydetails MMFilesDatafileHeaderMarker
|
||||
///
|
||||
/// @copydetails TRI_df_footer_marker_t
|
||||
/// @copydetails MMFilesDatafileFooterMarker
|
||||
///
|
||||
/// A datafile is therefore structured as follows:
|
||||
///
|
||||
/// <table border>
|
||||
/// <tr>
|
||||
/// <td>TRI_df_header_marker_t</td>
|
||||
/// <td>MMFilesDatafileHeaderMarker</td>
|
||||
/// <td>header entry</td>
|
||||
/// </tr>
|
||||
/// <tr>
|
||||
|
@ -163,7 +163,7 @@ struct DatafileScan {
|
|||
/// <td>data entry</td>
|
||||
/// </tr>
|
||||
/// <tr>
|
||||
/// <td>TRI_df_footer_marker_t</td>
|
||||
/// <td>MMFilesDatafileFooterMarker</td>
|
||||
/// <td>footer entry</td>
|
||||
/// </tr>
|
||||
/// </table>
|
||||
|
@ -179,7 +179,7 @@ struct DatafileScan {
|
|||
#define TRI_DF_VERSION (2)
|
||||
|
||||
/// @brief datafile version
|
||||
typedef uint32_t TRI_df_version_t;
|
||||
typedef uint32_t MMFilesDatafileVersionType;
|
||||
|
||||
/// @brief datafile
|
||||
struct MMFilesDatafile {
|
||||
|
@ -228,13 +228,13 @@ struct MMFilesDatafile {
|
|||
|
||||
/// @brief writes a marker to the datafile
|
||||
/// this function will write the marker as-is, without any CRC or tick updates
|
||||
int writeElement(void* position, TRI_df_marker_t const* marker, bool sync);
|
||||
int writeElement(void* position, MMFilesMarker const* marker, bool sync);
|
||||
|
||||
/// @brief checksums and writes a marker to the datafile
|
||||
int writeCrcElement(void* position, TRI_df_marker_t* marker, bool sync);
|
||||
int writeCrcElement(void* position, MMFilesMarker* marker, bool sync);
|
||||
|
||||
/// @brief reserves room for an element, advances the pointer
|
||||
int reserveElement(TRI_voc_size_t size, TRI_df_marker_t** position,
|
||||
int reserveElement(TRI_voc_size_t size, MMFilesMarker** position,
|
||||
TRI_voc_size_t maximalJournalSize);
|
||||
|
||||
void sequentialAccess();
|
||||
|
@ -291,7 +291,7 @@ struct MMFilesDatafile {
|
|||
/// @brief tries to repair a datafile
|
||||
bool tryRepair();
|
||||
|
||||
void printMarker(TRI_df_marker_t const* marker, TRI_voc_size_t size, char const* begin, char const* end) const;
|
||||
void printMarker(MMFilesMarker const* marker, TRI_voc_size_t size, char const* begin, char const* end) const;
|
||||
|
||||
private:
|
||||
std::string _filename; // underlying filename
|
||||
|
@ -351,9 +351,9 @@ struct MMFilesDatafile {
|
|||
/// the field _crc is equal to 0.</td>
|
||||
/// </tr>
|
||||
/// <tr>
|
||||
/// <td>TRI_df_marker_type_t</td>
|
||||
/// <td>MMFilesMarkerType</td>
|
||||
/// <td>_type</td>
|
||||
/// <td>see @ref TRI_df_marker_type_t</td>
|
||||
/// <td>see @ref MMFilesMarkerType</td>
|
||||
/// </tr>
|
||||
/// <tr>
|
||||
/// <td>TRI_voc_tick_t</td>
|
||||
|
@ -368,24 +368,24 @@ struct MMFilesDatafile {
|
|||
/// and _crc the second.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_df_marker_t {
|
||||
struct MMFilesMarker {
|
||||
private:
|
||||
TRI_voc_size_t _size; // 4 bytes
|
||||
TRI_voc_crc_t _crc; // 4 bytes, generated
|
||||
uint64_t _typeAndTick; // 8 bytes, including 1 byte for type and 7 bytes for tick
|
||||
|
||||
public:
|
||||
TRI_df_marker_t() : _size(0), _crc(0), _typeAndTick(0) {}
|
||||
~TRI_df_marker_t() {}
|
||||
MMFilesMarker() : _size(0), _crc(0), _typeAndTick(0) {}
|
||||
~MMFilesMarker() {}
|
||||
|
||||
inline off_t offsetOfSize() const noexcept {
|
||||
return offsetof(TRI_df_marker_t, _size);
|
||||
return offsetof(MMFilesMarker, _size);
|
||||
}
|
||||
inline off_t offsetOfCrc() const noexcept {
|
||||
return offsetof(TRI_df_marker_t, _crc);
|
||||
return offsetof(MMFilesMarker, _crc);
|
||||
}
|
||||
inline off_t offsetOfTypeAndTick() const noexcept {
|
||||
return offsetof(TRI_df_marker_t, _typeAndTick);
|
||||
return offsetof(MMFilesMarker, _typeAndTick);
|
||||
}
|
||||
inline TRI_voc_size_t getSize() const noexcept { return _size; }
|
||||
inline void setSize(TRI_voc_size_t size) noexcept { _size = size; }
|
||||
|
@ -400,15 +400,15 @@ struct TRI_df_marker_t {
|
|||
_typeAndTick &= 0xff00000000000000ULL;
|
||||
_typeAndTick |= tick & 0x00ffffffffffffffULL;
|
||||
}
|
||||
inline TRI_df_marker_type_t getType() const noexcept {
|
||||
return static_cast<TRI_df_marker_type_t>((_typeAndTick & 0xff00000000000000ULL) >> 56);
|
||||
inline MMFilesMarkerType getType() const noexcept {
|
||||
return static_cast<MMFilesMarkerType>((_typeAndTick & 0xff00000000000000ULL) >> 56);
|
||||
}
|
||||
inline void setType(TRI_df_marker_type_t type) noexcept {
|
||||
inline void setType(MMFilesMarkerType type) noexcept {
|
||||
uint64_t t = static_cast<uint64_t>(type) << 56;
|
||||
_typeAndTick &= 0x00ffffffffffffffULL;
|
||||
_typeAndTick |= t;
|
||||
}
|
||||
inline void setTypeAndTick(TRI_df_marker_type_t type, TRI_voc_tick_t tick) noexcept {
|
||||
inline void setTypeAndTick(MMFilesMarkerType type, TRI_voc_tick_t tick) noexcept {
|
||||
uint64_t t = static_cast<uint64_t>(type) << 56;
|
||||
t |= (tick & 0x00ffffffffffffffULL);
|
||||
_typeAndTick = t;
|
||||
|
@ -416,20 +416,20 @@ struct TRI_df_marker_t {
|
|||
|
||||
};
|
||||
|
||||
static_assert(sizeof(TRI_df_marker_t) == 16, "invalid size for TRI_df_marker_t");
|
||||
static_assert(sizeof(MMFilesMarker) == 16, "invalid size for MMFilesMarker");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief datafile header marker
|
||||
///
|
||||
/// The first blob entry in a datafile is always a TRI_df_header_marker_t.
|
||||
/// The first blob entry in a datafile is always a MMFilesDatafileHeaderMarker.
|
||||
/// The header marker contains the version number of the datafile, its
|
||||
/// maximal size and the creation time. There is no data payload.
|
||||
///
|
||||
/// <table border>
|
||||
/// <tr>
|
||||
/// <td>TRI_df_version_t</td>
|
||||
/// <td>MMFilesDatafileVersionType</td>
|
||||
/// <td>_version</td>
|
||||
/// <td>The version of a datafile, see @ref TRI_df_version_t.</td>
|
||||
/// <td>The version of a datafile, see @ref MMFilesDatafileVersionType.</td>
|
||||
/// </tr>
|
||||
/// <tr>
|
||||
/// <td>TRI_voc_size_t</td>
|
||||
|
@ -448,30 +448,30 @@ static_assert(sizeof(TRI_df_marker_t) == 16, "invalid size for TRI_df_marker_t")
|
|||
/// </table>
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_df_header_marker_t {
|
||||
TRI_df_marker_t base; // 16 bytes
|
||||
struct MMFilesDatafileHeaderMarker {
|
||||
MMFilesMarker base; // 16 bytes
|
||||
|
||||
TRI_df_version_t _version; // 4 bytes
|
||||
MMFilesDatafileVersionType _version; // 4 bytes
|
||||
TRI_voc_size_t _maximalSize; // 4 bytes
|
||||
TRI_voc_tick_t _fid; // 8 bytes
|
||||
};
|
||||
|
||||
/// @brief datafile prologue marker
|
||||
struct TRI_df_prologue_marker_t {
|
||||
TRI_df_marker_t base; // 16 bytes
|
||||
struct MMFilesPrologueMarker {
|
||||
MMFilesMarker base; // 16 bytes
|
||||
|
||||
TRI_voc_tick_t _databaseId; // 8 bytes
|
||||
TRI_voc_cid_t _collectionId; // 8 bytes
|
||||
};
|
||||
|
||||
/// @brief datafile footer marker
|
||||
struct TRI_df_footer_marker_t {
|
||||
TRI_df_marker_t base; // 16 bytes
|
||||
struct MMFilesDatafileFooterMarker {
|
||||
MMFilesMarker base; // 16 bytes
|
||||
};
|
||||
|
||||
/// @brief document datafile header marker
|
||||
struct TRI_col_header_marker_t {
|
||||
TRI_df_marker_t base; // 16 bytes
|
||||
struct MMFilesCollectionHeaderMarker {
|
||||
MMFilesMarker base; // 16 bytes
|
||||
|
||||
TRI_voc_cid_t _cid; // 8 bytes
|
||||
};
|
||||
|
@ -480,9 +480,9 @@ struct TRI_col_header_marker_t {
|
|||
/// @brief returns the name for a marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_NameMarkerDatafile(TRI_df_marker_type_t);
|
||||
char const* TRI_NameMarkerDatafile(MMFilesMarkerType);
|
||||
|
||||
static inline char const* TRI_NameMarkerDatafile(TRI_df_marker_t const* marker) {
|
||||
static inline char const* TRI_NameMarkerDatafile(MMFilesMarker const* marker) {
|
||||
return TRI_NameMarkerDatafile(marker->getType());
|
||||
}
|
||||
|
||||
|
@ -490,13 +490,13 @@ static inline char const* TRI_NameMarkerDatafile(TRI_df_marker_t const* marker)
|
|||
/// @brief checks whether a marker is valid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IsValidMarkerDatafile(TRI_df_marker_t const*);
|
||||
bool TRI_IsValidMarkerDatafile(MMFilesMarker const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief update tick values for a datafile
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_UpdateTicksDatafile(MMFilesDatafile*, TRI_df_marker_t const*);
|
||||
void TRI_UpdateTicksDatafile(MMFilesDatafile*, MMFilesMarker const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief iterates over a datafile
|
||||
|
@ -504,11 +504,11 @@ void TRI_UpdateTicksDatafile(MMFilesDatafile*, TRI_df_marker_t const*);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IterateDatafile(MMFilesDatafile*,
|
||||
bool (*iterator)(TRI_df_marker_t const*, void*,
|
||||
bool (*iterator)(MMFilesMarker const*, void*,
|
||||
MMFilesDatafile*),
|
||||
void* data);
|
||||
|
||||
bool TRI_IterateDatafile(MMFilesDatafile*,
|
||||
std::function<bool(TRI_df_marker_t const*, MMFilesDatafile*)> const& cb);
|
||||
std::function<bool(MMFilesMarker const*, MMFilesDatafile*)> const& cb);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ constexpr inline TRI_voc_size_t MaximalMarkerSize() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constexpr inline TRI_voc_size_t JournalOverhead() {
|
||||
return sizeof(TRI_df_header_marker_t) + sizeof(TRI_df_footer_marker_t);
|
||||
return sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesDatafileFooterMarker);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -61,7 +61,7 @@ constexpr inline TRI_voc_size_t JournalOverhead() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename T>
|
||||
static inline T AlignedMarkerSize(TRI_df_marker_t const* marker) {
|
||||
static inline T AlignedMarkerSize(MMFilesMarker const* marker) {
|
||||
size_t value = marker->getSize();
|
||||
return static_cast<T>((value + 7) - ((value + 7) & 7));
|
||||
}
|
||||
|
@ -72,11 +72,11 @@ static inline T AlignedMarkerSize(TRI_df_marker_t const* marker) {
|
|||
/// marker type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline size_t VPackOffset(TRI_df_marker_type_t type) noexcept {
|
||||
static inline size_t VPackOffset(MMFilesMarkerType type) noexcept {
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE) {
|
||||
// VPack is located after transaction id
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tid_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tid_t);
|
||||
}
|
||||
if (type == TRI_DF_MARKER_VPACK_CREATE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_COLLECTION ||
|
||||
|
@ -88,22 +88,22 @@ static inline size_t VPackOffset(TRI_df_marker_type_t type) noexcept {
|
|||
type == TRI_DF_MARKER_VPACK_DROP_VIEW ||
|
||||
type == TRI_DF_MARKER_VPACK_CHANGE_VIEW) {
|
||||
// VPack is located after database id and collection id
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_cid_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_cid_t);
|
||||
}
|
||||
if (type == TRI_DF_MARKER_VPACK_CREATE_DATABASE ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_DATABASE) {
|
||||
// VPack is located after database id
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t);
|
||||
}
|
||||
if (type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_COMMIT_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION) {
|
||||
// these marker types do not have any VPack
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_tid_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_tid_t);
|
||||
}
|
||||
if (type == TRI_DF_MARKER_PROLOGUE) {
|
||||
// this type does not have any VPack
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_cid_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t) + sizeof(TRI_voc_cid_t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static inline size_t VPackOffset(TRI_df_marker_type_t type) noexcept {
|
|||
/// @brief returns the marker-specific database id offset
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline size_t DatabaseIdOffset(TRI_df_marker_type_t type) noexcept {
|
||||
static inline size_t DatabaseIdOffset(MMFilesMarkerType type) noexcept {
|
||||
if (type == TRI_DF_MARKER_PROLOGUE ||
|
||||
type == TRI_DF_MARKER_VPACK_CREATE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_COLLECTION ||
|
||||
|
@ -128,7 +128,7 @@ static inline size_t DatabaseIdOffset(TRI_df_marker_type_t type) noexcept {
|
|||
type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_COMMIT_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION) {
|
||||
return sizeof(TRI_df_marker_t);
|
||||
return sizeof(MMFilesMarker);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ static inline size_t DatabaseIdOffset(TRI_df_marker_type_t type) noexcept {
|
|||
/// @brief returns the marker-specific database id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_voc_tick_t DatabaseId(TRI_df_marker_t const* marker) noexcept {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline TRI_voc_tick_t DatabaseId(MMFilesMarker const* marker) noexcept {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
if (type == TRI_DF_MARKER_PROLOGUE ||
|
||||
type == TRI_DF_MARKER_VPACK_CREATE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_COLLECTION ||
|
||||
|
@ -163,7 +163,7 @@ static inline TRI_voc_tick_t DatabaseId(TRI_df_marker_t const* marker) noexcept
|
|||
/// @brief returns the marker-specific collection id offset
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline size_t CollectionIdOffset(TRI_df_marker_type_t type) noexcept {
|
||||
static inline size_t CollectionIdOffset(MMFilesMarkerType type) noexcept {
|
||||
if (type == TRI_DF_MARKER_PROLOGUE ||
|
||||
type == TRI_DF_MARKER_VPACK_CREATE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_COLLECTION ||
|
||||
|
@ -171,7 +171,7 @@ static inline size_t CollectionIdOffset(TRI_df_marker_type_t type) noexcept {
|
|||
type == TRI_DF_MARKER_VPACK_CHANGE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_CREATE_INDEX ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_INDEX) {
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ static inline size_t CollectionIdOffset(TRI_df_marker_type_t type) noexcept {
|
|||
/// @brief returns the marker-specific collection id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_voc_tick_t CollectionId(TRI_df_marker_t const* marker) noexcept {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline TRI_voc_tick_t CollectionId(MMFilesMarker const* marker) noexcept {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
if (type == TRI_DF_MARKER_PROLOGUE ||
|
||||
type == TRI_DF_MARKER_VPACK_CREATE_COLLECTION ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_COLLECTION ||
|
||||
|
@ -198,11 +198,11 @@ static inline TRI_voc_tick_t CollectionId(TRI_df_marker_t const* marker) noexcep
|
|||
/// @brief returns the marker-specific view id offset
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline size_t ViewIdOffset(TRI_df_marker_type_t type) noexcept {
|
||||
static inline size_t ViewIdOffset(MMFilesMarkerType type) noexcept {
|
||||
if (type == TRI_DF_MARKER_VPACK_CREATE_VIEW ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_VIEW ||
|
||||
type == TRI_DF_MARKER_VPACK_CHANGE_VIEW) {
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -211,8 +211,8 @@ static inline size_t ViewIdOffset(TRI_df_marker_type_t type) noexcept {
|
|||
/// @brief returns the marker-specific view id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_voc_tick_t ViewId(TRI_df_marker_t const* marker) noexcept {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline TRI_voc_tick_t ViewId(MMFilesMarker const* marker) noexcept {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
if (type == TRI_DF_MARKER_VPACK_CREATE_VIEW ||
|
||||
type == TRI_DF_MARKER_VPACK_DROP_VIEW ||
|
||||
type == TRI_DF_MARKER_VPACK_CHANGE_VIEW) {
|
||||
|
@ -225,15 +225,15 @@ static inline TRI_voc_tick_t ViewId(TRI_df_marker_t const* marker) noexcept {
|
|||
/// @brief returns the marker-specific transaction id offset
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_voc_tick_t TransactionIdOffset(TRI_df_marker_type_t type) noexcept {
|
||||
static inline TRI_voc_tick_t TransactionIdOffset(MMFilesMarkerType type) noexcept {
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE) {
|
||||
return sizeof(TRI_df_marker_t);
|
||||
return sizeof(MMFilesMarker);
|
||||
}
|
||||
if (type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_COMMIT_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION) {
|
||||
return sizeof(TRI_df_marker_t) + sizeof(TRI_voc_tick_t);
|
||||
return sizeof(MMFilesMarker) + sizeof(TRI_voc_tick_t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -242,8 +242,8 @@ static inline TRI_voc_tick_t TransactionIdOffset(TRI_df_marker_type_t type) noex
|
|||
/// @brief returns the marker-specific transaction id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_voc_tick_t TransactionId(TRI_df_marker_t const* marker) noexcept {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline TRI_voc_tick_t TransactionId(MMFilesMarker const* marker) noexcept {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE ||
|
||||
type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
|
@ -258,8 +258,8 @@ static inline TRI_voc_tick_t TransactionId(TRI_df_marker_t const* marker) noexce
|
|||
/// @brief initializes a marker, using user-defined tick
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline void InitMarker(TRI_df_marker_t* marker,
|
||||
TRI_df_marker_type_t type, uint32_t size, TRI_voc_tick_t tick) {
|
||||
static inline void InitMarker(MMFilesMarker* marker,
|
||||
MMFilesMarkerType type, uint32_t size, TRI_voc_tick_t tick) {
|
||||
TRI_ASSERT(marker != nullptr);
|
||||
TRI_ASSERT(type > TRI_DF_MARKER_MIN && type < TRI_DF_MARKER_MAX);
|
||||
TRI_ASSERT(size > 0);
|
||||
|
@ -273,8 +273,8 @@ static inline void InitMarker(TRI_df_marker_t* marker,
|
|||
/// @brief initializes a marker, using tick 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline void InitMarker(TRI_df_marker_t* marker,
|
||||
TRI_df_marker_type_t type, uint32_t size) {
|
||||
static inline void InitMarker(MMFilesMarker* marker,
|
||||
MMFilesMarkerType type, uint32_t size) {
|
||||
InitMarker(marker, type, size, 0); // always use tick 0
|
||||
}
|
||||
|
||||
|
@ -282,11 +282,11 @@ static inline void InitMarker(TRI_df_marker_t* marker,
|
|||
/// @brief create a header marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_df_header_marker_t CreateHeaderMarker(TRI_voc_size_t maximalSize, TRI_voc_tick_t fid) {
|
||||
static inline MMFilesDatafileHeaderMarker CreateHeaderMarker(TRI_voc_size_t maximalSize, TRI_voc_tick_t fid) {
|
||||
static_assert(sizeof(TRI_voc_tick_t) == sizeof(TRI_voc_fid_t), "invalid tick/fid sizes");
|
||||
|
||||
TRI_df_header_marker_t header;
|
||||
InitMarker(reinterpret_cast<TRI_df_marker_t*>(&header), TRI_DF_MARKER_HEADER, sizeof(TRI_df_header_marker_t), fid);
|
||||
MMFilesDatafileHeaderMarker header;
|
||||
InitMarker(reinterpret_cast<MMFilesMarker*>(&header), TRI_DF_MARKER_HEADER, sizeof(MMFilesDatafileHeaderMarker), fid);
|
||||
|
||||
header._version = TRI_DF_VERSION;
|
||||
header._maximalSize = maximalSize;
|
||||
|
@ -299,9 +299,9 @@ static inline TRI_df_header_marker_t CreateHeaderMarker(TRI_voc_size_t maximalSi
|
|||
/// @brief create a prologue marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_df_prologue_marker_t CreatePrologueMarker(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
TRI_df_prologue_marker_t header;
|
||||
InitMarker(reinterpret_cast<TRI_df_marker_t*>(&header), TRI_DF_MARKER_PROLOGUE, sizeof(TRI_df_prologue_marker_t));
|
||||
static inline MMFilesPrologueMarker CreatePrologueMarker(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
MMFilesPrologueMarker header;
|
||||
InitMarker(reinterpret_cast<MMFilesMarker*>(&header), TRI_DF_MARKER_PROLOGUE, sizeof(MMFilesPrologueMarker));
|
||||
|
||||
encoding::storeNumber<decltype(databaseId)>(reinterpret_cast<uint8_t*>(&header) + DatabaseIdOffset(TRI_DF_MARKER_PROLOGUE), databaseId, sizeof(decltype(databaseId)));
|
||||
encoding::storeNumber<decltype(collectionId)>(reinterpret_cast<uint8_t*>(&header) + CollectionIdOffset(TRI_DF_MARKER_PROLOGUE), collectionId, sizeof(decltype(collectionId)));
|
||||
|
@ -313,9 +313,9 @@ static inline TRI_df_prologue_marker_t CreatePrologueMarker(TRI_voc_tick_t datab
|
|||
/// @brief create a footer marker, using a user-defined tick
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_df_footer_marker_t CreateFooterMarker(TRI_voc_tick_t tick) {
|
||||
TRI_df_footer_marker_t footer;
|
||||
InitMarker(reinterpret_cast<TRI_df_marker_t*>(&footer), TRI_DF_MARKER_FOOTER, sizeof(TRI_df_footer_marker_t), tick);
|
||||
static inline MMFilesDatafileFooterMarker CreateFooterMarker(TRI_voc_tick_t tick) {
|
||||
MMFilesDatafileFooterMarker footer;
|
||||
InitMarker(reinterpret_cast<MMFilesMarker*>(&footer), TRI_DF_MARKER_FOOTER, sizeof(MMFilesDatafileFooterMarker), tick);
|
||||
|
||||
return footer;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ static inline TRI_df_footer_marker_t CreateFooterMarker(TRI_voc_tick_t tick) {
|
|||
/// @brief create a footer marker, using tick 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline TRI_df_footer_marker_t CreateFooterMarker() {
|
||||
static inline MMFilesDatafileFooterMarker CreateFooterMarker() {
|
||||
return CreateFooterMarker(0); // always use tick 0
|
||||
}
|
||||
|
||||
|
|
|
@ -767,7 +767,7 @@ std::string MMFilesEngine::createCollection(
|
|||
std::string const path = databasePath(vocbase);
|
||||
|
||||
// sanity check
|
||||
if (sizeof(TRI_df_header_marker_t) + sizeof(TRI_df_footer_marker_t) >
|
||||
if (sizeof(MMFilesDatafileHeaderMarker) + sizeof(MMFilesDatafileFooterMarker) >
|
||||
static_cast<MMFilesCollection*>(parameters->getPhysical())->journalSize()) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
|
||||
<< "cannot create datafile '" << parameters->name() << "' in '" << path
|
||||
|
@ -2111,7 +2111,7 @@ bool MMFilesEngine::iterateFiles(std::vector<std::string> const& files) {
|
|||
/// it will check the ticks of all markers and update the internal tick
|
||||
/// counter accordingly. this is done so we'll not re-assign an already used
|
||||
/// tick value
|
||||
auto cb = [this](TRI_df_marker_t const* marker,
|
||||
auto cb = [this](MMFilesMarker const* marker,
|
||||
MMFilesDatafile* datafile) -> bool {
|
||||
TRI_voc_tick_t markerTick = marker->getTick();
|
||||
|
||||
|
@ -2731,9 +2731,9 @@ bool MMFilesEngine::checkDatafileHeader(MMFilesDatafile* datafile,
|
|||
char const* ptr = datafile->data();
|
||||
|
||||
// skip the datafile header
|
||||
ptr += encoding::alignedSize<size_t>(sizeof(TRI_df_header_marker_t));
|
||||
TRI_col_header_marker_t const* cm =
|
||||
reinterpret_cast<TRI_col_header_marker_t const*>(ptr);
|
||||
ptr += encoding::alignedSize<size_t>(sizeof(MMFilesDatafileHeaderMarker));
|
||||
MMFilesCollectionHeaderMarker const* cm =
|
||||
reinterpret_cast<MMFilesCollectionHeaderMarker const*>(ptr);
|
||||
|
||||
if (cm->base.getType() != TRI_DF_MARKER_COL_HEADER) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
|
||||
|
@ -3032,7 +3032,7 @@ int MMFilesEngine::transferMarkersWorker(
|
|||
TRI_ASSERT(!operations.empty());
|
||||
|
||||
for (auto it2 = operations.begin(); it2 != operations.end(); ++it2) {
|
||||
TRI_df_marker_t const* source = (*it2);
|
||||
MMFilesMarker const* source = (*it2);
|
||||
TRI_voc_tick_t const tick = source->getTick();
|
||||
|
||||
if (tick <= minTransferTick) {
|
||||
|
@ -3049,7 +3049,7 @@ int MMFilesEngine::transferMarkersWorker(
|
|||
}
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t const type = source->getType();
|
||||
MMFilesMarkerType const type = source->getType();
|
||||
|
||||
if (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE) {
|
||||
|
@ -3082,7 +3082,7 @@ int MMFilesEngine::transferMarkersWorker(
|
|||
/// @brief get the next position for a marker of the specified size
|
||||
char* MMFilesEngine::nextFreeMarkerPosition(LogicalCollection* collection,
|
||||
TRI_voc_tick_t tick,
|
||||
TRI_df_marker_type_t type,
|
||||
MMFilesMarkerType type,
|
||||
TRI_voc_size_t size,
|
||||
MMFilesCollectorCache* cache) {
|
||||
// align the specified size
|
||||
|
@ -3136,7 +3136,7 @@ char* MMFilesEngine::nextFreeMarkerPosition(LogicalCollection* collection,
|
|||
|
||||
TRI_ASSERT(dst != nullptr);
|
||||
|
||||
MMFilesDatafileHelper::InitMarker(reinterpret_cast<TRI_df_marker_t*>(dst),
|
||||
MMFilesDatafileHelper::InitMarker(reinterpret_cast<MMFilesMarker*>(dst),
|
||||
type, size);
|
||||
|
||||
return dst;
|
||||
|
@ -3148,8 +3148,8 @@ void MMFilesEngine::finishMarker(char const* walPosition,
|
|||
LogicalCollection* collection,
|
||||
TRI_voc_tick_t tick,
|
||||
MMFilesCollectorCache* cache) {
|
||||
TRI_df_marker_t* marker =
|
||||
reinterpret_cast<TRI_df_marker_t*>(datafilePosition);
|
||||
MMFilesMarker* marker =
|
||||
reinterpret_cast<MMFilesMarker*>(datafilePosition);
|
||||
|
||||
MMFilesDatafile* datafile = cache->lastDatafile;
|
||||
TRI_ASSERT(datafile != nullptr);
|
||||
|
|
|
@ -331,7 +331,7 @@ public:
|
|||
|
||||
/// @brief get the next free position for a new marker of the specified size
|
||||
char* nextFreeMarkerPosition(LogicalCollection* collection,
|
||||
TRI_voc_tick_t, TRI_df_marker_type_t,
|
||||
TRI_voc_tick_t, MMFilesMarkerType,
|
||||
TRI_voc_size_t, MMFilesCollectorCache*);
|
||||
|
||||
/// @brief set the tick of a marker and calculate its CRC value
|
||||
|
|
|
@ -655,7 +655,7 @@ void MMFilesLogfileManager::signalSync(bool waitForSync) {
|
|||
|
||||
// allocate space in a logfile for later writing
|
||||
MMFilesWalSlotInfo MMFilesLogfileManager::allocate(uint32_t size) {
|
||||
TRI_ASSERT(size >= sizeof(TRI_df_marker_t));
|
||||
TRI_ASSERT(size >= sizeof(MMFilesMarker));
|
||||
|
||||
if (!_allowWrites) {
|
||||
// no writes allowed
|
||||
|
@ -678,7 +678,7 @@ MMFilesWalSlotInfo MMFilesLogfileManager::allocate(uint32_t size) {
|
|||
// allocate space in a logfile for later writing
|
||||
MMFilesWalSlotInfo MMFilesLogfileManager::allocate(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId, uint32_t size) {
|
||||
TRI_ASSERT(size >= sizeof(TRI_df_marker_t));
|
||||
TRI_ASSERT(size >= sizeof(MMFilesMarker));
|
||||
|
||||
if (!_allowWrites) {
|
||||
// no writes allowed
|
||||
|
@ -1531,7 +1531,7 @@ MMFilesLogfileManagerState MMFilesLogfileManager::state() {
|
|||
}
|
||||
|
||||
// return the current available logfile ranges
|
||||
LogfileRanges MMFilesLogfileManager::ranges() {
|
||||
MMFilesLogfileManager::LogfileRanges MMFilesLogfileManager::ranges() {
|
||||
LogfileRanges result;
|
||||
|
||||
READ_LOCKER(readLocker, _logfilesLock);
|
||||
|
|
|
@ -45,25 +45,6 @@ namespace options {
|
|||
class ProgramOptions;
|
||||
}
|
||||
|
||||
struct LogfileRange {
|
||||
LogfileRange(MMFilesWalLogfile::IdType id, std::string const& filename,
|
||||
std::string const& state, TRI_voc_tick_t tickMin,
|
||||
TRI_voc_tick_t tickMax)
|
||||
: id(id),
|
||||
filename(filename),
|
||||
state(state),
|
||||
tickMin(tickMin),
|
||||
tickMax(tickMax) {}
|
||||
|
||||
MMFilesWalLogfile::IdType id;
|
||||
std::string filename;
|
||||
std::string state;
|
||||
TRI_voc_tick_t tickMin;
|
||||
TRI_voc_tick_t tickMax;
|
||||
};
|
||||
|
||||
typedef std::vector<LogfileRange> LogfileRanges;
|
||||
|
||||
struct MMFilesTransactionData final : public TransactionData {
|
||||
MMFilesTransactionData() = delete;
|
||||
MMFilesTransactionData(MMFilesWalLogfile::IdType lastCollectedId, MMFilesWalLogfile::IdType lastSealedId) :
|
||||
|
@ -81,17 +62,6 @@ struct MMFilesLogfileManagerState {
|
|||
std::string timeString;
|
||||
};
|
||||
|
||||
struct LogfileBarrier {
|
||||
LogfileBarrier() = delete;
|
||||
|
||||
LogfileBarrier(TRI_voc_tick_t id, double expires, TRI_voc_tick_t minTick)
|
||||
: id(id), expires(expires), minTick(minTick) {}
|
||||
|
||||
TRI_voc_tick_t const id;
|
||||
double expires;
|
||||
TRI_voc_tick_t minTick;
|
||||
};
|
||||
|
||||
class MMFilesLogfileManager final : public application_features::ApplicationFeature {
|
||||
friend class MMFilesAllocatorThread;
|
||||
friend class MMFilesCollectorThread;
|
||||
|
@ -114,6 +84,36 @@ class MMFilesLogfileManager final : public application_features::ApplicationFeat
|
|||
private:
|
||||
static MMFilesLogfileManager* Instance;
|
||||
|
||||
struct LogfileBarrier {
|
||||
LogfileBarrier() = delete;
|
||||
|
||||
LogfileBarrier(TRI_voc_tick_t id, double expires, TRI_voc_tick_t minTick)
|
||||
: id(id), expires(expires), minTick(minTick) {}
|
||||
|
||||
TRI_voc_tick_t const id;
|
||||
double expires;
|
||||
TRI_voc_tick_t minTick;
|
||||
};
|
||||
|
||||
struct LogfileRange {
|
||||
LogfileRange(MMFilesWalLogfile::IdType id, std::string const& filename,
|
||||
std::string const& state, TRI_voc_tick_t tickMin,
|
||||
TRI_voc_tick_t tickMax)
|
||||
: id(id),
|
||||
filename(filename),
|
||||
state(state),
|
||||
tickMin(tickMin),
|
||||
tickMax(tickMax) {}
|
||||
|
||||
MMFilesWalLogfile::IdType id;
|
||||
std::string filename;
|
||||
std::string state;
|
||||
TRI_voc_tick_t tickMin;
|
||||
TRI_voc_tick_t tickMax;
|
||||
};
|
||||
|
||||
typedef std::vector<LogfileRange> LogfileRanges;
|
||||
|
||||
public:
|
||||
void collectOptions(
|
||||
std::shared_ptr<options::ProgramOptions> options) override final;
|
||||
|
|
|
@ -130,7 +130,7 @@ void MMFilesRevisionsCache::update(TRI_voc_rid_t revisionId, uint8_t const* data
|
|||
old->fid(fid, isInWal);
|
||||
}
|
||||
|
||||
bool MMFilesRevisionsCache::updateConditional(TRI_voc_rid_t revisionId, TRI_df_marker_t const* oldPosition, TRI_df_marker_t const* newPosition, TRI_voc_fid_t newFid, bool isInWal) {
|
||||
bool MMFilesRevisionsCache::updateConditional(TRI_voc_rid_t revisionId, MMFilesMarker const* oldPosition, MMFilesMarker const* newPosition, TRI_voc_fid_t newFid, bool isInWal) {
|
||||
WRITE_LOCKER(locker, _lock);
|
||||
|
||||
MMFilesDocumentPosition old = _positions.findByKey(nullptr, &revisionId);
|
||||
|
@ -141,7 +141,7 @@ bool MMFilesRevisionsCache::updateConditional(TRI_voc_rid_t revisionId, TRI_df_m
|
|||
uint8_t const* vpack = static_cast<uint8_t const*>(old.dataptr());
|
||||
TRI_ASSERT(vpack != nullptr);
|
||||
|
||||
TRI_df_marker_t const* markerPtr = reinterpret_cast<TRI_df_marker_t const*>(vpack - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
MMFilesMarker const* markerPtr = reinterpret_cast<MMFilesMarker const*>(vpack - MMFilesDatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
|
||||
if (markerPtr != oldPosition) {
|
||||
// element already outdated
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "MMFiles/MMFilesDocumentPosition.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
|
||||
namespace arangodb {
|
||||
|
||||
|
@ -49,7 +49,7 @@ class MMFilesRevisionsCache {
|
|||
MMFilesDocumentPosition insert(TRI_voc_rid_t revisionId, uint8_t const* dataptr, TRI_voc_fid_t fid, bool isInWal, bool shouldLock);
|
||||
void insert(MMFilesDocumentPosition const& position, bool shouldLock);
|
||||
void update(TRI_voc_rid_t revisionId, uint8_t const* dataptr, TRI_voc_fid_t fid, bool isInWal);
|
||||
bool updateConditional(TRI_voc_rid_t revisionId, TRI_df_marker_t const* oldPosition, TRI_df_marker_t const* newPosition, TRI_voc_fid_t newFid, bool isInWal);
|
||||
bool updateConditional(TRI_voc_rid_t revisionId, MMFilesMarker const* oldPosition, MMFilesMarker const* newPosition, TRI_voc_fid_t newFid, bool isInWal);
|
||||
void remove(TRI_voc_rid_t revisionId);
|
||||
MMFilesDocumentPosition fetchAndRemove(TRI_voc_rid_t revisionId);
|
||||
|
||||
|
|
|
@ -25,10 +25,13 @@
|
|||
#include "Basics/Exceptions.h"
|
||||
#include "Cluster/ClusterMethods.h"
|
||||
#include "Cluster/ServerState.h"
|
||||
#include "MMFiles/MMFilesCollection.h"
|
||||
#include "MMFiles/MMFilesEngine.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
#include "Transaction/V8Context.h"
|
||||
#include "Utils/SingleCollectionTransaction.h"
|
||||
#include "V8/v8-conv.h"
|
||||
#include "V8/v8-globals.h"
|
||||
#include "V8/v8-utils.h"
|
||||
|
@ -41,6 +44,50 @@
|
|||
|
||||
using namespace arangodb;
|
||||
|
||||
/// @brief rotate the active journal of the collection
|
||||
static void JS_RotateVocbaseCol(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
// renaming a collection in a cluster is unsupported
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_CLUSTER_UNSUPPORTED);
|
||||
}
|
||||
|
||||
PREVENT_EMBEDDED_TRANSACTION();
|
||||
|
||||
arangodb::LogicalCollection* collection =
|
||||
TRI_UnwrapClass<arangodb::LogicalCollection>(args.Holder(), WRP_VOCBASE_COL_TYPE);
|
||||
|
||||
if (collection == nullptr) {
|
||||
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
|
||||
}
|
||||
|
||||
TRI_THROW_SHARDING_COLLECTION_NOT_YET_IMPLEMENTED(collection);
|
||||
|
||||
SingleCollectionTransaction trx(
|
||||
transaction::V8Context::Create(collection->vocbase(), true),
|
||||
collection->cid(), AccessMode::Type::READ);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
res = static_cast<MMFilesCollection*>(collection->getPhysical())->rotateActiveJournal();
|
||||
|
||||
trx.finish(res);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(res, "could not rotate journal");
|
||||
}
|
||||
|
||||
TRI_V8_RETURN_UNDEFINED();
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
/// @brief returns information about the datafiles
|
||||
/// the collection must be unloaded.
|
||||
static void JS_DatafilesVocbaseCol(
|
||||
|
@ -497,14 +544,16 @@ void MMFilesV8Functions::registerResources() {
|
|||
v8::Handle<v8::ObjectTemplate> rt = v8::Handle<v8::ObjectTemplate>::New(isolate, v8g->VocbaseColTempl);
|
||||
TRI_ASSERT(!rt.IsEmpty());
|
||||
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("truncateDatafile"),
|
||||
JS_TruncateDatafileVocbaseCol, true);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("tryRepairDatafile"),
|
||||
JS_TryRepairDatafileVocbaseCol, true);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("datafiles"),
|
||||
JS_DatafilesVocbaseCol, true);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("datafileScan"),
|
||||
JS_DatafileScanVocbaseCol, true);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("rotate"),
|
||||
JS_RotateVocbaseCol);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("truncateDatafile"),
|
||||
JS_TruncateDatafileVocbaseCol, true);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("tryRepairDatafile"),
|
||||
JS_TryRepairDatafileVocbaseCol, true);
|
||||
|
||||
// add global WAL handling functions
|
||||
TRI_AddGlobalFunctionVocbase(
|
||||
|
|
|
@ -98,7 +98,7 @@ class MMFilesWalLogfile {
|
|||
inline MMFilesWalLogfile::IdType id() const { return _id; }
|
||||
|
||||
/// @brief update the logfile tick status
|
||||
inline void update(TRI_df_marker_t const* marker) {
|
||||
inline void update(MMFilesMarker const* marker) {
|
||||
TRI_UpdateTicksDatafile(df(), marker);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class MMFilesWalMarker {
|
|||
virtual ~MMFilesWalMarker() {}
|
||||
|
||||
/// @brief returns the marker type
|
||||
virtual TRI_df_marker_type_t type() const = 0;
|
||||
virtual MMFilesMarkerType type() const = 0;
|
||||
|
||||
/// @brief returns the datafile id the marker comes from
|
||||
/// this should be 0 for new markers, but contain the actual
|
||||
|
@ -73,19 +73,19 @@ class MMFilesWalMarker {
|
|||
/// this type is used during recovery only, to represent existing markers
|
||||
class MMFilesMarkerEnvelope : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesMarkerEnvelope(TRI_df_marker_t const* other, TRI_voc_fid_t fid)
|
||||
MMFilesMarkerEnvelope(MMFilesMarker const* other, TRI_voc_fid_t fid)
|
||||
: _other(other),
|
||||
_fid(fid),
|
||||
_size(other->getSize()) {
|
||||
// we must always have a datafile id, and a reasonable marker size
|
||||
TRI_ASSERT(_fid > 0);
|
||||
TRI_ASSERT(_size >= sizeof(TRI_df_marker_t));
|
||||
TRI_ASSERT(_size >= sizeof(MMFilesMarker));
|
||||
}
|
||||
|
||||
~MMFilesMarkerEnvelope() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final {
|
||||
MMFilesMarkerType type() const override final {
|
||||
// simply return the wrapped marker's type
|
||||
return _other->getType();
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class MMFilesMarkerEnvelope : public MMFilesWalMarker {
|
|||
}
|
||||
|
||||
private:
|
||||
TRI_df_marker_t const* _other;
|
||||
MMFilesMarker const* _other;
|
||||
TRI_voc_fid_t _fid;
|
||||
uint32_t _size;
|
||||
};
|
||||
|
@ -124,7 +124,7 @@ class MMFilesMarkerEnvelope : public MMFilesWalMarker {
|
|||
/// updating/replacing or removing documents
|
||||
class MMFilesCrudMarker : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesCrudMarker(TRI_df_marker_type_t type,
|
||||
MMFilesCrudMarker(MMFilesMarkerType type,
|
||||
TRI_voc_tid_t transactionId,
|
||||
arangodb::velocypack::Slice const& data)
|
||||
: _transactionId(transactionId),
|
||||
|
@ -134,7 +134,7 @@ class MMFilesCrudMarker : public MMFilesWalMarker {
|
|||
~MMFilesCrudMarker() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final { return _type; }
|
||||
MMFilesMarkerType type() const override final { return _type; }
|
||||
|
||||
/// @brief returns the datafile id
|
||||
/// this is always 0 for this type of marker, as the marker is not
|
||||
|
@ -160,13 +160,13 @@ class MMFilesCrudMarker : public MMFilesWalMarker {
|
|||
private:
|
||||
TRI_voc_tid_t _transactionId;
|
||||
arangodb::velocypack::Slice _data;
|
||||
TRI_df_marker_type_t _type;
|
||||
MMFilesMarkerType _type;
|
||||
};
|
||||
|
||||
/// @brief a marker used for database-related operations
|
||||
class MMFilesDatabaseMarker : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesDatabaseMarker(TRI_df_marker_type_t type,
|
||||
MMFilesDatabaseMarker(MMFilesMarkerType type,
|
||||
TRI_voc_tick_t databaseId,
|
||||
arangodb::velocypack::Slice const& data)
|
||||
: _databaseId(databaseId),
|
||||
|
@ -178,7 +178,7 @@ class MMFilesDatabaseMarker : public MMFilesWalMarker {
|
|||
~MMFilesDatabaseMarker() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final { return _type; }
|
||||
MMFilesMarkerType type() const override final { return _type; }
|
||||
|
||||
/// @brief returns the datafile id
|
||||
/// this is always 0 for this type of marker, as the marker is not
|
||||
|
@ -201,13 +201,13 @@ class MMFilesDatabaseMarker : public MMFilesWalMarker {
|
|||
private:
|
||||
TRI_voc_tick_t _databaseId;
|
||||
arangodb::velocypack::Slice _data;
|
||||
TRI_df_marker_type_t _type;
|
||||
MMFilesMarkerType _type;
|
||||
};
|
||||
|
||||
/// @brief a marker used for collection-related operations
|
||||
class MMFilesCollectionMarker : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesCollectionMarker(TRI_df_marker_type_t type,
|
||||
MMFilesCollectionMarker(MMFilesMarkerType type,
|
||||
TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId,
|
||||
arangodb::velocypack::Slice const& data)
|
||||
|
@ -223,7 +223,7 @@ class MMFilesCollectionMarker : public MMFilesWalMarker {
|
|||
~MMFilesCollectionMarker() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final { return _type; }
|
||||
MMFilesMarkerType type() const override final { return _type; }
|
||||
|
||||
/// @brief returns the datafile id
|
||||
/// this is always 0 for this type of marker, as the marker is not
|
||||
|
@ -249,13 +249,13 @@ class MMFilesCollectionMarker : public MMFilesWalMarker {
|
|||
TRI_voc_tick_t _databaseId;
|
||||
TRI_voc_cid_t _collectionId;
|
||||
arangodb::velocypack::Slice _data;
|
||||
TRI_df_marker_type_t _type;
|
||||
MMFilesMarkerType _type;
|
||||
};
|
||||
|
||||
/// @brief a marker used for view-related operations
|
||||
class MMFilesViewMarker : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesViewMarker(TRI_df_marker_type_t type,
|
||||
MMFilesViewMarker(MMFilesMarkerType type,
|
||||
TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t viewId,
|
||||
arangodb::velocypack::Slice const& data)
|
||||
|
@ -271,7 +271,7 @@ class MMFilesViewMarker : public MMFilesWalMarker {
|
|||
~MMFilesViewMarker() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final { return _type; }
|
||||
MMFilesMarkerType type() const override final { return _type; }
|
||||
|
||||
/// @brief returns the datafile id
|
||||
/// this is always 0 for this type of marker, as the marker is not
|
||||
|
@ -297,13 +297,13 @@ class MMFilesViewMarker : public MMFilesWalMarker {
|
|||
TRI_voc_tick_t _databaseId;
|
||||
TRI_voc_cid_t _viewId;
|
||||
arangodb::velocypack::Slice _data;
|
||||
TRI_df_marker_type_t _type;
|
||||
MMFilesMarkerType _type;
|
||||
};
|
||||
|
||||
/// @brief a marker used for transaction-related operations
|
||||
class MMFilesTransactionMarker : public MMFilesWalMarker {
|
||||
public:
|
||||
MMFilesTransactionMarker(TRI_df_marker_type_t type,
|
||||
MMFilesTransactionMarker(MMFilesMarkerType type,
|
||||
TRI_voc_tick_t databaseId,
|
||||
TRI_voc_tid_t transactionId)
|
||||
: _databaseId(databaseId),
|
||||
|
@ -316,7 +316,7 @@ class MMFilesTransactionMarker : public MMFilesWalMarker {
|
|||
~MMFilesTransactionMarker() = default;
|
||||
|
||||
/// @brief returns the marker type
|
||||
TRI_df_marker_type_t type() const override final { return _type; }
|
||||
MMFilesMarkerType type() const override final { return _type; }
|
||||
|
||||
/// @brief returns the datafile id
|
||||
/// this is always 0 for this type of marker, as the marker is not
|
||||
|
@ -340,7 +340,7 @@ class MMFilesTransactionMarker : public MMFilesWalMarker {
|
|||
private:
|
||||
TRI_voc_tick_t _databaseId;
|
||||
TRI_voc_tid_t _transactionId;
|
||||
TRI_df_marker_type_t _type;
|
||||
MMFilesMarkerType _type;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ LogicalCollection* MMFilesWalRecoverState::getCollection(
|
|||
/// @brief executes a single operation inside a transaction
|
||||
int MMFilesWalRecoverState::executeSingleOperation(
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
TRI_df_marker_t const* marker, TRI_voc_fid_t fid,
|
||||
MMFilesMarker const* marker, TRI_voc_fid_t fid,
|
||||
std::function<int(SingleCollectionTransaction*, MMFilesMarkerEnvelope*)>
|
||||
func) {
|
||||
// first find the correct database
|
||||
|
@ -337,7 +337,7 @@ int MMFilesWalRecoverState::executeSingleOperation(
|
|||
|
||||
/// @brief callback to handle one marker during recovery
|
||||
/// this function only builds up state and does not change any data
|
||||
bool MMFilesWalRecoverState::InitialScanMarker(TRI_df_marker_t const* marker,
|
||||
bool MMFilesWalRecoverState::InitialScanMarker(MMFilesMarker const* marker,
|
||||
void* data,
|
||||
MMFilesDatafile* datafile) {
|
||||
MMFilesWalRecoverState* state =
|
||||
|
@ -354,7 +354,7 @@ bool MMFilesWalRecoverState::InitialScanMarker(TRI_df_marker_t const* marker,
|
|||
state->lastTick = tick;
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
switch (type) {
|
||||
case TRI_DF_MARKER_VPACK_DOCUMENT: {
|
||||
|
@ -433,7 +433,7 @@ bool MMFilesWalRecoverState::InitialScanMarker(TRI_df_marker_t const* marker,
|
|||
|
||||
/// @brief callback to replay one marker during recovery
|
||||
/// this function modifies indexes etc.
|
||||
bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
||||
bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
|
||||
void* data,
|
||||
MMFilesDatafile* datafile) {
|
||||
MMFilesWalRecoverState* state =
|
||||
|
@ -443,7 +443,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "replaying marker of type " << TRI_NameMarkerDatafile(marker);
|
||||
#endif
|
||||
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
try {
|
||||
switch (type) {
|
||||
|
@ -496,8 +496,8 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
TRI_df_marker_t const* marker =
|
||||
static_cast<TRI_df_marker_t const*>(envelope->mem());
|
||||
MMFilesMarker const* marker =
|
||||
static_cast<MMFilesMarker const*>(envelope->mem());
|
||||
|
||||
std::string const collectionName =
|
||||
trx->documentCollection()->name();
|
||||
|
@ -573,8 +573,8 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
TRI_df_marker_t const* marker =
|
||||
static_cast<TRI_df_marker_t const*>(envelope->mem());
|
||||
MMFilesMarker const* marker =
|
||||
static_cast<MMFilesMarker const*>(envelope->mem());
|
||||
|
||||
std::string const collectionName =
|
||||
trx->documentCollection()->name();
|
||||
|
|
|
@ -140,16 +140,16 @@ struct MMFilesWalRecoverState {
|
|||
|
||||
/// @brief executes a single operation inside a transaction
|
||||
int executeSingleOperation(
|
||||
TRI_voc_tick_t, TRI_voc_cid_t, TRI_df_marker_t const*, TRI_voc_fid_t,
|
||||
TRI_voc_tick_t, TRI_voc_cid_t, MMFilesMarker const*, TRI_voc_fid_t,
|
||||
std::function<int(SingleCollectionTransaction*, MMFilesMarkerEnvelope*)>);
|
||||
|
||||
/// @brief callback to handle one marker during recovery
|
||||
/// this function modifies indexes etc.
|
||||
static bool ReplayMarker(TRI_df_marker_t const*, void*, MMFilesDatafile*);
|
||||
static bool ReplayMarker(MMFilesMarker const*, void*, MMFilesDatafile*);
|
||||
|
||||
/// @brief callback to handle one marker during recovery
|
||||
/// this function only builds up state and does not change any data
|
||||
static bool InitialScanMarker(TRI_df_marker_t const*, void*, MMFilesDatafile*);
|
||||
static bool InitialScanMarker(MMFilesMarker const*, void*, MMFilesDatafile*);
|
||||
|
||||
/// @brief replay a single logfile
|
||||
int replayLogfile(MMFilesWalLogfile*, int);
|
||||
|
|
|
@ -65,9 +65,9 @@ void MMFilesWalSlot::finalize(MMFilesWalMarker const* marker) {
|
|||
|
||||
TRI_ASSERT(_mem != nullptr);
|
||||
TRI_ASSERT(size == _size);
|
||||
TRI_ASSERT(size >= sizeof(TRI_df_marker_t));
|
||||
TRI_ASSERT(size >= sizeof(MMFilesMarker));
|
||||
|
||||
TRI_df_marker_t* dfm = static_cast<TRI_df_marker_t*>(_mem);
|
||||
MMFilesMarker* dfm = static_cast<MMFilesMarker*>(_mem);
|
||||
|
||||
// set type and tick
|
||||
dfm->setTypeAndTick(marker->type(), _tick);
|
||||
|
@ -96,7 +96,7 @@ void MMFilesWalSlot::fill(void* src, size_t size) {
|
|||
TRI_ASSERT(size == _size);
|
||||
TRI_ASSERT(src != nullptr);
|
||||
|
||||
TRI_df_marker_t* marker = static_cast<TRI_df_marker_t*>(src);
|
||||
MMFilesMarker* marker = static_cast<MMFilesMarker*>(src);
|
||||
|
||||
// set tick
|
||||
marker->setTick(_tick);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
using namespace arangodb;
|
||||
|
||||
static uint32_t const PrologueSize = encoding::alignedSize<uint32_t>(sizeof(TRI_df_prologue_marker_t));
|
||||
static uint32_t const PrologueSize = encoding::alignedSize<uint32_t>(sizeof(MMFilesPrologueMarker));
|
||||
|
||||
/// @brief create the slots
|
||||
MMFilesWalSlots::MMFilesWalSlots(MMFilesLogfileManager* logfileManager, size_t numberOfSlots,
|
||||
|
@ -428,8 +428,8 @@ void MMFilesWalSlots::returnSyncRegion(MMFilesWalSyncRegion const& region) {
|
|||
_lastCommittedTick = tick;
|
||||
|
||||
// update the data tick
|
||||
TRI_df_marker_t const* m =
|
||||
static_cast<TRI_df_marker_t const*>(slot->mem());
|
||||
MMFilesMarker const* m =
|
||||
static_cast<MMFilesMarker const*>(slot->mem());
|
||||
if (m->getType() != TRI_DF_MARKER_HEADER &&
|
||||
m->getType() != TRI_DF_MARKER_FOOTER) {
|
||||
_lastCommittedDataTick = tick;
|
||||
|
@ -609,7 +609,7 @@ int MMFilesWalSlots::closeLogfile(MMFilesWalSlot::TickType& lastCommittedTick, b
|
|||
int MMFilesWalSlots::writeHeader(MMFilesWalSlot* slot) {
|
||||
TRI_ASSERT(_logfile != nullptr);
|
||||
|
||||
TRI_df_header_marker_t header = MMFilesDatafileHelper::CreateHeaderMarker(
|
||||
MMFilesDatafileHeaderMarker header = MMFilesDatafileHelper::CreateHeaderMarker(
|
||||
static_cast<TRI_voc_size_t>(_logfile->allocatedSize()),
|
||||
static_cast<TRI_voc_fid_t>(_logfile->id())
|
||||
);
|
||||
|
@ -631,7 +631,7 @@ int MMFilesWalSlots::writeHeader(MMFilesWalSlot* slot) {
|
|||
|
||||
/// @brief write a prologue marker
|
||||
int MMFilesWalSlots::writePrologue(MMFilesWalSlot* slot, void* mem, TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
TRI_df_prologue_marker_t header = MMFilesDatafileHelper::CreatePrologueMarker(databaseId, collectionId);
|
||||
MMFilesPrologueMarker header = MMFilesDatafileHelper::CreatePrologueMarker(databaseId, collectionId);
|
||||
size_t const size = header.base.getSize();
|
||||
|
||||
TRI_ASSERT(size == PrologueSize);
|
||||
|
@ -649,7 +649,7 @@ int MMFilesWalSlots::writePrologue(MMFilesWalSlot* slot, void* mem, TRI_voc_tick
|
|||
int MMFilesWalSlots::writeFooter(MMFilesWalSlot* slot) {
|
||||
TRI_ASSERT(_logfile != nullptr);
|
||||
|
||||
TRI_df_footer_marker_t footer = MMFilesDatafileHelper::CreateFooterMarker();
|
||||
MMFilesDatafileFooterMarker footer = MMFilesDatafileHelper::CreateFooterMarker();
|
||||
size_t const size = footer.base.getSize();
|
||||
|
||||
auto* mem = static_cast<void*>(_logfile->reserve(size));
|
||||
|
|
|
@ -86,8 +86,8 @@ static char const* NameFromCid(MMFilesReplicationDumpContext* dump,
|
|||
}
|
||||
|
||||
/// @brief whether or not a marker should be replicated
|
||||
static inline bool MustReplicateWalMarkerType(TRI_df_marker_t const* marker) {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline bool MustReplicateWalMarkerType(MMFilesMarker const* marker) {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
return (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
|
||||
type == TRI_DF_MARKER_VPACK_REMOVE ||
|
||||
type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
|
@ -102,8 +102,8 @@ static inline bool MustReplicateWalMarkerType(TRI_df_marker_t const* marker) {
|
|||
}
|
||||
|
||||
/// @brief whether or not a marker belongs to a transaction
|
||||
static inline bool IsTransactionWalMarkerType(TRI_df_marker_t const* marker) {
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
static inline bool IsTransactionWalMarkerType(MMFilesMarker const* marker) {
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
return (type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_COMMIT_TRANSACTION ||
|
||||
type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION);
|
||||
|
@ -111,7 +111,7 @@ static inline bool IsTransactionWalMarkerType(TRI_df_marker_t const* marker) {
|
|||
|
||||
/// @brief translate a marker type to a replication type
|
||||
static TRI_replication_operation_e TranslateType(
|
||||
TRI_df_marker_t const* marker) {
|
||||
MMFilesMarker const* marker) {
|
||||
switch (marker->getType()) {
|
||||
case TRI_DF_MARKER_VPACK_DOCUMENT:
|
||||
return REPLICATION_MARKER_DOCUMENT;
|
||||
|
@ -146,10 +146,10 @@ static TRI_replication_operation_e TranslateType(
|
|||
static int StringifyMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId,
|
||||
TRI_df_marker_t const* marker, bool isDump,
|
||||
MMFilesMarker const* marker, bool isDump,
|
||||
bool withTicks, bool isEdgeCollection) {
|
||||
TRI_ASSERT(MustReplicateWalMarkerType(marker));
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
if (!isDump) {
|
||||
// logger-follow command
|
||||
|
@ -302,10 +302,10 @@ static int StringifyMarker(MMFilesReplicationDumpContext* dump,
|
|||
|
||||
static int SliceifyMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
TRI_df_marker_t const* marker, bool isDump,
|
||||
MMFilesMarker const* marker, bool isDump,
|
||||
bool withTicks, bool isEdgeCollection) {
|
||||
TRI_ASSERT(MustReplicateWalMarkerType(marker));
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
VPackBuffer<uint8_t> buffer;
|
||||
std::shared_ptr<VPackBuffer<uint8_t>> bufferPtr;
|
||||
|
@ -427,7 +427,7 @@ static int SliceifyMarker(MMFilesReplicationDumpContext* dump,
|
|||
}
|
||||
/// @brief whether or not a marker belongs to a transaction
|
||||
static bool IsTransactionWalMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_df_marker_t const* marker) {
|
||||
MMFilesMarker const* marker) {
|
||||
// first check the marker type
|
||||
if (!IsTransactionWalMarkerType(marker)) {
|
||||
return false;
|
||||
|
@ -443,7 +443,7 @@ static bool IsTransactionWalMarker(MMFilesReplicationDumpContext* dump,
|
|||
|
||||
/// @brief whether or not a marker is replicated
|
||||
static bool MustReplicateWalMarker(
|
||||
MMFilesReplicationDumpContext* dump, TRI_df_marker_t const* marker,
|
||||
MMFilesReplicationDumpContext* dump, MMFilesMarker const* marker,
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
TRI_voc_tick_t firstRegularTick,
|
||||
std::unordered_set<TRI_voc_tid_t> const& transactionIds) {
|
||||
|
@ -508,7 +508,7 @@ static int DumpCollection(MMFilesReplicationDumpContext* dump,
|
|||
auto callback = [&dump, &lastFoundTick, &databaseId, &collectionId,
|
||||
&withTicks, &isEdgeCollection, &bufferFull, &useVpp,
|
||||
&collection](
|
||||
TRI_voc_tick_t foundTick, TRI_df_marker_t const* marker) {
|
||||
TRI_voc_tick_t foundTick, MMFilesMarker const* marker) {
|
||||
// note the last tick we processed
|
||||
lastFoundTick = foundTick;
|
||||
|
||||
|
@ -538,7 +538,7 @@ static int DumpCollection(MMFilesReplicationDumpContext* dump,
|
|||
};
|
||||
|
||||
try {
|
||||
bool hasMore = collection->getPhysical()->applyForTickRange(dataMin, dataMax, callback);
|
||||
bool hasMore = static_cast<MMFilesCollection*>(collection->getPhysical())->applyForTickRange(dataMin, dataMax, callback);
|
||||
|
||||
if (lastFoundTick > 0) {
|
||||
// data available for requested range
|
||||
|
@ -648,14 +648,14 @@ int MMFilesDumpLogReplication(
|
|||
logfile, ptr, end);
|
||||
|
||||
while (ptr < end) {
|
||||
auto const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
auto const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
|
||||
if (marker->getSize() == 0) {
|
||||
// end of datafile
|
||||
break;
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t type = marker->getType();
|
||||
MMFilesMarkerType type = marker->getType();
|
||||
|
||||
if (type <= TRI_DF_MARKER_MIN || type >= TRI_DF_MARKER_MAX) {
|
||||
break;
|
||||
|
@ -833,14 +833,14 @@ int MMFilesDetermineOpenTransactionsReplication(MMFilesReplicationDumpContext* d
|
|||
|
||||
// LOG_TOPIC(INFO, arangodb::Logger::FIXME) << "scanning logfile " << i;
|
||||
while (ptr < end) {
|
||||
auto const* marker = reinterpret_cast<TRI_df_marker_t const*>(ptr);
|
||||
auto const* marker = reinterpret_cast<MMFilesMarker const*>(ptr);
|
||||
|
||||
if (marker->getSize() == 0) {
|
||||
// end of datafile
|
||||
break;
|
||||
}
|
||||
|
||||
TRI_df_marker_type_t const type = marker->getType();
|
||||
MMFilesMarkerType const type = marker->getType();
|
||||
|
||||
if (type <= TRI_DF_MARKER_MIN || type >= TRI_DF_MARKER_MAX) {
|
||||
// somehow invalid
|
||||
|
|
|
@ -2158,52 +2158,6 @@ static void JS_RevisionVocbaseCol(
|
|||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief was docuBlock collectionRotate
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void JS_RotateVocbaseCol(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
// renaming a collection in a cluster is unsupported
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_CLUSTER_UNSUPPORTED);
|
||||
}
|
||||
|
||||
PREVENT_EMBEDDED_TRANSACTION();
|
||||
|
||||
arangodb::LogicalCollection* collection =
|
||||
TRI_UnwrapClass<arangodb::LogicalCollection>(args.Holder(), WRP_VOCBASE_COL_TYPE);
|
||||
|
||||
if (collection == nullptr) {
|
||||
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
|
||||
}
|
||||
|
||||
TRI_THROW_SHARDING_COLLECTION_NOT_YET_IMPLEMENTED(collection);
|
||||
|
||||
SingleCollectionTransaction trx(
|
||||
transaction::V8Context::Create(collection->vocbase(), true),
|
||||
collection->cid(), AccessMode::Type::READ);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
res = collection->getPhysical()->rotateActiveJournal();
|
||||
|
||||
trx.finish(res);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(res, "could not rotate journal");
|
||||
}
|
||||
|
||||
TRI_V8_RETURN_UNDEFINED();
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief retrieves a collection from a V8 argument
|
||||
|
@ -3071,8 +3025,6 @@ void TRI_InitV8Collections(v8::Handle<v8::Context> context,
|
|||
JS_RenameVocbaseCol);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("replace"),
|
||||
JS_ReplaceVocbaseCol);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("rotate"),
|
||||
JS_RotateVocbaseCol);
|
||||
TRI_AddMethodVocbase(
|
||||
isolate, rt, TRI_V8_ASCII_STRING("save"),
|
||||
JS_InsertVocbaseCol); // note: save is now an alias for insert
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <velocypack/Builder.h>
|
||||
|
||||
struct TRI_df_marker_t;
|
||||
struct MMFilesMarker;
|
||||
|
||||
namespace arangodb {
|
||||
namespace transaction {
|
||||
|
@ -80,14 +80,6 @@ class PhysicalCollection {
|
|||
|
||||
virtual int close() = 0;
|
||||
|
||||
/// @brief rotate the active journal - will do nothing if there is no journal
|
||||
/// REVIEW - MOVE INTO MMFILES?? - used in v8-collection
|
||||
virtual int rotateActiveJournal() = 0;
|
||||
|
||||
/// REVIEW - MOVE INTO MMFILES?? - used in replication-dump
|
||||
virtual bool applyForTickRange(TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMax,
|
||||
std::function<bool(TRI_voc_tick_t foundTick, TRI_df_marker_t const* marker)> const& callback) = 0;
|
||||
|
||||
// @brief Return the number of documents in this collection
|
||||
virtual uint64_t numberDocuments() const = 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* jshint browser: true */
|
||||
/* jshint unused: false */
|
||||
/* global Backbone, $, window, arangoHelper, nv, d3, prettyBytes */
|
||||
/* global document, console, frontendConfig, Dygraph, _,templateEngine*/
|
||||
/* global document, console, frontendConfig, Dygraph, _,templateEngine */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
customQueries: [],
|
||||
cachedQueries: {},
|
||||
queriesHistory: {},
|
||||
graphViewers: [],
|
||||
queries: [],
|
||||
|
||||
|
@ -177,11 +178,13 @@
|
|||
},
|
||||
|
||||
removeResults: function () {
|
||||
var self = this;
|
||||
this.cachedQueries = {};
|
||||
$('.outputEditorWrapper').hide('fast', function () {
|
||||
$('.outputEditorWrapper').remove();
|
||||
this.queriesHistory = {};
|
||||
|
||||
_.each($('.outputEditorWrapper'), function (v) {
|
||||
self.closeAceResults(v.id.replace(/^\D+/g, ''));
|
||||
});
|
||||
$('#removeResults').hide();
|
||||
},
|
||||
|
||||
getCustomQueryParameterByName: function (qName) {
|
||||
|
@ -441,28 +444,25 @@
|
|||
|
||||
// deselect editors
|
||||
this.deselect(ace.edit('outputEditor' + count));
|
||||
this.deselect(ace.edit('sentQueryEditor' + count));
|
||||
this.deselect(ace.edit('sentBindParamEditor' + count));
|
||||
},
|
||||
|
||||
downloadQueryResult: function (e) {
|
||||
var count = $(e.currentTarget).attr('counter');
|
||||
var editor = ace.edit('sentQueryEditor' + count);
|
||||
var query = editor.getValue();
|
||||
var counter = $(e.currentTarget).attr('counter');
|
||||
var query = this.queriesHistory[counter].sentQuery;
|
||||
|
||||
if (query !== '' || query !== undefined || query !== null) {
|
||||
if (query !== '' && query !== undefined && query !== null) {
|
||||
var url;
|
||||
if (Object.keys(this.bindParamTableObj).length === 0) {
|
||||
if (Object.keys(this.queriesHistory[counter].bindParam).length === 0) {
|
||||
url = 'query/result/download/' + encodeURIComponent(btoa(JSON.stringify({ query: query })));
|
||||
} else {
|
||||
url = 'query/result/download/' + encodeURIComponent(btoa(JSON.stringify({
|
||||
query: query,
|
||||
bindVars: this.bindParamTableObj
|
||||
bindVars: this.queriesHistory[counter].bindParam
|
||||
})));
|
||||
}
|
||||
arangoHelper.download(url);
|
||||
} else {
|
||||
arangoHelper.arangoError('Query error', 'could not query result.');
|
||||
arangoHelper.arangoError('Query error', 'Could not download the result.');
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -480,32 +480,23 @@
|
|||
|
||||
var counter = this.outputCounter;
|
||||
var outputEditor = ace.edit('outputEditor' + counter);
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
var sentBindParamEditor = ace.edit('sentBindParamEditor' + counter);
|
||||
|
||||
sentQueryEditor.getSession().setMode('ace/mode/aql');
|
||||
sentQueryEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
sentQueryEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentQueryEditor);
|
||||
|
||||
outputEditor.setReadOnly(true);
|
||||
outputEditor.getSession().setMode('ace/mode/json');
|
||||
outputEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
this.setEditorAutoHeight(outputEditor);
|
||||
|
||||
sentBindParamEditor.setValue(JSON.stringify(this.bindParamTableObj), 1);
|
||||
sentBindParamEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
sentBindParamEditor.getSession().setMode('ace/mode/json');
|
||||
sentBindParamEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentBindParamEditor);
|
||||
// Store sent query and bindParameter
|
||||
this.queriesHistory[counter] = {
|
||||
sentQuery: this.aqlEditor.getValue(),
|
||||
bindParam: this.bindParamTableObj
|
||||
};
|
||||
|
||||
this.fillExplain(outputEditor, sentQueryEditor, counter);
|
||||
this.fillExplain(outputEditor, counter);
|
||||
this.outputCounter++;
|
||||
},
|
||||
|
||||
fillExplain: function (outputEditor, sentQueryEditor, counter) {
|
||||
sentQueryEditor.setValue(this.aqlEditor.getValue(), 1);
|
||||
|
||||
fillExplain: function (outputEditor, counter) {
|
||||
var self = this;
|
||||
var queryData = this.readQueryData();
|
||||
|
||||
|
@ -648,21 +639,42 @@
|
|||
}
|
||||
},
|
||||
|
||||
closeAceResults: function (counter, target) {
|
||||
var self = this;
|
||||
ace.edit('outputEditor' + counter).destroy();
|
||||
$('#outputEditorWrapper' + this.outputCounter).hide();
|
||||
|
||||
var cleanup = function (target) {
|
||||
$(target).hide('fast', function () {
|
||||
// remove dom
|
||||
$(target).remove();
|
||||
if ($('.outputEditorWrapper').length === 0) {
|
||||
self.cachedQueries = {};
|
||||
$('#removeResults').hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (target) {
|
||||
cleanup(target);
|
||||
} else {
|
||||
_.each($('#outputEditors').children(), function (elem) {
|
||||
cleanup(elem);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
closeResult: function (e) {
|
||||
var self = this;
|
||||
var target = $('#' + $(e.currentTarget).attr('element')).parent();
|
||||
var id = $(target).attr('id');
|
||||
var counter = id.substring(id.length - 1, id.length - 0);
|
||||
var counter = id.replace(/^\D+/g, '');
|
||||
|
||||
// remove unused ace editor instances
|
||||
self.closeAceResults(counter, target);
|
||||
|
||||
delete this.cachedQueries[counter];
|
||||
|
||||
$(target).hide('fast', function () {
|
||||
$(target).remove();
|
||||
if ($('.outputEditorWrapper').length === 0) {
|
||||
self.cachedQueries = {};
|
||||
$('#removeResults').hide();
|
||||
}
|
||||
});
|
||||
delete this.queriesHistory[counter];
|
||||
},
|
||||
|
||||
fillSelectBoxes: function () {
|
||||
|
@ -738,7 +750,6 @@
|
|||
_.each(this.cachedQueries, function (query, counter) {
|
||||
self.renderQueryResultBox(counter, null, true);
|
||||
self.renderQueryResult(query, counter, true);
|
||||
self.fillSentQueryValue(counter);
|
||||
|
||||
if (query.sentQuery) {
|
||||
self.bindQueryResultButtons(null, counter);
|
||||
|
@ -748,11 +759,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
fillSentQueryValue: function (counter) {
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
sentQueryEditor.setValue(this.cachedQueries[counter].sentQuery, 1);
|
||||
},
|
||||
|
||||
showSpotlight: function (type) {
|
||||
var callback, cancelCallback;
|
||||
|
||||
|
@ -1097,11 +1103,13 @@
|
|||
|
||||
// init aql editor
|
||||
this.aqlEditor = ace.edit('aqlEditor');
|
||||
this.aqlEditor.$blockScrolling = Infinity;
|
||||
this.aqlEditor.getSession().setMode('ace/mode/aql');
|
||||
this.aqlEditor.setFontSize('10pt');
|
||||
this.aqlEditor.setShowPrintMargin(false);
|
||||
|
||||
this.bindParamAceEditor = ace.edit('bindParamAceEditor');
|
||||
this.bindParamAceEditor.$blockScrolling = Infinity;
|
||||
this.bindParamAceEditor.getSession().setMode('ace/mode/json');
|
||||
this.bindParamAceEditor.setFontSize('10pt');
|
||||
this.bindParamAceEditor.setShowPrintMargin(false);
|
||||
|
@ -1560,29 +1568,24 @@
|
|||
}));
|
||||
|
||||
var outputEditor = ace.edit('outputEditor' + counter);
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
var sentBindParamEditor = ace.edit('sentBindParamEditor' + counter);
|
||||
|
||||
sentQueryEditor.getSession().setMode('ace/mode/aql');
|
||||
sentQueryEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
sentQueryEditor.setFontSize('13px');
|
||||
sentQueryEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentQueryEditor);
|
||||
// store query and bind parameters history
|
||||
|
||||
outputEditor.setFontSize('13px');
|
||||
outputEditor.$blockScrolling = Infinity;
|
||||
outputEditor.getSession().setMode('ace/mode/json');
|
||||
outputEditor.setReadOnly(true);
|
||||
outputEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
outputEditor.setShowPrintMargin(false);
|
||||
this.setEditorAutoHeight(outputEditor);
|
||||
|
||||
sentBindParamEditor.setValue(JSON.stringify(this.bindParamTableObj), 1);
|
||||
sentBindParamEditor.setOption('vScrollBarAlwaysVisible', true);
|
||||
sentBindParamEditor.getSession().setMode('ace/mode/json');
|
||||
sentBindParamEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentBindParamEditor);
|
||||
|
||||
if (!cached) {
|
||||
// Store sent query and bindParameter
|
||||
this.queriesHistory[counter] = {
|
||||
sentQuery: this.aqlEditor.getValue(),
|
||||
bindParam: this.bindParamTableObj
|
||||
};
|
||||
|
||||
this.fillResult(counter, selected);
|
||||
this.outputCounter++;
|
||||
}
|
||||
|
@ -1641,9 +1644,6 @@
|
|||
}
|
||||
|
||||
if (queryData) {
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
sentQueryEditor.setValue(self.aqlEditor.getValue(), 1);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: arangoHelper.databaseUrl('/_api/cursor'),
|
||||
|
@ -1742,7 +1742,6 @@
|
|||
if (!data.msg) {
|
||||
// handle usual query
|
||||
var result = self.analyseQuery(data.result);
|
||||
// console.log('Using ' + result.defaultType + ' as data format.');
|
||||
if (result.defaultType === 'table') {
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after(
|
||||
'<div id="outputTable' + counter + '" class="outputTable"></div>'
|
||||
|
@ -1914,8 +1913,9 @@
|
|||
self.toggleQueries();
|
||||
}
|
||||
|
||||
var aql = ace.edit('sentQueryEditor' + counter).getValue();
|
||||
var bindParam = JSON.parse(ace.edit('sentBindParamEditor' + counter).getValue());
|
||||
var aql = self.queriesHistory[counter].sentQuery;
|
||||
var bindParam = self.queriesHistory[counter].bindParam;
|
||||
|
||||
self.aqlEditor.setValue(aql, 1);
|
||||
self.deselect(self.aqlEditor);
|
||||
if (Object.keys(bindParam).length > 0) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -83,7 +83,8 @@ function versionJsonJson() {
|
|||
expect(obj).to.have.property('license');
|
||||
|
||||
expect(obj.server).to.be('arango');
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.+devel/);
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.([0-9]+|(milestone|alpha|beta|devel|rc)[0-9]*)/);
|
||||
|
||||
expect(obj.license).to.match(/enterprise|community/g);
|
||||
};
|
||||
|
||||
|
@ -108,7 +109,7 @@ function versionVpackJson() {
|
|||
expect(obj).to.have.property('license');
|
||||
|
||||
expect(obj.server).to.be('arango');
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.+devel/);
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.([0-9]+|(milestone|alpha|beta|devel|rc)[0-9]*)/);
|
||||
expect(obj.license).to.match(/enterprise|community/g);
|
||||
};
|
||||
|
||||
|
@ -133,7 +134,7 @@ function versionJsonVpack () {
|
|||
expect(obj).to.have.property('license');
|
||||
|
||||
expect(obj.server).to.be('arango');
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.+devel/);
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.([0-9]+|(milestone|alpha|beta|devel|rc)[0-9]*)/);
|
||||
expect(obj.license).to.match(/enterprise|community/g);
|
||||
};
|
||||
|
||||
|
@ -158,11 +159,10 @@ function versionVpackVpack () {
|
|||
expect(obj).to.have.property('license');
|
||||
|
||||
expect(obj.server).to.be('arango');
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.+devel/);
|
||||
expect(obj.version).to.match(/[0-9]+\.[0-9]+\.([0-9]+|(milestone|alpha|beta|devel|rc)[0-9]*)/);
|
||||
expect(obj.license).to.match(/enterprise|community/g);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function echoVpackVpack () {
|
||||
|
@ -179,13 +179,8 @@ function echoVpackVpack () {
|
|||
expect(res).to.be.a(request.Response);
|
||||
expect(res.body).to.be.a('string');
|
||||
expect(Number(res.headers['content-length'])).to.equal(res.rawBody.length);
|
||||
//var obj = JSON.parse(res.body);
|
||||
//print_vpack_as_json(res.body);
|
||||
//expect(VPACK_TO_V8().to.equal();
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -52,8 +52,8 @@ TEST_CASE("CStructureSizeTest", "[structure-size]") {
|
|||
|
||||
SECTION("tst_basic_elements") {
|
||||
CHECK(4 == (int) sizeof(TRI_col_type_e));
|
||||
CHECK(1 == (int) sizeof(TRI_df_marker_type_t));
|
||||
CHECK(4 == (int) sizeof(TRI_df_version_t));
|
||||
CHECK(1 == (int) sizeof(MMFilesMarkerType));
|
||||
CHECK(4 == (int) sizeof(MMFilesDatafileVersionType));
|
||||
CHECK(8 == (int) sizeof(TRI_voc_cid_t));
|
||||
CHECK(4 == (int) sizeof(TRI_voc_crc_t));
|
||||
CHECK(8 == (int) sizeof(TRI_voc_tid_t));
|
||||
|
@ -63,13 +63,13 @@ SECTION("tst_basic_elements") {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test sizeof TRI_df_marker_t
|
||||
/// @brief test sizeof MMFilesMarker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SECTION("tst_df_marker") {
|
||||
size_t s = sizeof(TRI_df_marker_t);
|
||||
size_t s = sizeof(MMFilesMarker);
|
||||
|
||||
TRI_df_marker_t m;
|
||||
MMFilesMarker m;
|
||||
CHECK(16 == (int) s);
|
||||
CHECK(s % 8 == 0);
|
||||
|
||||
|
@ -79,56 +79,56 @@ SECTION("tst_df_marker") {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test sizeof TRI_df_header_marker_t
|
||||
/// @brief test sizeof MMFilesDatafileHeaderMarker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SECTION("tst_df_header_marker") {
|
||||
size_t s = sizeof(TRI_df_header_marker_t);
|
||||
size_t s = sizeof(MMFilesDatafileHeaderMarker);
|
||||
|
||||
CHECK(16 + 16 == (int) s);
|
||||
CHECK(s % 8 == 0);
|
||||
|
||||
CHECK(16 == (int) offsetOf(&TRI_df_header_marker_t::_version));
|
||||
CHECK(20 == (int) offsetOf(&TRI_df_header_marker_t::_maximalSize));
|
||||
CHECK(24 == (int) offsetOf(&TRI_df_header_marker_t::_fid));
|
||||
CHECK(16 == (int) offsetOf(&MMFilesDatafileHeaderMarker::_version));
|
||||
CHECK(20 == (int) offsetOf(&MMFilesDatafileHeaderMarker::_maximalSize));
|
||||
CHECK(24 == (int) offsetOf(&MMFilesDatafileHeaderMarker::_fid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test sizeof TRI_df_footer_marker_t
|
||||
/// @brief test sizeof MMFilesDatafileFooterMarker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SECTION("tst_df_footer_marker") {
|
||||
size_t s = sizeof(TRI_df_footer_marker_t);
|
||||
size_t s = sizeof(MMFilesDatafileFooterMarker);
|
||||
|
||||
CHECK(16 == (int) s);
|
||||
CHECK(s % 8 == 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test sizeof TRI_col_header_marker_t
|
||||
/// @brief test sizeof MMFilesCollectionHeaderMarker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SECTION("tst_col_header_marker") {
|
||||
size_t s = sizeof(TRI_col_header_marker_t);
|
||||
size_t s = sizeof(MMFilesCollectionHeaderMarker);
|
||||
|
||||
CHECK(16 + 8 == (int) s); // base + own size
|
||||
CHECK(s % 8 == 0);
|
||||
|
||||
CHECK(16 == (int) offsetOf(&TRI_col_header_marker_t::_cid));
|
||||
CHECK(16 == (int) offsetOf(&MMFilesCollectionHeaderMarker::_cid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test sizeof TRI_df_prologue_marker_t
|
||||
/// @brief test sizeof MMFilesPrologueMarker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SECTION("tst_df_prologue_marker") {
|
||||
size_t s = sizeof(TRI_df_prologue_marker_t);
|
||||
size_t s = sizeof(MMFilesPrologueMarker);
|
||||
|
||||
CHECK(16 + 16 == (int) s);
|
||||
CHECK(s % 8 == 0);
|
||||
|
||||
CHECK(16 == (int) offsetOf(&TRI_df_prologue_marker_t::_databaseId));
|
||||
CHECK(24 == (int) offsetOf(&TRI_df_prologue_marker_t::_collectionId));
|
||||
CHECK(16 == (int) offsetOf(&MMFilesPrologueMarker::_databaseId));
|
||||
CHECK(24 == (int) offsetOf(&MMFilesPrologueMarker::_collectionId));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue