1
0
Fork 0

Merge branch 'mjmh' of ssh://github.com/triAGENS/ArangoDB into mjmh

This commit is contained in:
Max Neunhoeffer 2014-06-12 10:39:13 +02:00
commit ed1a588baa
3 changed files with 17 additions and 17 deletions

View File

@ -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
////////////////////////////////////////////////////////////////////////////////

View File

@ -9640,20 +9640,22 @@ v8::Handle<v8::Value> 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<TRI_v8_global_t*>(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<v8::Value> TRI_WrapShapedJson (T& trx,
return scope.Close(result);
}
void* data = const_cast<void*>(document->getDataPtr()); // PROTECTED by trx from above
void* data = const_cast<void*>(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));

View File

@ -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<TRI_df_marker_t const*>(marker);
return (m->_type == TRI_WAL_MARKER_DOCUMENT || m->_type == TRI_WAL_MARKER_EDGE);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the name for a marker
////////////////////////////////////////////////////////////////////////////////