1
0
Fork 0

move replication-dump into engine

This commit is contained in:
jsteemann 2017-03-21 13:55:57 +01:00
parent 93423ba273
commit 7fb536387d
25 changed files with 82 additions and 131 deletions

View File

@ -340,7 +340,6 @@ SET(ARANGOD_SOURCES
VocBase/modes.cpp VocBase/modes.cpp
VocBase/replication-applier.cpp VocBase/replication-applier.cpp
VocBase/replication-common.cpp VocBase/replication-common.cpp
VocBase/replication-dump.cpp
VocBase/ticks.cpp VocBase/ticks.cpp
VocBase/vocbase.cpp VocBase/vocbase.cpp
Pregel/AggregatorHandler.cpp Pregel/AggregatorHandler.cpp
@ -373,12 +372,12 @@ SET(ARANGOD_SOURCES
# add sources for mmfiles engine # add sources for mmfiles engine
set(ARANGOD_SOURCES set(ARANGOD_SOURCES
${ARANGOD_SOURCES} ${ARANGOD_SOURCES}
MMFiles/fulltext-handles.cpp MMFiles/mmfiles-fulltext-handles.cpp
MMFiles/fulltext-index.cpp MMFiles/mmfiles-fulltext-index.cpp
MMFiles/fulltext-list.cpp MMFiles/mmfiles-fulltext-list.cpp
MMFiles/fulltext-query.cpp MMFiles/mmfiles-fulltext-query.cpp
MMFiles/fulltext-result.cpp MMFiles/mmfiles-fulltext-result.cpp
MMFiles/geo-index.cpp MMFiles/mmfiles-geo-index.cpp
MMFiles/MMFilesAllocatorThread.cpp MMFiles/MMFilesAllocatorThread.cpp
MMFiles/MMFilesAqlFunctions.cpp MMFiles/MMFilesAqlFunctions.cpp
MMFiles/MMFilesCleanupThread.cpp MMFiles/MMFilesCleanupThread.cpp
@ -423,6 +422,7 @@ set(ARANGOD_SOURCES
MMFiles/MMFilesWalRecoveryFeature.cpp MMFiles/MMFilesWalRecoveryFeature.cpp
MMFiles/MMFilesWalSlot.cpp MMFiles/MMFilesWalSlot.cpp
MMFiles/MMFilesWalSlots.cpp MMFiles/MMFilesWalSlots.cpp
MMFiles/mmfiles-replication-dump.cpp
) )
if (NOT MSVC) if (NOT MSVC)

View File

@ -2167,11 +2167,11 @@ std::unique_ptr<LogicalCollection>
ClusterMethods::createCollectionOnCoordinator(TRI_col_type_e collectionType, ClusterMethods::createCollectionOnCoordinator(TRI_col_type_e collectionType,
TRI_vocbase_t* vocbase, TRI_vocbase_t* vocbase,
VPackSlice parameters) { VPackSlice parameters) {
auto col = std::make_unique<LogicalCollection>(vocbase, parameters); auto col = std::make_unique<LogicalCollection>(vocbase, parameters);
// Collection is a temporary collection object that undergoes sanity checks etc. // Collection is a temporary collection object that undergoes sanity checks etc.
// It is not used anywhere and will be cleaned up after this call. // It is not used anywhere and will be cleaned up after this call.
// Persist collection will return the real object. // Persist collection will return the real object.
return persistCollectionInAgency(col.get()); return persistCollectionInAgency(col.get());
} }
#endif #endif

View File

@ -25,11 +25,11 @@
#include "Aql/Function.h" #include "Aql/Function.h"
#include "Aql/AqlFunctionFeature.h" #include "Aql/AqlFunctionFeature.h"
#include "MMFiles/fulltext-index.h"
#include "MMFiles/fulltext-query.h"
#include "MMFiles/fulltext-result.h"
#include "MMFiles/MMFilesFulltextIndex.h" #include "MMFiles/MMFilesFulltextIndex.h"
#include "MMFiles/MMFilesGeoIndex.h" #include "MMFiles/MMFilesGeoIndex.h"
#include "MMFiles/mmfiles-fulltext-index.h"
#include "MMFiles/mmfiles-fulltext-query.h"
#include "MMFiles/mmfiles-fulltext-result.h"
#include "StorageEngine/DocumentIdentifierToken.h" #include "StorageEngine/DocumentIdentifierToken.h"
#include "Utils/CollectionNameResolver.h" #include "Utils/CollectionNameResolver.h"
#include "Transaction/Helpers.h" #include "Transaction/Helpers.h"

View File

@ -26,8 +26,8 @@
#include "Basics/Utf8Helper.h" #include "Basics/Utf8Helper.h"
#include "Basics/VelocyPackHelper.h" #include "Basics/VelocyPackHelper.h"
#include "Logger/Logger.h" #include "Logger/Logger.h"
#include "MMFiles/fulltext-index.h"
#include "MMFiles/MMFilesToken.h" #include "MMFiles/MMFilesToken.h"
#include "MMFiles/mmfiles-fulltext-index.h"
#include "StorageEngine/DocumentIdentifierToken.h" #include "StorageEngine/DocumentIdentifierToken.h"
#include "StorageEngine/TransactionState.h" #include "StorageEngine/TransactionState.h"

View File

@ -26,7 +26,7 @@
#include "Basics/Common.h" #include "Basics/Common.h"
#include "Indexes/Index.h" #include "Indexes/Index.h"
#include "MMFiles/fulltext-common.h" #include "MMFiles/mmfiles-fulltext-common.h"
#include "VocBase/vocbase.h" #include "VocBase/vocbase.h"
#include "VocBase/voc-types.h" #include "VocBase/voc-types.h"

View File

@ -27,7 +27,7 @@
#include "Basics/Common.h" #include "Basics/Common.h"
#include "Indexes/Index.h" #include "Indexes/Index.h"
#include "Indexes/IndexIterator.h" #include "Indexes/IndexIterator.h"
#include "MMFiles/geo-index.h" #include "MMFiles/mmfiles-geo-index.h"
#include "VocBase/vocbase.h" #include "VocBase/vocbase.h"
#include "VocBase/voc-types.h" #include "VocBase/voc-types.h"

View File

@ -29,7 +29,6 @@
#include "Cluster/ServerState.h" #include "Cluster/ServerState.h"
#include "Indexes/Index.h" #include "Indexes/Index.h"
#include "MMFiles/fulltext-index.h"
#include "MMFiles/MMFilesEdgeIndex.h" #include "MMFiles/MMFilesEdgeIndex.h"
#include "MMFiles/MMFilesFulltextIndex.h" #include "MMFiles/MMFilesFulltextIndex.h"
#include "MMFiles/MMFilesGeoIndex.h" #include "MMFiles/MMFilesGeoIndex.h"
@ -37,6 +36,7 @@
#include "MMFiles/MMFilesPersistentIndex.h" #include "MMFiles/MMFilesPersistentIndex.h"
#include "MMFiles/MMFilesPrimaryIndex.h" #include "MMFiles/MMFilesPrimaryIndex.h"
#include "MMFiles/MMFilesSkiplistIndex.h" #include "MMFiles/MMFilesSkiplistIndex.h"
#include "MMFiles/mmfiles-fulltext-index.h"
#include "VocBase/voc-types.h" #include "VocBase/voc-types.h"
#include <velocypack/Builder.h> #include <velocypack/Builder.h>

View File

@ -21,8 +21,8 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_COMMON_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_COMMON_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_COMMON_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_COMMON_H 1
#include "Basics/Common.h" #include "Basics/Common.h"

View File

@ -21,7 +21,7 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "fulltext-handles.h" #include "mmfiles-fulltext-handles.h"
#include "MMFiles/MMFilesToken.h" #include "MMFiles/MMFilesToken.h"

View File

@ -21,10 +21,10 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_HANDLES_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_HANDLES_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_HANDLES_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_HANDLES_H 1
#include "fulltext-common.h" #include "mmfiles-fulltext-common.h"
#include "VocBase/voc-types.h" #include "VocBase/voc-types.h"
/// @brief typedef for a fulltext handle entry /// @brief typedef for a fulltext handle entry

View File

@ -21,15 +21,15 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "fulltext-index.h" #include "mmfiles-fulltext-index.h"
#include "Basics/locks.h" #include "Basics/locks.h"
#include "Basics/Exceptions.h" #include "Basics/Exceptions.h"
#include "Logger/Logger.h" #include "Logger/Logger.h"
#include "MMFiles/fulltext-handles.h" #include "MMFiles/mmfiles-fulltext-handles.h"
#include "MMFiles/fulltext-list.h" #include "MMFiles/mmfiles-fulltext-list.h"
#include "MMFiles/fulltext-query.h" #include "MMFiles/mmfiles-fulltext-query.h"
#include "MMFiles/fulltext-result.h" #include "MMFiles/mmfiles-fulltext-result.h"
#include "StorageEngine/DocumentIdentifierToken.h" #include "StorageEngine/DocumentIdentifierToken.h"
/// @brief use padding for pointers in binary data /// @brief use padding for pointers in binary data

View File

@ -21,10 +21,10 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_INDEX_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_INDEX_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_INDEX_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_INDEX_H 1
#include "fulltext-common.h" #include "mmfiles-fulltext-common.h"
#include "VocBase/voc-types.h" #include "VocBase/voc-types.h"

View File

@ -21,7 +21,7 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "fulltext-list.h" #include "mmfiles-fulltext-list.h"
/// @brief we'll set this bit (the highest of a uint32_t) if the list is sorted /// @brief we'll set this bit (the highest of a uint32_t) if the list is sorted
/// if the list is not sorted, this bit is cleared /// if the list is not sorted, this bit is cleared

View File

@ -21,10 +21,10 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_LIST_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_LIST_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_LIST_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_LIST_H 1
#include "fulltext-common.h" #include "mmfiles-fulltext-common.h"
/// @brief typedef for a fulltext list /// @brief typedef for a fulltext list
typedef void TRI_fulltext_list_t; typedef void TRI_fulltext_list_t;

View File

@ -21,10 +21,10 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "fulltext-query.h" #include "mmfiles-fulltext-query.h"
#include "Basics/tri-strings.h" #include "Basics/tri-strings.h"
#include "Basics/Utf8Helper.h" #include "Basics/Utf8Helper.h"
#include "MMFiles/fulltext-index.h" #include "MMFiles/mmfiles-fulltext-index.h"
/// @brief normalize a word for a fulltext search query /// @brief normalize a word for a fulltext search query
static TRI_fulltext_query_operation_e ParseOperation(char c) { static TRI_fulltext_query_operation_e ParseOperation(char c) {

View File

@ -21,8 +21,8 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_QUERY_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_QUERY_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_QUERY_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_QUERY_H 1
#include "Basics/Common.h" #include "Basics/Common.h"

View File

@ -21,8 +21,7 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "fulltext-result.h" #include "mmfiles-fulltext-result.h"
#include "StorageEngine/DocumentIdentifierToken.h" #include "StorageEngine/DocumentIdentifierToken.h"
/// @brief create a result /// @brief create a result

View File

@ -21,10 +21,10 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_RESULT_H #ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_RESULT_H
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_RESULT_H 1 #define ARANGOD_MMFILES_MMFILES_FULLTEXT_RESULT_H 1
#include "fulltext-common.h" #include "mmfiles-fulltext-common.h"
// Forward declarations // Forward declarations
namespace arangodb { namespace arangodb {

View File

@ -26,7 +26,7 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
#include "geo-index.h" #include "mmfiles-geo-index.h"
/* Radius of the earth used for distances */ /* Radius of the earth used for distances */
#define EARTHRADIAN 6371000.0 #define EARTHRADIAN 6371000.0

View File

@ -24,8 +24,8 @@
/* GeoIdx.h - header file for GeoIdx algorithms */ /* GeoIdx.h - header file for GeoIdx algorithms */
/* Version 2.2 25.11.2015 R. A. Parker */ /* Version 2.2 25.11.2015 R. A. Parker */
#ifndef ARANGOD_GEO_INDEX_GEO_INDEX_H #ifndef ARANGOD_MMFILES_MMFILES_GEO_INDEX_H
#define ARANGOD_GEO_INDEX_GEO_INDEX_H 1 #define ARANGOD_MMFILES_MMFILES_GEO_INDEX_H 1
#include "Basics/Common.h" #include "Basics/Common.h"

View File

@ -21,13 +21,13 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "replication-dump.h" #include "mmfiles-replication-dump.h"
#include "Basics/ReadLocker.h" #include "Basics/ReadLocker.h"
#include "Basics/StaticStrings.h" #include "Basics/StaticStrings.h"
#include "Basics/StringRef.h" #include "Basics/StringRef.h"
#include "Basics/VPackStringBufferAdapter.h" #include "Basics/VPackStringBufferAdapter.h"
#include "Logger/Logger.h" #include "Logger/Logger.h"
#include "MMFiles/MMFilesLogfileManager.h" //TODO -- remove #include "MMFiles/MMFilesLogfileManager.h"
#include "MMFiles/MMFilesCompactionLocker.h" #include "MMFiles/MMFilesCompactionLocker.h"
#include "MMFiles/MMFilesDitch.h" #include "MMFiles/MMFilesDitch.h"
#include "VocBase/LogicalCollection.h" #include "VocBase/LogicalCollection.h"
@ -40,11 +40,8 @@
using namespace arangodb; using namespace arangodb;
////////////////////////////////////////////////////////////////////////////////
/// @brief append values to a string buffer /// @brief append values to a string buffer
//////////////////////////////////////////////////////////////////////////////// static void Append(MMFilesReplicationDumpContext* dump, uint64_t value) {
static void Append(TRI_replication_dump_t* dump, uint64_t value) {
int res = TRI_AppendUInt64StringBuffer(dump->_buffer, value); int res = TRI_AppendUInt64StringBuffer(dump->_buffer, value);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
@ -52,7 +49,7 @@ static void Append(TRI_replication_dump_t* dump, uint64_t value) {
} }
} }
static void Append(TRI_replication_dump_t* dump, char const* value) { static void Append(MMFilesReplicationDumpContext* dump, char const* value) {
int res = TRI_AppendStringStringBuffer(dump->_buffer, value); int res = TRI_AppendStringStringBuffer(dump->_buffer, value);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
@ -60,11 +57,8 @@ static void Append(TRI_replication_dump_t* dump, char const* value) {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief translate a (local) collection id into a collection name /// @brief translate a (local) collection id into a collection name
//////////////////////////////////////////////////////////////////////////////// static char const* NameFromCid(MMFilesReplicationDumpContext* dump,
static char const* NameFromCid(TRI_replication_dump_t* dump,
TRI_voc_cid_t cid) { TRI_voc_cid_t cid) {
auto it = dump->_collectionNames.find(cid); auto it = dump->_collectionNames.find(cid);
@ -91,10 +85,7 @@ static char const* NameFromCid(TRI_replication_dump_t* dump,
return nullptr; return nullptr;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a marker should be replicated /// @brief whether or not a marker should be replicated
////////////////////////////////////////////////////////////////////////////////
static inline bool MustReplicateWalMarkerType(TRI_df_marker_t const* marker) { static inline bool MustReplicateWalMarkerType(TRI_df_marker_t const* marker) {
TRI_df_marker_type_t type = marker->getType(); TRI_df_marker_type_t type = marker->getType();
return (type == TRI_DF_MARKER_VPACK_DOCUMENT || return (type == TRI_DF_MARKER_VPACK_DOCUMENT ||
@ -110,10 +101,7 @@ static inline bool MustReplicateWalMarkerType(TRI_df_marker_t const* marker) {
type == TRI_DF_MARKER_VPACK_DROP_INDEX); type == TRI_DF_MARKER_VPACK_DROP_INDEX);
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a marker belongs to a transaction /// @brief whether or not a marker belongs to a transaction
////////////////////////////////////////////////////////////////////////////////
static inline bool IsTransactionWalMarkerType(TRI_df_marker_t const* marker) { static inline bool IsTransactionWalMarkerType(TRI_df_marker_t const* marker) {
TRI_df_marker_type_t type = marker->getType(); TRI_df_marker_type_t type = marker->getType();
return (type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION || return (type == TRI_DF_MARKER_VPACK_BEGIN_TRANSACTION ||
@ -121,10 +109,7 @@ static inline bool IsTransactionWalMarkerType(TRI_df_marker_t const* marker) {
type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION); type == TRI_DF_MARKER_VPACK_ABORT_TRANSACTION);
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief translate a marker type to a replication type /// @brief translate a marker type to a replication type
////////////////////////////////////////////////////////////////////////////////
static TRI_replication_operation_e TranslateType( static TRI_replication_operation_e TranslateType(
TRI_df_marker_t const* marker) { TRI_df_marker_t const* marker) {
switch (marker->getType()) { switch (marker->getType()) {
@ -156,12 +141,9 @@ static TRI_replication_operation_e TranslateType(
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief stringify a raw marker from a logfile for a log dump or logger /// @brief stringify a raw marker from a logfile for a log dump or logger
/// follow command /// follow command
//////////////////////////////////////////////////////////////////////////////// static int StringifyMarker(MMFilesReplicationDumpContext* dump,
static int StringifyMarker(TRI_replication_dump_t* dump,
TRI_voc_tick_t databaseId, TRI_voc_tick_t databaseId,
TRI_voc_cid_t collectionId, TRI_voc_cid_t collectionId,
TRI_df_marker_t const* marker, bool isDump, TRI_df_marker_t const* marker, bool isDump,
@ -318,7 +300,7 @@ static int StringifyMarker(TRI_replication_dump_t* dump,
return TRI_ERROR_NO_ERROR; return TRI_ERROR_NO_ERROR;
} }
static int SliceifyMarker(TRI_replication_dump_t* dump, static int SliceifyMarker(MMFilesReplicationDumpContext* dump,
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId, TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
TRI_df_marker_t const* marker, bool isDump, TRI_df_marker_t const* marker, bool isDump,
bool withTicks, bool isEdgeCollection) { bool withTicks, bool isEdgeCollection) {
@ -443,11 +425,8 @@ static int SliceifyMarker(TRI_replication_dump_t* dump,
return TRI_ERROR_NO_ERROR; return TRI_ERROR_NO_ERROR;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a marker belongs to a transaction /// @brief whether or not a marker belongs to a transaction
//////////////////////////////////////////////////////////////////////////////// static bool IsTransactionWalMarker(MMFilesReplicationDumpContext* dump,
static bool IsTransactionWalMarker(TRI_replication_dump_t* dump,
TRI_df_marker_t const* marker) { TRI_df_marker_t const* marker) {
// first check the marker type // first check the marker type
if (!IsTransactionWalMarkerType(marker)) { if (!IsTransactionWalMarkerType(marker)) {
@ -462,12 +441,9 @@ static bool IsTransactionWalMarker(TRI_replication_dump_t* dump,
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a marker is replicated /// @brief whether or not a marker is replicated
////////////////////////////////////////////////////////////////////////////////
static bool MustReplicateWalMarker( static bool MustReplicateWalMarker(
TRI_replication_dump_t* dump, TRI_df_marker_t const* marker, MMFilesReplicationDumpContext* dump, TRI_df_marker_t const* marker,
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId, TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
TRI_voc_tick_t firstRegularTick, TRI_voc_tick_t firstRegularTick,
std::unordered_set<TRI_voc_tid_t> const& transactionIds) { std::unordered_set<TRI_voc_tid_t> const& transactionIds) {
@ -514,11 +490,8 @@ static bool MustReplicateWalMarker(
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief dump data from a collection /// @brief dump data from a collection
//////////////////////////////////////////////////////////////////////////////// static int DumpCollection(MMFilesReplicationDumpContext* dump,
static int DumpCollection(TRI_replication_dump_t* dump,
LogicalCollection* collection, LogicalCollection* collection,
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId, TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMax, TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMax,
@ -592,11 +565,8 @@ static int DumpCollection(TRI_replication_dump_t* dump,
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief dump data from a collection /// @brief dump data from a collection
//////////////////////////////////////////////////////////////////////////////// int MMFilesDumpCollectionReplication(MMFilesReplicationDumpContext* dump,
int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
arangodb::LogicalCollection* collection, arangodb::LogicalCollection* collection,
TRI_voc_tick_t dataMin, TRI_voc_tick_t dataMin,
TRI_voc_tick_t dataMax, bool withTicks) { TRI_voc_tick_t dataMax, bool withTicks) {
@ -634,12 +604,9 @@ int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
return res; return res;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief dump data from the replication log /// @brief dump data from the replication log
//////////////////////////////////////////////////////////////////////////////// int MMFilesDumpLogReplication(
MMFilesReplicationDumpContext* dump,
int TRI_DumpLogReplication(
TRI_replication_dump_t* dump,
std::unordered_set<TRI_voc_tid_t> const& transactionIds, std::unordered_set<TRI_voc_tid_t> const& transactionIds,
TRI_voc_tick_t firstRegularTick, TRI_voc_tick_t tickMin, TRI_voc_tick_t firstRegularTick, TRI_voc_tick_t tickMin,
TRI_voc_tick_t tickMax, bool outputAsArray) { TRI_voc_tick_t tickMax, bool outputAsArray) {
@ -831,11 +798,8 @@ int TRI_DumpLogReplication(
return res; return res;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief determine the transactions that were open at a given point in time /// @brief determine the transactions that were open at a given point in time
//////////////////////////////////////////////////////////////////////////////// int MMFilesDetermineOpenTransactionsReplication(MMFilesReplicationDumpContext* dump,
int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t* dump,
TRI_voc_tick_t tickMin, TRI_voc_tick_t tickMin,
TRI_voc_tick_t tickMax, TRI_voc_tick_t tickMax,
bool useVpp) { bool useVpp) {

View File

@ -21,8 +21,8 @@
/// @author Jan Steemann /// @author Jan Steemann
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_VOC_BASE_REPLICATION_DUMP_H #ifndef ARANGOD_MMFILES_MMFILES_REPLICATION_DUMP_H
#define ARANGOD_VOC_BASE_REPLICATION_DUMP_H 1 #define ARANGOD_MMFILES_MMFILES_REPLICATION_DUMP_H 1
#include "Basics/Common.h" #include "Basics/Common.h"
#include "Basics/Exceptions.h" #include "Basics/Exceptions.h"
@ -40,12 +40,9 @@
#include <vector> #include <vector>
////////////////////////////////////////////////////////////////////////////////
/// @brief replication dump container /// @brief replication dump container
//////////////////////////////////////////////////////////////////////////////// struct MMFilesReplicationDumpContext {
MMFilesReplicationDumpContext(std::shared_ptr<arangodb::transaction::StandaloneContext>
struct TRI_replication_dump_t {
TRI_replication_dump_t(std::shared_ptr<arangodb::transaction::StandaloneContext>
transactionContext, transactionContext,
size_t chunkSize, bool includeSystem, size_t chunkSize, bool includeSystem,
TRI_voc_cid_t restrictCollection, bool useVpp = false) TRI_voc_cid_t restrictCollection, bool useVpp = false)
@ -79,7 +76,7 @@ struct TRI_replication_dump_t {
} }
} }
~TRI_replication_dump_t() { ~MMFilesReplicationDumpContext() {
if (_buffer != nullptr) { if (_buffer != nullptr) {
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer); TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer);
_buffer = nullptr; _buffer = nullptr;
@ -104,28 +101,19 @@ struct TRI_replication_dump_t {
bool _useVpp; bool _useVpp;
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief dump data from a single collection /// @brief dump data from a single collection
//////////////////////////////////////////////////////////////////////////////// int MMFilesDumpCollectionReplication(MMFilesReplicationDumpContext*,
int TRI_DumpCollectionReplication(TRI_replication_dump_t*,
arangodb::LogicalCollection*, TRI_voc_tick_t, arangodb::LogicalCollection*, TRI_voc_tick_t,
TRI_voc_tick_t, bool); TRI_voc_tick_t, bool);
////////////////////////////////////////////////////////////////////////////////
/// @brief dump data from the replication log /// @brief dump data from the replication log
//////////////////////////////////////////////////////////////////////////////// int MMFilesDumpLogReplication(MMFilesReplicationDumpContext*,
int TRI_DumpLogReplication(TRI_replication_dump_t*,
std::unordered_set<TRI_voc_tid_t> const&, std::unordered_set<TRI_voc_tid_t> const&,
TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t,
bool); bool);
////////////////////////////////////////////////////////////////////////////////
/// @brief determine the transactions that were open at a given point in time /// @brief determine the transactions that were open at a given point in time
//////////////////////////////////////////////////////////////////////////////// int MMFilesDetermineOpenTransactionsReplication(MMFilesReplicationDumpContext*,
int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t*,
TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t,
bool useVpp = false); bool useVpp = false);

View File

@ -35,6 +35,7 @@
#include "Indexes/Index.h" #include "Indexes/Index.h"
#include "Logger/Logger.h" #include "Logger/Logger.h"
#include "MMFiles/MMFilesLogfileManager.h" #include "MMFiles/MMFilesLogfileManager.h"
#include "MMFiles/mmfiles-replication-dump.h"
#include "Replication/InitialSyncer.h" #include "Replication/InitialSyncer.h"
#include "Rest/HttpRequest.h" #include "Rest/HttpRequest.h"
#include "Rest/Version.h" #include "Rest/Version.h"
@ -53,7 +54,6 @@
#include "VocBase/LogicalCollection.h" #include "VocBase/LogicalCollection.h"
#include "VocBase/PhysicalCollection.h" #include "VocBase/PhysicalCollection.h"
#include "VocBase/replication-applier.h" #include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/ticks.h" #include "VocBase/ticks.h"
#include <velocypack/Builder.h> #include <velocypack/Builder.h>
@ -966,12 +966,12 @@ void RestReplicationHandler::handleCommandLoggerFollow() {
std::make_shared<transaction::StandaloneContext>(_vocbase); std::make_shared<transaction::StandaloneContext>(_vocbase);
// initialize the dump container // initialize the dump container
TRI_replication_dump_t dump(transactionContext, MMFilesReplicationDumpContext dump(transactionContext,
static_cast<size_t>(determineChunkSize()), static_cast<size_t>(determineChunkSize()),
includeSystem, cid, useVpp); includeSystem, cid, useVpp);
// and dump // and dump
int res = TRI_DumpLogReplication(&dump, transactionIds, firstRegularTick, int res = MMFilesDumpLogReplication(&dump, transactionIds, firstRegularTick,
tickStart, tickEnd, false); tickStart, tickEnd, false);
if (res == TRI_ERROR_NO_ERROR) { if (res == TRI_ERROR_NO_ERROR) {
@ -1070,11 +1070,11 @@ void RestReplicationHandler::handleCommandDetermineOpenTransactions() {
std::make_shared<transaction::StandaloneContext>(_vocbase); std::make_shared<transaction::StandaloneContext>(_vocbase);
// initialize the dump container // initialize the dump container
TRI_replication_dump_t dump( MMFilesReplicationDumpContext dump(
transactionContext, static_cast<size_t>(determineChunkSize()), false, 0); transactionContext, static_cast<size_t>(determineChunkSize()), false, 0);
// and dump // and dump
int res = TRI_DetermineOpenTransactionsReplication(&dump, tickStart, tickEnd); int res = MMFilesDetermineOpenTransactionsReplication(&dump, tickStart, tickEnd);
if (res == TRI_ERROR_NO_ERROR) { if (res == TRI_ERROR_NO_ERROR) {
// generate the result // generate the result
@ -2692,7 +2692,7 @@ void RestReplicationHandler::handleCommandDump() {
std::make_shared<transaction::StandaloneContext>(_vocbase); std::make_shared<transaction::StandaloneContext>(_vocbase);
// initialize the dump container // initialize the dump container
TRI_replication_dump_t dump(transactionContext, MMFilesReplicationDumpContext dump(transactionContext,
static_cast<size_t>(determineChunkSize()), static_cast<size_t>(determineChunkSize()),
includeSystem, 0); includeSystem, 0);
@ -2701,7 +2701,7 @@ void RestReplicationHandler::handleCommandDump() {
} }
int res = int res =
TRI_DumpCollectionReplication(&dump, col, tickStart, tickEnd, withTicks); MMFilesDumpCollectionReplication(&dump, col, tickStart, tickEnd, withTicks);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
THROW_ARANGO_EXCEPTION(res); THROW_ARANGO_EXCEPTION(res);

View File

@ -25,6 +25,8 @@
#include "Basics/ReadLocker.h" #include "Basics/ReadLocker.h"
#include "Cluster/ClusterComm.h" #include "Cluster/ClusterComm.h"
#include "Cluster/ClusterFeature.h" #include "Cluster/ClusterFeature.h"
#include "MMFiles/MMFilesLogfileManager.h"
#include "MMFiles/mmfiles-replication-dump.h"
#include "Replication/InitialSyncer.h" #include "Replication/InitialSyncer.h"
#include "Rest/Version.h" #include "Rest/Version.h"
#include "RestServer/ServerIdFeature.h" #include "RestServer/ServerIdFeature.h"
@ -33,8 +35,6 @@
#include "V8/v8-utils.h" #include "V8/v8-utils.h"
#include "V8/v8-vpack.h" #include "V8/v8-vpack.h"
#include "V8Server/v8-vocbaseprivate.h" #include "V8Server/v8-vocbaseprivate.h"
#include "VocBase/replication-dump.h"
#include "MMFiles/MMFilesLogfileManager.h"
#include <velocypack/Builder.h> #include <velocypack/Builder.h>
#include <velocypack/Parser.h> #include <velocypack/Parser.h>
@ -165,11 +165,11 @@ static void JS_LastLoggerReplication(
auto transactionContext = std::make_shared<transaction::StandaloneContext>(vocbase); auto transactionContext = std::make_shared<transaction::StandaloneContext>(vocbase);
TRI_replication_dump_t dump(transactionContext, 0, true, 0); MMFilesReplicationDumpContext dump(transactionContext, 0, true, 0);
TRI_voc_tick_t tickStart = TRI_ObjectToUInt64(args[0], true); TRI_voc_tick_t tickStart = TRI_ObjectToUInt64(args[0], true);
TRI_voc_tick_t tickEnd = TRI_ObjectToUInt64(args[1], true); TRI_voc_tick_t tickEnd = TRI_ObjectToUInt64(args[1], true);
int res = TRI_DumpLogReplication(&dump, std::unordered_set<TRI_voc_tid_t>(), int res = MMFilesDumpLogReplication(&dump, std::unordered_set<TRI_voc_tid_t>(),
0, tickStart, tickEnd, true); 0, tickStart, tickEnd, true);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {

View File

@ -42,7 +42,7 @@
#include "catch.hpp" #include "catch.hpp"
#include "MMFiles/geo-index.h" #include "MMFiles/mmfiles-geo-index.h"
#include "Basics/StringUtils.h" #include "Basics/StringUtils.h"
using namespace arangodb::basics; using namespace arangodb::basics;