mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
e490c34324
|
@ -109,7 +109,7 @@ static void AttachCollectionHint (TRI_aql_context_t* const context,
|
|||
|
||||
hint->_collection = collection;
|
||||
|
||||
availableIndexes = &(((TRI_document_collection_t*) collection->_collection->_collection)->_indexes);
|
||||
availableIndexes = &(((TRI_document_collection_t*) collection->_collection->_collection)->_secondaryIndexes);
|
||||
|
||||
if (availableIndexes == NULL) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
|
|
|
@ -517,11 +517,11 @@ bool RestDocumentHandler::readAllDocuments () {
|
|||
|
||||
ReadTransaction trx(&ca);
|
||||
|
||||
const TRI_document_collection_t* sim = (TRI_document_collection_t*) trx.primary();
|
||||
const TRI_primary_collection_t* primary = trx.primary();
|
||||
|
||||
if (0 < sim->_primaryIndex._nrUsed) {
|
||||
void** ptr = sim->_primaryIndex._table;
|
||||
void** end = sim->_primaryIndex._table + sim->_primaryIndex._nrAlloc;
|
||||
if (0 < primary->_primaryIndex._nrUsed) {
|
||||
void** ptr = primary->_primaryIndex._table;
|
||||
void** end = ptr + primary->_primaryIndex._nrAlloc;
|
||||
|
||||
for (; ptr < end; ++ptr) {
|
||||
if (*ptr) {
|
||||
|
|
|
@ -1648,6 +1648,7 @@ static v8::Handle<v8::Value> AllQuery (TRI_document_collection_t* sim,
|
|||
// extract skip and limit
|
||||
TRI_voc_ssize_t skip;
|
||||
TRI_voc_size_t limit;
|
||||
TRI_primary_collection_t* primary = &sim->base;
|
||||
|
||||
ExtractSkipAndLimit(argv, 0, skip, limit);
|
||||
|
||||
|
@ -1657,15 +1658,15 @@ static v8::Handle<v8::Value> AllQuery (TRI_document_collection_t* sim,
|
|||
v8::Handle<v8::Array> documents = v8::Array::New();
|
||||
result->Set(v8::String::New("documents"), documents);
|
||||
|
||||
size_t total = sim->_primaryIndex._nrUsed;
|
||||
size_t total = primary->_primaryIndex._nrUsed;
|
||||
uint32_t count = 0;
|
||||
bool error = false;
|
||||
|
||||
if (0 < total && 0 < limit) {
|
||||
TRI_barrier_t* barrier = 0;
|
||||
|
||||
void** beg = sim->_primaryIndex._table;
|
||||
void** end = sim->_primaryIndex._table + sim->_primaryIndex._nrAlloc;
|
||||
void** beg = primary->_primaryIndex._table;
|
||||
void** end = beg + primary->_primaryIndex._nrAlloc;
|
||||
void** ptr = beg;
|
||||
|
||||
// skip from the beginning
|
||||
|
|
|
@ -4137,14 +4137,14 @@ static v8::Handle<v8::Value> JS_TruncateVocbaseCol (v8::Arguments const& argv) {
|
|||
|
||||
TRI_vector_pointer_t documents;
|
||||
TRI_InitVectorPointer(&documents, TRI_UNKNOWN_MEM_ZONE);
|
||||
|
||||
primary->beginWrite(collection->_collection);
|
||||
|
||||
TRI_doc_mptr_t const** ptr;
|
||||
TRI_doc_mptr_t const** end;
|
||||
|
||||
ptr = (TRI_doc_mptr_t const**) (sim->_primaryIndex._table);
|
||||
end = (TRI_doc_mptr_t const**) (sim->_primaryIndex._table + sim->_primaryIndex._nrAlloc);
|
||||
primary->beginWrite(collection->_collection);
|
||||
|
||||
ptr = (TRI_doc_mptr_t const**) (primary->_primaryIndex._table);
|
||||
end = (TRI_doc_mptr_t const**) ptr + primary->_primaryIndex._nrAlloc;
|
||||
|
||||
// first, collect all document pointers by traversing the primary index
|
||||
for (; ptr < end; ++ptr) {
|
||||
|
|
|
@ -230,7 +230,6 @@ static TRI_vocbase_auth_t* ConvertAuthInfo (TRI_vocbase_t* vocbase,
|
|||
void TRI_LoadAuthInfo (TRI_vocbase_t* vocbase) {
|
||||
TRI_vocbase_col_t* collection;
|
||||
TRI_primary_collection_t* primary;
|
||||
TRI_document_collection_t* sim;
|
||||
void** beg;
|
||||
void** end;
|
||||
void** ptr;
|
||||
|
@ -259,16 +258,14 @@ void TRI_LoadAuthInfo (TRI_vocbase_t* vocbase) {
|
|||
return;
|
||||
}
|
||||
|
||||
sim = (TRI_document_collection_t*) primary;
|
||||
|
||||
// .............................................................................
|
||||
// inside a read transaction
|
||||
// .............................................................................
|
||||
|
||||
collection->_collection->beginRead(collection->_collection);
|
||||
|
||||
beg = sim->_primaryIndex._table;
|
||||
end = sim->_primaryIndex._table + sim->_primaryIndex._nrAlloc;
|
||||
beg = primary->_primaryIndex._table;
|
||||
end = beg + primary->_primaryIndex._nrAlloc;
|
||||
ptr = beg;
|
||||
|
||||
for (; ptr < end; ++ptr) {
|
||||
|
|
|
@ -209,11 +209,13 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
|
|||
TRI_doc_datafile_info_t* dfi;
|
||||
TRI_doc_mptr_t const* found;
|
||||
TRI_document_collection_t* sim;
|
||||
TRI_primary_collection_t* primary;
|
||||
TRI_voc_fid_t fid;
|
||||
bool deleted;
|
||||
int res;
|
||||
|
||||
sim = data;
|
||||
primary = &sim->base;
|
||||
|
||||
// new or updated document
|
||||
if (marker->_type == TRI_DOC_MARKER_DOCUMENT ||
|
||||
|
@ -236,12 +238,12 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
|
|||
d = (TRI_doc_document_marker_t const*) marker;
|
||||
|
||||
// check if the document is still active
|
||||
TRI_READ_LOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(sim);
|
||||
TRI_READ_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary);
|
||||
|
||||
found = TRI_LookupByKeyAssociativePointer(&sim->_primaryIndex, &d->_did);
|
||||
found = TRI_LookupByKeyAssociativePointer(&primary->_primaryIndex, &d->_did);
|
||||
deleted = found == NULL || found->_deletion != 0;
|
||||
|
||||
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(sim);
|
||||
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary);
|
||||
|
||||
if (deleted) {
|
||||
LOG_TRACE("found a stale document: %lu", d->_did);
|
||||
|
@ -257,24 +259,24 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
|
|||
}
|
||||
|
||||
// check if the document is still active
|
||||
TRI_READ_LOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(sim);
|
||||
TRI_READ_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary);
|
||||
|
||||
found = TRI_LookupByKeyAssociativePointer(&sim->_primaryIndex, &d->_did);
|
||||
found = TRI_LookupByKeyAssociativePointer(&primary->_primaryIndex, &d->_did);
|
||||
deleted = found == NULL || found->_deletion != 0;
|
||||
|
||||
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(sim);
|
||||
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary);
|
||||
|
||||
// update datafile
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(&sim->base, fid);
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(primary, fid);
|
||||
|
||||
if (deleted) {
|
||||
dfi->_numberDead += 1;
|
||||
dfi->_sizeDead += marker->_size - markerSize;
|
||||
|
||||
LOG_DEBUG("found a stale document after copying: %lu", d->_did);
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -287,7 +289,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
|
|||
dfi->_numberAlive += 1;
|
||||
dfi->_sizeAlive += marker->_size - markerSize;
|
||||
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
}
|
||||
|
||||
// deletion
|
||||
|
@ -303,12 +305,12 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
|
|||
}
|
||||
|
||||
// update datafile info
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(&sim->base, fid);
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(primary, fid);
|
||||
dfi->_numberDeletion += 1;
|
||||
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -334,24 +336,27 @@ static void WaitCompactSync (TRI_document_collection_t* collection, TRI_datafile
|
|||
|
||||
static void CompactifyDatafile (TRI_document_collection_t* sim, TRI_voc_fid_t fid) {
|
||||
TRI_datafile_t* df;
|
||||
TRI_primary_collection_t* primary;
|
||||
bool ok;
|
||||
size_t n;
|
||||
size_t i;
|
||||
|
||||
// locate the datafile
|
||||
TRI_READ_LOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
primary = &sim->base;
|
||||
|
||||
n = sim->base.base._datafiles._length;
|
||||
// locate the datafile
|
||||
TRI_READ_LOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
n = primary->base._datafiles._length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
df = sim->base.base._datafiles._buffer[i];
|
||||
df = primary->base._datafiles._buffer[i];
|
||||
|
||||
if (df->_fid == fid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TRI_READ_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_READ_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
if (i == n) {
|
||||
return;
|
||||
|
@ -371,20 +376,20 @@ static void CompactifyDatafile (TRI_document_collection_t* sim, TRI_voc_fid_t fi
|
|||
WaitCompactSync(sim, df);
|
||||
|
||||
// remove the datafile from the list of datafiles
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
n = sim->base.base._datafiles._length;
|
||||
n = primary->base._datafiles._length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
df = sim->base.base._datafiles._buffer[i];
|
||||
df = primary->base._datafiles._buffer[i];
|
||||
|
||||
if (df->_fid == fid) {
|
||||
TRI_RemoveVectorPointer(&sim->base.base._datafiles, i);
|
||||
TRI_RemoveVectorPointer(&primary->base._datafiles, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
if (i == n) {
|
||||
LOG_WARNING("failed to locate the datafile '%lu'", (unsigned long) df->_fid);
|
||||
|
@ -392,7 +397,7 @@ static void CompactifyDatafile (TRI_document_collection_t* sim, TRI_voc_fid_t fi
|
|||
}
|
||||
|
||||
// add a deletion marker to the result set container
|
||||
TRI_CreateBarrierDatafile(&sim->base._barrierList, df, RemoveDatafileCallback, &sim->base.base);
|
||||
TRI_CreateBarrierDatafile(&primary->_barrierList, df, RemoveDatafileCallback, &primary->base);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -400,34 +405,37 @@ static void CompactifyDatafile (TRI_document_collection_t* sim, TRI_voc_fid_t fi
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool CompactifyDocumentCollection (TRI_document_collection_t* sim) {
|
||||
TRI_primary_collection_t* primary;
|
||||
TRI_vector_t vector;
|
||||
size_t n;
|
||||
size_t i;
|
||||
bool worked = false;
|
||||
|
||||
primary = &sim->base;
|
||||
|
||||
// if we cannot acquire the read lock instantly, we will exit directly.
|
||||
// otherwise we'll risk a multi-thread deadlock between synchroniser,
|
||||
// compactor and data-modification threads (e.g. POST /_api/document)
|
||||
if (! TRI_TRY_READ_LOCK_DATAFILES_DOC_COLLECTION(sim)) {
|
||||
if (! TRI_TRY_READ_LOCK_DATAFILES_DOC_COLLECTION(primary)) {
|
||||
return worked;
|
||||
}
|
||||
|
||||
// copy datafile information
|
||||
TRI_InitVector(&vector, TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_doc_datafile_info_t));
|
||||
|
||||
n = sim->base.base._datafiles._length;
|
||||
n = primary->base._datafiles._length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
TRI_datafile_t* df;
|
||||
TRI_doc_datafile_info_t* dfi;
|
||||
|
||||
df = sim->base.base._datafiles._buffer[i];
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(&sim->base, df->_fid);
|
||||
df = primary->base._datafiles._buffer[i];
|
||||
dfi = TRI_FindDatafileInfoPrimaryCollection(primary, df->_fid);
|
||||
|
||||
TRI_PushBackVector(&vector, dfi);
|
||||
}
|
||||
|
||||
TRI_READ_UNLOCK_DATAFILES_DOC_COLLECTION(sim);
|
||||
TRI_READ_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
|
||||
|
||||
// handle datafiles with dead objects
|
||||
for (i = 0; i < vector._length; ++i) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief primary collection with global read-write lock
|
||||
/// @brief document collection with global read-write lock, derived from
|
||||
/// TRI_primary_collection_t
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
|
@ -94,38 +95,6 @@ extern "C" {
|
|||
TRI_LOCK_CHECK_TRACE("write-unlocking datafiles %p", a); \
|
||||
TRI_WriteUnlockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read locks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_READ_LOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("read-locking collection index %p", a); \
|
||||
TRI_ReadLockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read unlocks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_READ_UNLOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("read-unlocking collection index %p", a); \
|
||||
TRI_ReadUnlockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief write locks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_WRITE_LOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("write-locking collection index %p", a); \
|
||||
TRI_WriteLockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief write unlocks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_WRITE_UNLOCK_DOCUMENTS_INDEXES_DOC_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("write-unlocking collection index %p", a); \
|
||||
TRI_WriteUnlockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief locks the journal entries
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -214,17 +183,16 @@ extern "C" {
|
|||
|
||||
typedef struct TRI_document_collection_s {
|
||||
TRI_primary_collection_t base;
|
||||
|
||||
|
||||
// .............................................................................
|
||||
// this lock protects the _next pointer, _headers, _indexes, and _primaryIndex
|
||||
// the collection does not have a lock of its own. it is protected by the
|
||||
// _lock of its base type, TRI_primary_collection_t.
|
||||
// .............................................................................
|
||||
|
||||
TRI_read_write_lock_t _lock;
|
||||
|
||||
TRI_headers_t* _headers;
|
||||
TRI_associative_pointer_t _primaryIndex;
|
||||
|
||||
TRI_vector_pointer_t _secondaryIndexes;
|
||||
TRI_multi_pointer_t _edgesIndex;
|
||||
TRI_vector_pointer_t _indexes;
|
||||
|
||||
// .............................................................................
|
||||
// this condition variable protects the _journalsCondition
|
||||
|
|
|
@ -193,7 +193,7 @@ int TRI_SaveIndex (TRI_primary_collection_t* collection, TRI_index_t* idx) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_index_t* TRI_LookupIndex (TRI_primary_collection_t* collection, TRI_idx_iid_t iid) {
|
||||
TRI_document_collection_t* sim;
|
||||
TRI_document_collection_t* doc;
|
||||
TRI_index_t* idx;
|
||||
size_t i;
|
||||
|
||||
|
@ -202,10 +202,10 @@ TRI_index_t* TRI_LookupIndex (TRI_primary_collection_t* collection, TRI_idx_iid_
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sim = (TRI_document_collection_t*) collection;
|
||||
doc = (TRI_document_collection_t*) collection;
|
||||
|
||||
for (i = 0; i < sim->_indexes._length; ++i) {
|
||||
idx = sim->_indexes._buffer[i];
|
||||
for (i = 0; i < doc->_secondaryIndexes._length; ++i) {
|
||||
idx = doc->_secondaryIndexes._buffer[i];
|
||||
|
||||
if (idx->_iid == iid) {
|
||||
return idx;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <BasicsC/conversions.h>
|
||||
#include <BasicsC/files.h>
|
||||
#include <BasicsC/hashes.h>
|
||||
#include <BasicsC/logging.h>
|
||||
#include <BasicsC/strings.h>
|
||||
|
||||
|
@ -43,6 +44,37 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hashs the document id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static uint64_t HashKeyHeader (TRI_associative_pointer_t* array, void const* key) {
|
||||
TRI_voc_did_t const* k = key;
|
||||
|
||||
return TRI_FnvHashPointer(k, sizeof(TRI_voc_did_t));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hashs the document header
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static uint64_t HashElementDocument (TRI_associative_pointer_t* array, void const* element) {
|
||||
TRI_doc_mptr_t const* e = element;
|
||||
|
||||
return TRI_FnvHashPointer(&e->_did, sizeof(TRI_voc_did_t));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief compares a document id and a document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool IsEqualKeyDocument (TRI_associative_pointer_t* array, void const* key, void const* element) {
|
||||
TRI_voc_did_t const* k = key;
|
||||
TRI_doc_mptr_t const* e = element;
|
||||
|
||||
return *k == e->_did;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new document in the collection from shaped json
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -496,6 +528,15 @@ void TRI_InitPrimaryCollection (TRI_primary_collection_t* collection,
|
|||
HashElementDatafile,
|
||||
IsEqualKeyElementDatafile,
|
||||
NULL);
|
||||
|
||||
TRI_InitAssociativePointer(&collection->_primaryIndex,
|
||||
TRI_UNKNOWN_MEM_ZONE,
|
||||
HashKeyHeader,
|
||||
HashElementDocument,
|
||||
IsEqualKeyDocument,
|
||||
0);
|
||||
|
||||
TRI_InitReadWriteLock(&collection->_lock);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -503,10 +544,13 @@ void TRI_InitPrimaryCollection (TRI_primary_collection_t* collection,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyPrimaryCollection (TRI_primary_collection_t* collection) {
|
||||
TRI_DestroyReadWriteLock(&collection->_lock);
|
||||
TRI_DestroyAssociativePointer(&collection->_primaryIndex);
|
||||
|
||||
if (collection->_shaper != NULL) {
|
||||
TRI_FreeVocShaper(collection->_shaper);
|
||||
}
|
||||
|
||||
|
||||
FreeDatafileInfo(&collection->_datafileInfo);
|
||||
TRI_DestroyBarrierList(&collection->_barrierList);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief primary collection
|
||||
/// @brief primary collection with global read-write lock
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
|
@ -44,6 +44,51 @@ extern "C" {
|
|||
|
||||
struct TRI_cap_constraint_s;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public macros
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read locks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_READ_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("read-locking collection index %p", a); \
|
||||
TRI_ReadLockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read unlocks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("read-unlocking collection index %p", a); \
|
||||
TRI_ReadUnlockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief write locks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_WRITE_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("write-locking collection index %p", a); \
|
||||
TRI_WriteLockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief write unlocks the documents and indexes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_WRITE_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \
|
||||
TRI_LOCK_CHECK_TRACE("write-unlocking collection index %p", a); \
|
||||
TRI_WriteUnlockReadWriteLock(&(a)->_lock)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public types
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -259,10 +304,19 @@ TRI_doc_collection_info_t;
|
|||
|
||||
typedef struct TRI_primary_collection_s {
|
||||
TRI_collection_t base;
|
||||
|
||||
// .............................................................................
|
||||
// this lock protects the _primaryIndex plus the _secondaryIndexes, _edgesIndex,
|
||||
// and _headers attributes in derived types
|
||||
// .............................................................................
|
||||
|
||||
TRI_read_write_lock_t _lock;
|
||||
|
||||
TRI_shaper_t* _shaper;
|
||||
TRI_barrier_list_t _barrierList;
|
||||
TRI_associative_pointer_t _datafileInfo;
|
||||
|
||||
TRI_associative_pointer_t _primaryIndex;
|
||||
|
||||
struct TRI_cap_constraint_s* _capConstraint;
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ void TRI_SynchroniserVocBase (void* data) {
|
|||
// if we cannot acquire the read lock instantly, we will continue.
|
||||
// otherwise we'll risk a multi-thread deadlock between synchroniser,
|
||||
// compactor and data-modification threads (e.g. POST /_api/document)
|
||||
if (! TRI_TRY_READ_LOCK_DATAFILES_DOC_COLLECTION(collection)) {
|
||||
if (! TRI_TRY_READ_LOCK_STATUS_VOCBASE_COL(collection)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ img.externalLink {
|
|||
|
||||
.placeholderBox, .placeholderBoxSettings {
|
||||
margin-left: 7px;
|
||||
margin-right: 7px;
|
||||
margin-right: 20px;
|
||||
margin-top: 7px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 0.8em;
|
||||
|
|
|
@ -2531,6 +2531,7 @@ function drawConnections (placeholder, granularity) {
|
|||
},
|
||||
xaxis: {
|
||||
mode: "time",
|
||||
timeformat: "%h:%M",
|
||||
twelveHourClock: false
|
||||
},
|
||||
//crosshair: { mode: "x" },
|
||||
|
@ -2617,7 +2618,7 @@ function drawRequests (placeholder, granularity) {
|
|||
arraySent.push([data.start[i]*1000,data.bytesSent.mean[i]]);
|
||||
arrayReceived.push([data.start[i]*1000,data.bytesReceived.mean[i]]);
|
||||
}
|
||||
var stack = 0, bars = true, lines = true, steps = true;
|
||||
var stack = 0, bars = false, lines = false, steps = false;
|
||||
var options = {
|
||||
legend: {
|
||||
show: true,
|
||||
|
@ -2626,7 +2627,6 @@ function drawRequests (placeholder, granularity) {
|
|||
backgroundOpacity: 0.4
|
||||
},
|
||||
series: {
|
||||
stack: stack,
|
||||
lines: { show: true,
|
||||
steps: false,
|
||||
fill: true,
|
||||
|
@ -2636,6 +2636,7 @@ function drawRequests (placeholder, granularity) {
|
|||
},
|
||||
xaxis: {
|
||||
mode: "time",
|
||||
timeformat: "%h:%M",
|
||||
twelveHourClock: false
|
||||
},
|
||||
//crosshair: { mode: "x" },
|
||||
|
|
Loading…
Reference in New Issue