From 3ad1940ce91abbda01ad4b9bb41486aa6055c22f Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Wed, 4 Jun 2014 16:23:07 +0200 Subject: [PATCH] Looked through _headersPtr. --- arangod/CapConstraint/cap-constraint.cpp | 4 ++-- arangod/Utils/Transaction.h | 4 ++-- arangod/VocBase/document-collection.cpp | 22 +++++++++++----------- arangod/VocBase/document-collection.h | 2 +- arangod/Wal/DocumentOperation.h | 12 ++++++------ 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/arangod/CapConstraint/cap-constraint.cpp b/arangod/CapConstraint/cap-constraint.cpp index 316e61ed2c..244d25e3aa 100644 --- a/arangod/CapConstraint/cap-constraint.cpp +++ b/arangod/CapConstraint/cap-constraint.cpp @@ -53,7 +53,7 @@ static int ApplyCap (TRI_cap_constraint_t* cap, size_t currentCount; int res; - headers = document->_headers; + headers = document->_headersPtr; // PROTECTED by trx in trxCollection currentCount = headers->count(headers); currentSize = headers->size(headers); @@ -109,7 +109,7 @@ static int InitialiseCap (TRI_cap_constraint_t* cap, TRI_ASSERT_MAINTAINER(cap->_count > 0 || cap->_size > 0); - headers = document->_headers; + headers = document->_headersPtr; // ONLY IN INDEX (CAP) currentCount = headers->count(headers); currentSize = headers->size(headers); diff --git a/arangod/Utils/Transaction.h b/arangod/Utils/Transaction.h index 4b83a874d7..6066f1ba86 100644 --- a/arangod/Utils/Transaction.h +++ b/arangod/Utils/Transaction.h @@ -586,7 +586,7 @@ namespace triagens { if (offset >= 0) { // read from front - doc = document->_headers->front(document->_headers); + doc = document->_headersPtr->front(document->_headersPtr); // PROTECTED by trx in trxCollection int64_t i = 0; while (doc != 0 && i < offset) { @@ -603,7 +603,7 @@ namespace triagens { } else { // read from back - doc = document->_headers->back(document->_headers); + doc = document->_headersPtr->back(document->_headersPtr); // PROTECTED by trx in trxCollection int64_t i = -1; while (doc != 0 && i > offset) { diff --git a/arangod/VocBase/document-collection.cpp b/arangod/VocBase/document-collection.cpp index 60a11acf87..db786090cc 100644 --- a/arangod/VocBase/document-collection.cpp +++ b/arangod/VocBase/document-collection.cpp @@ -694,7 +694,7 @@ static int CreateHeader (TRI_document_collection_t* document, assert(markerSize > 0); // get a new header pointer - header = document->_headers->request(document->_headers, markerSize); + header = document->_headersPtr->request(document->_headersPtr, markerSize); // ONLY IN OPENITERATOR if (header == nullptr) { return TRI_ERROR_OUT_OF_MEMORY; @@ -1138,7 +1138,7 @@ static int InsertDocumentShapedJson (TRI_transaction_collection_t* trxCollection triagens::wal::DocumentOperation operation(marker, trxCollection, TRI_VOC_DOCUMENT_OPERATION_INSERT, rid); // create a new header - TRI_doc_mptr_t* header = operation.header = document->_headers->request(document->_headers, marker->size()); // PROTECTED by trx in trxCollection + TRI_doc_mptr_t* header = operation.header = document->_headersPtr->request(document->_headersPtr, marker->size()); // PROTECTED by trx in trxCollection if (header == nullptr) { // out of memory. no harm done here. just return the error @@ -1551,7 +1551,7 @@ static void DumpCollection (TRI_document_collection_t* document) { printf("----------------------------\n"); printf("primary index, nrUsed: %lu\n", (unsigned long) document->_primaryIndex._nrUsed); printf("number of documents: %lu\n", (unsigned long) document->_numberDocuments); - document->_headers->dump(document->_headers); + document->_headersPtr->dump(document->_headersPtr); printf("----------------------------\n\n"); } @@ -1697,7 +1697,7 @@ static int OpenIteratorApplyInsert (open_iterator_state_t* state, if (res != TRI_ERROR_NO_ERROR) { // insertion failed LOG_ERROR("inserting document into indexes failed"); - document->_headers->release(document->_headers, header, true); + document->_headersPtr->release(document->_headersPtr, header, true); // ONLY IN OPENITERATOR return res; } @@ -1723,7 +1723,7 @@ static int OpenIteratorApplyInsert (open_iterator_state_t* state, // update the header info UpdateHeader(operation->_fid, marker, newHeader, found); - document->_headers->moveBack(document->_headers, newHeader, &oldData); + document->_headersPtr->moveBack(document->_headersPtr, newHeader, &oldData); // ONLY IN OPENITERATOR // update the datafile info if (oldData._fid == state->_fid) { @@ -1845,7 +1845,7 @@ static int OpenIteratorApplyRemove (open_iterator_state_t* state, DeletePrimaryIndex(document, found, false); // free the header - document->_headers->release(document->_headers, found, true); + document->_headersPtr->release(document->_headersPtr, found, true); // ONLY IN OPENITERATOR } return TRI_ERROR_NO_ERROR; @@ -2472,9 +2472,9 @@ static bool InitDocumentCollection (TRI_document_collection_t* document, return false; } - document->_headers = TRI_CreateSimpleHeaders(); + document->_headersPtr = TRI_CreateSimpleHeaders(); // ONLY IN CREATE COLLECTION - if (document->_headers == NULL) { + if (document->_headersPtr == NULL) { // ONLY IN CREATE COLLECTION TRI_DestroyPrimaryCollection(document); return false; @@ -2693,7 +2693,7 @@ TRI_document_collection_t* TRI_CreateDocumentCollection (TRI_vocbase_t* vocbase, if (false == InitDocumentCollection(document, shaper)) { LOG_ERROR("cannot initialise document collection"); - // TODO: shouldn't we destroy &document->_allIndexes, free document->_headers etc.? + // TODO: shouldn't we destroy &document->_allIndexes, free document->_headersPtr etc.? TRI_DestroyVector(&document->_failedTransactions); TRI_FreeKeyGenerator(keyGenerator); TRI_CloseCollection(collection); @@ -2708,7 +2708,7 @@ TRI_document_collection_t* TRI_CreateDocumentCollection (TRI_vocbase_t* vocbase, res = TRI_SaveCollectionInfo(collection->_directory, parameter, vocbase->_settings.forceSyncProperties); if (res != TRI_ERROR_NO_ERROR) { - // TODO: shouldn't we destroy &document->_allIndexes, free document->_headers etc.? + // TODO: shouldn't we destroy &document->_allIndexes, free document->_headersPtr etc.? LOG_ERROR("cannot save collection parameters in directory '%s': '%s'", collection->_directory, TRI_last_error()); @@ -2736,7 +2736,7 @@ void TRI_DestroyDocumentCollection (TRI_document_collection_t* document) { TRI_DestroyCondition(&document->_journalsCondition); - TRI_FreeSimpleHeaders(document->_headers); + TRI_FreeSimpleHeaders(document->_headersPtr); // PROTECTED because collection is already closed // free memory allocated for indexes n = document->_allIndexes._length; diff --git a/arangod/VocBase/document-collection.h b/arangod/VocBase/document-collection.h index d88ccad1fe..631cc088aa 100644 --- a/arangod/VocBase/document-collection.h +++ b/arangod/VocBase/document-collection.h @@ -310,7 +310,7 @@ typedef struct TRI_document_collection_s { TRI_associative_pointer_t _datafileInfo; TRI_primary_index_t _primaryIndex; - TRI_headers_t* _headers; + TRI_headers_t* _headersPtr; struct TRI_key_generator_s* _keyGenerator; struct TRI_cap_constraint_s* _capConstraint; diff --git a/arangod/Wal/DocumentOperation.h b/arangod/Wal/DocumentOperation.h index 154de361a6..da2312e215 100644 --- a/arangod/Wal/DocumentOperation.h +++ b/arangod/Wal/DocumentOperation.h @@ -32,7 +32,7 @@ namespace triagens { if (handled) { if (type == TRI_VOC_DOCUMENT_OPERATION_REMOVE) { TRI_document_collection_t* document = trxCollection->_collection->_collection; - document->_headers->release(document->_headers, header, false); + document->_headersPtr->release(document->_headersPtr, header, false); // PROTECTED by trx in trxCollection } } else { @@ -76,11 +76,11 @@ namespace triagens { } else if (type == TRI_VOC_DOCUMENT_OPERATION_UPDATE) { // move header to the end of the list - document->_headers->moveBack(document->_headers, header, &oldHeader); + document->_headersPtr->moveBack(document->_headersPtr, header, &oldHeader); // PROTECTED by trx in trxCollection } else if (type == TRI_VOC_DOCUMENT_OPERATION_REMOVE) { // unlink the header - document->_headers->unlink(document->_headers, header); + document->_headersPtr->unlink(document->_headersPtr, header); // PROTECTED by trx in trxCollection } // free the local marker buffer @@ -95,13 +95,13 @@ namespace triagens { TRI_RollbackOperationDocumentCollection(document, type, header, &oldHeader); if (type == TRI_VOC_DOCUMENT_OPERATION_INSERT) { - document->_headers->release(document->_headers, header, true); + document->_headersPtr->release(document->_headersPtr, header, true); // PROTECTED by trx in trxCollection } else if (type == TRI_VOC_DOCUMENT_OPERATION_UPDATE) { - document->_headers->move(document->_headers, header, &oldHeader); + document->_headersPtr->move(document->_headersPtr, header, &oldHeader); // PROTECTED by trx in trxCollection } else if (type == TRI_VOC_DOCUMENT_OPERATION_REMOVE) { - document->_headers->relink(document->_headers, header, header); + document->_headersPtr->relink(document->_headersPtr, header, header); // PROTECTED by trx in trxCollection } }