diff --git a/arangod/Utils/Transaction.h b/arangod/Utils/Transaction.h index 2a911778f5..8a255a018a 100644 --- a/arangod/Utils/Transaction.h +++ b/arangod/Utils/Transaction.h @@ -157,18 +157,6 @@ namespace triagens { return (_nestingLevel > 0); } -//////////////////////////////////////////////////////////////////////////////// -/// @brief whether or not shaped json in this trx should be copied -//////////////////////////////////////////////////////////////////////////////// - - inline bool mustCopyShapedJson () const { - if (_trx != nullptr && _trx->_hasOperations) { - return true; - } - - return false; - } - //////////////////////////////////////////////////////////////////////////////// /// @brief get the status of the transaction //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 4c6530e629..e4c094f900 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -9645,15 +9645,16 @@ v8::Handle TRI_WrapShapedJson (T& trx, v8::Isolate* isolate = v8::Isolate::GetCurrent(); TRI_v8_global_t* v8g = static_cast(isolate->GetData()); - bool doCopy = trx.mustCopyShapedJson(); - + void const* marker = document->getDataPtr(); + bool const doCopy = TRI_IsWalDataMarkerDatafile(marker); + if (doCopy) { // we'll create a full copy of the document TRI_document_collection_t* collection = trx.documentCollection(); TRI_shaper_t* shaper = collection->getShaper(); TRI_shaped_json_t json; - TRI_EXTRACT_SHAPED_JSON_MARKER(json, document->getDataPtr()); // PROTECTED by trx from above + TRI_EXTRACT_SHAPED_JSON_MARKER(json, marker); // PROTECTED by trx from above TRI_shape_t const* shape = shaper->lookupShapeId(shaper, json._sid); @@ -9692,7 +9693,7 @@ v8::Handle TRI_WrapShapedJson (T& trx, return scope.Close(result); } - void* data = const_cast(document->getDataPtr()); // PROTECTED by trx from above + void* data = const_cast(marker); // PROTECTED by trx from above // point the 0 index Field to the c++ pointer for unwrapping later result->SetInternalField(SLOT_CLASS_TYPE, v8::Integer::New(WRP_SHAPED_JSON_TYPE)); diff --git a/arangod/VocBase/datafile.h b/arangod/VocBase/datafile.h index c46f1517c4..5022823b2d 100644 --- a/arangod/VocBase/datafile.h +++ b/arangod/VocBase/datafile.h @@ -608,6 +608,16 @@ void TRI_FreeDatafile (TRI_datafile_t*); // --SECTION-- public functions // ----------------------------------------------------------------------------- +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if a marker is a data marker in the WAL +//////////////////////////////////////////////////////////////////////////////// + +static inline bool TRI_IsWalDataMarkerDatafile (void const* marker) { + TRI_df_marker_t const* m = static_cast(marker); + + return (m->_type == TRI_WAL_MARKER_DOCUMENT || m->_type == TRI_WAL_MARKER_EDGE); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief returns the name for a marker ////////////////////////////////////////////////////////////////////////////////