mirror of https://gitee.com/bigwinds/arangodb
move replication-dump into engine
This commit is contained in:
parent
93423ba273
commit
7fb536387d
|
@ -340,7 +340,6 @@ SET(ARANGOD_SOURCES
|
|||
VocBase/modes.cpp
|
||||
VocBase/replication-applier.cpp
|
||||
VocBase/replication-common.cpp
|
||||
VocBase/replication-dump.cpp
|
||||
VocBase/ticks.cpp
|
||||
VocBase/vocbase.cpp
|
||||
Pregel/AggregatorHandler.cpp
|
||||
|
@ -373,12 +372,12 @@ SET(ARANGOD_SOURCES
|
|||
# add sources for mmfiles engine
|
||||
set(ARANGOD_SOURCES
|
||||
${ARANGOD_SOURCES}
|
||||
MMFiles/fulltext-handles.cpp
|
||||
MMFiles/fulltext-index.cpp
|
||||
MMFiles/fulltext-list.cpp
|
||||
MMFiles/fulltext-query.cpp
|
||||
MMFiles/fulltext-result.cpp
|
||||
MMFiles/geo-index.cpp
|
||||
MMFiles/mmfiles-fulltext-handles.cpp
|
||||
MMFiles/mmfiles-fulltext-index.cpp
|
||||
MMFiles/mmfiles-fulltext-list.cpp
|
||||
MMFiles/mmfiles-fulltext-query.cpp
|
||||
MMFiles/mmfiles-fulltext-result.cpp
|
||||
MMFiles/mmfiles-geo-index.cpp
|
||||
MMFiles/MMFilesAllocatorThread.cpp
|
||||
MMFiles/MMFilesAqlFunctions.cpp
|
||||
MMFiles/MMFilesCleanupThread.cpp
|
||||
|
@ -423,6 +422,7 @@ set(ARANGOD_SOURCES
|
|||
MMFiles/MMFilesWalRecoveryFeature.cpp
|
||||
MMFiles/MMFilesWalSlot.cpp
|
||||
MMFiles/MMFilesWalSlots.cpp
|
||||
MMFiles/mmfiles-replication-dump.cpp
|
||||
)
|
||||
|
||||
if (NOT MSVC)
|
||||
|
|
|
@ -2167,11 +2167,11 @@ std::unique_ptr<LogicalCollection>
|
|||
ClusterMethods::createCollectionOnCoordinator(TRI_col_type_e collectionType,
|
||||
TRI_vocbase_t* vocbase,
|
||||
VPackSlice parameters) {
|
||||
auto col = std::make_unique<LogicalCollection>(vocbase, parameters);
|
||||
// Collection is a temporary collection object that undergoes sanity checks etc.
|
||||
// It is not used anywhere and will be cleaned up after this call.
|
||||
// Persist collection will return the real object.
|
||||
return persistCollectionInAgency(col.get());
|
||||
auto col = std::make_unique<LogicalCollection>(vocbase, parameters);
|
||||
// Collection is a temporary collection object that undergoes sanity checks etc.
|
||||
// It is not used anywhere and will be cleaned up after this call.
|
||||
// Persist collection will return the real object.
|
||||
return persistCollectionInAgency(col.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
#include "Aql/Function.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/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 "Utils/CollectionNameResolver.h"
|
||||
#include "Transaction/Helpers.h"
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "Basics/Utf8Helper.h"
|
||||
#include "Basics/VelocyPackHelper.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/fulltext-index.h"
|
||||
#include "MMFiles/MMFilesToken.h"
|
||||
#include "MMFiles/mmfiles-fulltext-index.h"
|
||||
#include "StorageEngine/DocumentIdentifierToken.h"
|
||||
#include "StorageEngine/TransactionState.h"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "Basics/Common.h"
|
||||
#include "Indexes/Index.h"
|
||||
#include "MMFiles/fulltext-common.h"
|
||||
#include "MMFiles/mmfiles-fulltext-common.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "Basics/Common.h"
|
||||
#include "Indexes/Index.h"
|
||||
#include "Indexes/IndexIterator.h"
|
||||
#include "MMFiles/geo-index.h"
|
||||
#include "MMFiles/mmfiles-geo-index.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "Cluster/ServerState.h"
|
||||
#include "Indexes/Index.h"
|
||||
#include "MMFiles/fulltext-index.h"
|
||||
#include "MMFiles/MMFilesEdgeIndex.h"
|
||||
#include "MMFiles/MMFilesFulltextIndex.h"
|
||||
#include "MMFiles/MMFilesGeoIndex.h"
|
||||
|
@ -37,6 +36,7 @@
|
|||
#include "MMFiles/MMFilesPersistentIndex.h"
|
||||
#include "MMFiles/MMFilesPrimaryIndex.h"
|
||||
#include "MMFiles/MMFilesSkiplistIndex.h"
|
||||
#include "MMFiles/mmfiles-fulltext-index.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
#include <velocypack/Builder.h>
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_COMMON_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_COMMON_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_COMMON_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_COMMON_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fulltext-handles.h"
|
||||
#include "mmfiles-fulltext-handles.h"
|
||||
|
||||
#include "MMFiles/MMFilesToken.h"
|
||||
|
|
@ -21,10 +21,10 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_HANDLES_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_HANDLES_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_HANDLES_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_HANDLES_H 1
|
||||
|
||||
#include "fulltext-common.h"
|
||||
#include "mmfiles-fulltext-common.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
/// @brief typedef for a fulltext handle entry
|
|
@ -21,15 +21,15 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fulltext-index.h"
|
||||
#include "mmfiles-fulltext-index.h"
|
||||
|
||||
#include "Basics/locks.h"
|
||||
#include "Basics/Exceptions.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/fulltext-handles.h"
|
||||
#include "MMFiles/fulltext-list.h"
|
||||
#include "MMFiles/fulltext-query.h"
|
||||
#include "MMFiles/fulltext-result.h"
|
||||
#include "MMFiles/mmfiles-fulltext-handles.h"
|
||||
#include "MMFiles/mmfiles-fulltext-list.h"
|
||||
#include "MMFiles/mmfiles-fulltext-query.h"
|
||||
#include "MMFiles/mmfiles-fulltext-result.h"
|
||||
#include "StorageEngine/DocumentIdentifierToken.h"
|
||||
|
||||
/// @brief use padding for pointers in binary data
|
|
@ -21,10 +21,10 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_INDEX_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_INDEX_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_INDEX_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_INDEX_H 1
|
||||
|
||||
#include "fulltext-common.h"
|
||||
#include "mmfiles-fulltext-common.h"
|
||||
|
||||
#include "VocBase/voc-types.h"
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
/// @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
|
||||
/// if the list is not sorted, this bit is cleared
|
|
@ -21,10 +21,10 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_LIST_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_LIST_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_LIST_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_LIST_H 1
|
||||
|
||||
#include "fulltext-common.h"
|
||||
#include "mmfiles-fulltext-common.h"
|
||||
|
||||
/// @brief typedef for a fulltext list
|
||||
typedef void TRI_fulltext_list_t;
|
|
@ -21,10 +21,10 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fulltext-query.h"
|
||||
#include "mmfiles-fulltext-query.h"
|
||||
#include "Basics/tri-strings.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
|
||||
static TRI_fulltext_query_operation_e ParseOperation(char c) {
|
|
@ -21,8 +21,8 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_QUERY_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_QUERY_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_QUERY_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_QUERY_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
|
|
@ -21,8 +21,7 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fulltext-result.h"
|
||||
|
||||
#include "mmfiles-fulltext-result.h"
|
||||
#include "StorageEngine/DocumentIdentifierToken.h"
|
||||
|
||||
/// @brief create a result
|
|
@ -21,10 +21,10 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_FULLTEXT_INDEX_FULLTEXT_RESULT_H
|
||||
#define ARANGOD_FULLTEXT_INDEX_FULLTEXT_RESULT_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_FULLTEXT_RESULT_H
|
||||
#define ARANGOD_MMFILES_MMFILES_FULLTEXT_RESULT_H 1
|
||||
|
||||
#include "fulltext-common.h"
|
||||
#include "mmfiles-fulltext-common.h"
|
||||
|
||||
// Forward declarations
|
||||
namespace arangodb {
|
|
@ -26,7 +26,7 @@
|
|||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#include "geo-index.h"
|
||||
#include "mmfiles-geo-index.h"
|
||||
|
||||
/* Radius of the earth used for distances */
|
||||
#define EARTHRADIAN 6371000.0
|
|
@ -24,8 +24,8 @@
|
|||
/* GeoIdx.h - header file for GeoIdx algorithms */
|
||||
/* Version 2.2 25.11.2015 R. A. Parker */
|
||||
|
||||
#ifndef ARANGOD_GEO_INDEX_GEO_INDEX_H
|
||||
#define ARANGOD_GEO_INDEX_GEO_INDEX_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_GEO_INDEX_H
|
||||
#define ARANGOD_MMFILES_MMFILES_GEO_INDEX_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
|
|
@ -21,13 +21,13 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "replication-dump.h"
|
||||
#include "mmfiles-replication-dump.h"
|
||||
#include "Basics/ReadLocker.h"
|
||||
#include "Basics/StaticStrings.h"
|
||||
#include "Basics/StringRef.h"
|
||||
#include "Basics/VPackStringBufferAdapter.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h" //TODO -- remove
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/MMFilesCompactionLocker.h"
|
||||
#include "MMFiles/MMFilesDitch.h"
|
||||
#include "VocBase/LogicalCollection.h"
|
||||
|
@ -40,11 +40,8 @@
|
|||
|
||||
using namespace arangodb;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief append values to a string buffer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Append(TRI_replication_dump_t* dump, uint64_t value) {
|
||||
static void Append(MMFilesReplicationDumpContext* dump, uint64_t value) {
|
||||
int res = TRI_AppendUInt64StringBuffer(dump->_buffer, value);
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static char const* NameFromCid(TRI_replication_dump_t* dump,
|
||||
static char const* NameFromCid(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_cid_t cid) {
|
||||
auto it = dump->_collectionNames.find(cid);
|
||||
|
||||
|
@ -91,10 +85,7 @@ static char const* NameFromCid(TRI_replication_dump_t* dump,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @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();
|
||||
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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @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();
|
||||
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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief translate a marker type to a replication type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_replication_operation_e TranslateType(
|
||||
TRI_df_marker_t const* marker) {
|
||||
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
|
||||
/// follow command
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int StringifyMarker(TRI_replication_dump_t* dump,
|
||||
static int StringifyMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId,
|
||||
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;
|
||||
}
|
||||
|
||||
static int SliceifyMarker(TRI_replication_dump_t* dump,
|
||||
static int SliceifyMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
TRI_df_marker_t const* marker, bool isDump,
|
||||
bool withTicks, bool isEdgeCollection) {
|
||||
|
@ -443,11 +425,8 @@ static int SliceifyMarker(TRI_replication_dump_t* dump,
|
|||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not a marker belongs to a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool IsTransactionWalMarker(TRI_replication_dump_t* dump,
|
||||
static bool IsTransactionWalMarker(MMFilesReplicationDumpContext* dump,
|
||||
TRI_df_marker_t const* marker) {
|
||||
// first check the marker type
|
||||
if (!IsTransactionWalMarkerType(marker)) {
|
||||
|
@ -462,12 +441,9 @@ static bool IsTransactionWalMarker(TRI_replication_dump_t* dump,
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not a marker is replicated
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 firstRegularTick,
|
||||
std::unordered_set<TRI_voc_tid_t> const& transactionIds) {
|
||||
|
@ -514,11 +490,8 @@ static bool MustReplicateWalMarker(
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief dump data from a collection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int DumpCollection(TRI_replication_dump_t* dump,
|
||||
static int DumpCollection(MMFilesReplicationDumpContext* dump,
|
||||
LogicalCollection* collection,
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
|
||||
int MMFilesDumpCollectionReplication(MMFilesReplicationDumpContext* dump,
|
||||
arangodb::LogicalCollection* collection,
|
||||
TRI_voc_tick_t dataMin,
|
||||
TRI_voc_tick_t dataMax, bool withTicks) {
|
||||
|
@ -634,12 +604,9 @@ int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
|
|||
return res;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief dump data from the replication log
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DumpLogReplication(
|
||||
TRI_replication_dump_t* dump,
|
||||
int MMFilesDumpLogReplication(
|
||||
MMFilesReplicationDumpContext* dump,
|
||||
std::unordered_set<TRI_voc_tid_t> const& transactionIds,
|
||||
TRI_voc_tick_t firstRegularTick, TRI_voc_tick_t tickMin,
|
||||
TRI_voc_tick_t tickMax, bool outputAsArray) {
|
||||
|
@ -831,11 +798,8 @@ int TRI_DumpLogReplication(
|
|||
return res;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief determine the transactions that were open at a given point in time
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t* dump,
|
||||
int MMFilesDetermineOpenTransactionsReplication(MMFilesReplicationDumpContext* dump,
|
||||
TRI_voc_tick_t tickMin,
|
||||
TRI_voc_tick_t tickMax,
|
||||
bool useVpp) {
|
|
@ -21,8 +21,8 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_VOC_BASE_REPLICATION_DUMP_H
|
||||
#define ARANGOD_VOC_BASE_REPLICATION_DUMP_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_REPLICATION_DUMP_H
|
||||
#define ARANGOD_MMFILES_MMFILES_REPLICATION_DUMP_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "Basics/Exceptions.h"
|
||||
|
@ -40,12 +40,9 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief replication dump container
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_replication_dump_t {
|
||||
TRI_replication_dump_t(std::shared_ptr<arangodb::transaction::StandaloneContext>
|
||||
struct MMFilesReplicationDumpContext {
|
||||
MMFilesReplicationDumpContext(std::shared_ptr<arangodb::transaction::StandaloneContext>
|
||||
transactionContext,
|
||||
size_t chunkSize, bool includeSystem,
|
||||
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) {
|
||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer);
|
||||
_buffer = nullptr;
|
||||
|
@ -104,28 +101,19 @@ struct TRI_replication_dump_t {
|
|||
bool _useVpp;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief dump data from a single collection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DumpCollectionReplication(TRI_replication_dump_t*,
|
||||
int MMFilesDumpCollectionReplication(MMFilesReplicationDumpContext*,
|
||||
arangodb::LogicalCollection*, TRI_voc_tick_t,
|
||||
TRI_voc_tick_t, bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief dump data from the replication log
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DumpLogReplication(TRI_replication_dump_t*,
|
||||
int MMFilesDumpLogReplication(MMFilesReplicationDumpContext*,
|
||||
std::unordered_set<TRI_voc_tid_t> const&,
|
||||
TRI_voc_tick_t, TRI_voc_tick_t, TRI_voc_tick_t,
|
||||
bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief determine the transactions that were open at a given point in time
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t*,
|
||||
int MMFilesDetermineOpenTransactionsReplication(MMFilesReplicationDumpContext*,
|
||||
TRI_voc_tick_t, TRI_voc_tick_t,
|
||||
bool useVpp = false);
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
#include "Indexes/Index.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/mmfiles-replication-dump.h"
|
||||
#include "Replication/InitialSyncer.h"
|
||||
#include "Rest/HttpRequest.h"
|
||||
#include "Rest/Version.h"
|
||||
|
@ -53,7 +54,6 @@
|
|||
#include "VocBase/LogicalCollection.h"
|
||||
#include "VocBase/PhysicalCollection.h"
|
||||
#include "VocBase/replication-applier.h"
|
||||
#include "VocBase/replication-dump.h"
|
||||
#include "VocBase/ticks.h"
|
||||
|
||||
#include <velocypack/Builder.h>
|
||||
|
@ -966,12 +966,12 @@ void RestReplicationHandler::handleCommandLoggerFollow() {
|
|||
std::make_shared<transaction::StandaloneContext>(_vocbase);
|
||||
|
||||
// initialize the dump container
|
||||
TRI_replication_dump_t dump(transactionContext,
|
||||
MMFilesReplicationDumpContext dump(transactionContext,
|
||||
static_cast<size_t>(determineChunkSize()),
|
||||
includeSystem, cid, useVpp);
|
||||
|
||||
// and dump
|
||||
int res = TRI_DumpLogReplication(&dump, transactionIds, firstRegularTick,
|
||||
int res = MMFilesDumpLogReplication(&dump, transactionIds, firstRegularTick,
|
||||
tickStart, tickEnd, false);
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
|
@ -1070,11 +1070,11 @@ void RestReplicationHandler::handleCommandDetermineOpenTransactions() {
|
|||
std::make_shared<transaction::StandaloneContext>(_vocbase);
|
||||
|
||||
// initialize the dump container
|
||||
TRI_replication_dump_t dump(
|
||||
MMFilesReplicationDumpContext dump(
|
||||
transactionContext, static_cast<size_t>(determineChunkSize()), false, 0);
|
||||
|
||||
// and dump
|
||||
int res = TRI_DetermineOpenTransactionsReplication(&dump, tickStart, tickEnd);
|
||||
int res = MMFilesDetermineOpenTransactionsReplication(&dump, tickStart, tickEnd);
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
// generate the result
|
||||
|
@ -2692,7 +2692,7 @@ void RestReplicationHandler::handleCommandDump() {
|
|||
std::make_shared<transaction::StandaloneContext>(_vocbase);
|
||||
|
||||
// initialize the dump container
|
||||
TRI_replication_dump_t dump(transactionContext,
|
||||
MMFilesReplicationDumpContext dump(transactionContext,
|
||||
static_cast<size_t>(determineChunkSize()),
|
||||
includeSystem, 0);
|
||||
|
||||
|
@ -2701,7 +2701,7 @@ void RestReplicationHandler::handleCommandDump() {
|
|||
}
|
||||
|
||||
int res =
|
||||
TRI_DumpCollectionReplication(&dump, col, tickStart, tickEnd, withTicks);
|
||||
MMFilesDumpCollectionReplication(&dump, col, tickStart, tickEnd, withTicks);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "Basics/ReadLocker.h"
|
||||
#include "Cluster/ClusterComm.h"
|
||||
#include "Cluster/ClusterFeature.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/mmfiles-replication-dump.h"
|
||||
#include "Replication/InitialSyncer.h"
|
||||
#include "Rest/Version.h"
|
||||
#include "RestServer/ServerIdFeature.h"
|
||||
|
@ -33,8 +35,6 @@
|
|||
#include "V8/v8-utils.h"
|
||||
#include "V8/v8-vpack.h"
|
||||
#include "V8Server/v8-vocbaseprivate.h"
|
||||
#include "VocBase/replication-dump.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
|
||||
#include <velocypack/Builder.h>
|
||||
#include <velocypack/Parser.h>
|
||||
|
@ -165,11 +165,11 @@ static void JS_LastLoggerReplication(
|
|||
|
||||
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 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);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "MMFiles/geo-index.h"
|
||||
#include "MMFiles/mmfiles-geo-index.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
|
||||
using namespace arangodb::basics;
|
||||
|
|
Loading…
Reference in New Issue