diff --git a/arangod/Utils/Transaction.h b/arangod/Utils/Transaction.h index 8e00833125..5b73562eda 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 a14a9cacf5..4201fb9fb8 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -9640,20 +9640,22 @@ v8::Handle TRI_WrapShapedJson (T& trx, TRI_ASSERT(barrier != nullptr); TRI_ASSERT(document != nullptr); - TRI_ASSERT(document->getDataPtr() != nullptr); // PROTECTED by trx from above v8::Isolate* isolate = v8::Isolate::GetCurrent(); TRI_v8_global_t* v8g = static_cast(isolate->GetData()); - bool doCopy = trx.mustCopyShapedJson(); - + void const* marker = document->getDataPtr(); + TRI_ASSERT(marker != nullptr); // PROTECTED by trx from above + + 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(); // PROTECTED by trx from above 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 +9694,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 ////////////////////////////////////////////////////////////////////////////////