1
0
Fork 0

copy WAL documents

This commit is contained in:
Jan Steemann 2014-06-12 10:26:24 +02:00
parent 89f6070e01
commit 1cc46c4626
3 changed files with 15 additions and 16 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

@ -9645,15 +9645,16 @@ v8::Handle<v8::Value> TRI_WrapShapedJson (T& trx,
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();
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<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
////////////////////////////////////////////////////////////////////////////////