1
0
Fork 0

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

This commit is contained in:
Michael Hackstein 2014-03-17 11:58:30 +01:00
commit f230fe0328
11 changed files with 75 additions and 27 deletions

View File

@ -2708,14 +2708,27 @@ static bool OpenIterator (TRI_df_marker_t const* marker,
////////////////////////////////////////////////////////////////////////////////
static bool FillInternalIndexes (TRI_document_collection_t* document) {
TRI_primary_collection_t* primary;
size_t i;
int res;
primary = (TRI_primary_collection_t*) document;
res = TRI_ERROR_NO_ERROR;
for (i = 0; i < document->_allIndexes._length; ++i) {
TRI_index_t* idx = document->_allIndexes._buffer[i];
if (idx->sizeHint != NULL) {
// give the index a size hint
int r = idx->sizeHint(idx, primary->_primaryIndex._nrUsed);
if (r != TRI_ERROR_NO_ERROR) {
// return first error, but continue
res = r;
}
}
if (idx->_type == TRI_IDX_TYPE_EDGE_INDEX) {
int r = FillIndex(document, idx);

View File

@ -93,6 +93,7 @@ void TRI_InitIndex (TRI_index_t* idx,
// init common functions
idx->removeIndex = NULL;
idx->cleanup = NULL;
idx->sizeHint = NULL;
idx->postInsert = NULL;
@ -898,6 +899,23 @@ static TRI_json_t* JsonEdge (TRI_index_t* idx) {
return json;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief JSON description of edge index
////////////////////////////////////////////////////////////////////////////////
static int SizeHintEdge (TRI_index_t* idx,
size_t size) {
TRI_multi_pointer_t* edgesIndex = &(((TRI_edge_index_t*) idx)->_edges);
// we assume this is called when setting up the index and the index is still empty
assert(edgesIndex->_nrUsed == 0);
// set an initial size for the index and allow for some new nodes to be created
// without resizing
return TRI_ResizeMultiPointer(edgesIndex, size + 2048);
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
@ -955,6 +973,8 @@ TRI_index_t* TRI_CreateEdgeIndex (struct TRI_primary_collection_s* primary,
idx->insert = InsertEdge;
idx->remove = RemoveEdge;
idx->sizeHint = SizeHintEdge;
return idx;
}

View File

@ -124,6 +124,9 @@ typedef struct TRI_index_s {
// a garbage collection function for the index
int (*cleanup) (struct TRI_index_s*);
// give index a hint about the expected size
int (*sizeHint) (struct TRI_index_s*, size_t);
// .........................................................................................
// the following functions are called by the query machinery which attempting to determine an

View File

@ -2126,6 +2126,8 @@ int TRI_CreateCoordinatorDatabaseServer (TRI_server_t* server,
WRITE_UNLOCK_DATABASES(server->_databasesLock);
TRI_UnlockMutex(&server->_createLock);
vocbase->_state = (sig_atomic_t) TRI_VOCBASE_STATE_NORMAL;
*database = vocbase;

View File

@ -1,6 +0,0 @@
div.content {
padding-top: 13px;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 5px;
}

View File

@ -23,7 +23,7 @@ gs = _.sortBy(gs, sortF);
<a class="arangoHeader">Graph Viewer Configuration</a>
</div>
<div class="content">
<div class="contentDiv">
<form action="javascript:void(0);" autocomplete="on" class="form-horizontal" id="creationDialog">
<fieldset>
<div class="control-group">

View File

@ -1,24 +1,21 @@
#loginWindow {
width: 400px;
height: 300px;
border: 1px solid #868686;
position: absolute;
left: 50%;
top: 50%;
margin-top: -150px;
margin-left: -220px !important;
background-color: #F4F4F4;
border: 1px solid #868686;
border-radius: 2px;
height: 300px;
left: 50%;
margin-left: -220px !important;
margin-top: -150px;
padding-left: 10px;
padding-right: 10px;
position: absolute;
top: 50%;
width: 400px;
}
#loginLogo {
}
#loginWindow {
padding-left: 10px;
padding-right: 10px;
}
#loginSpace {
height: 50px;
}

View File

@ -27,3 +27,5 @@
@import 'searchBar';
// shortcuts info boxes
@import 'shortcuts';
// login view
//@import 'login';

View File

@ -142,7 +142,6 @@
"frontend/css/swaggerView.css",
"frontend/css/foxxView.css",
"frontend/css/graphView.css",
"frontend/css/loginView.css",
"frontend/css/dbSelectionView.css",
"frontend/css/jquery.snippet.css",
"frontend/css/modal.css",
@ -150,7 +149,6 @@
"frontend/css/graphlayout.css",
"frontend/css/datatables.css",
"frontend/css/api.css",
"frontend/css/general.css",
"frontend/css/headerBar.css",
"frontend/css/screenSizes.css",
"frontend/css/clusterDashboardView.css",

View File

@ -588,7 +588,8 @@ static void AddNewElementPointer (TRI_multi_pointer_t* array, void* element) {
/// @brief resizes the array
////////////////////////////////////////////////////////////////////////////////
static void ResizeMultiPointer (TRI_multi_pointer_t* array) {
static int ResizeMultiPointer (TRI_multi_pointer_t* array,
size_t targetSize) {
void** oldTable;
uint64_t oldAlloc;
uint64_t j;
@ -596,7 +597,7 @@ static void ResizeMultiPointer (TRI_multi_pointer_t* array) {
oldTable = array->_table;
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
array->_nrAlloc = (uint64_t) targetSize;
array->_table = TRI_Allocate(array->_memoryZone, array->_nrAlloc * sizeof(void*), true);
@ -604,7 +605,7 @@ static void ResizeMultiPointer (TRI_multi_pointer_t* array) {
array->_nrAlloc = oldAlloc;
array->_table = oldTable;
return;
return TRI_ERROR_OUT_OF_MEMORY;
}
array->_nrUsed = 0;
@ -619,7 +620,11 @@ static void ResizeMultiPointer (TRI_multi_pointer_t* array) {
}
}
TRI_Free(array->_memoryZone, oldTable);
if (oldTable != NULL) {
TRI_Free(array->_memoryZone, oldTable);
}
return TRI_ERROR_NO_ERROR;
}
////////////////////////////////////////////////////////////////////////////////
@ -831,7 +836,7 @@ void* TRI_InsertElementMultiPointer (TRI_multi_pointer_t* array,
// if we were adding and the table is more than half full, extend it
if (array->_nrAlloc < 2 * array->_nrUsed) {
ResizeMultiPointer(array);
ResizeMultiPointer(array, 2 * array->_nrAlloc + 1);
}
return NULL;
@ -892,6 +897,14 @@ void* TRI_RemoveElementMultiPointer (TRI_multi_pointer_t* array, void const* ele
return old;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief resize the array
////////////////////////////////////////////////////////////////////////////////
int TRI_ResizeMultiPointer (TRI_multi_pointer_t* array, size_t size) {
return ResizeMultiPointer(array, 2 * size + 1);
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////

View File

@ -308,6 +308,12 @@ void* TRI_InsertElementMultiPointer (TRI_multi_pointer_t*,
void* TRI_RemoveElementMultiPointer (TRI_multi_pointer_t*, void const* element);
////////////////////////////////////////////////////////////////////////////////
/// @brief resize the array
////////////////////////////////////////////////////////////////////////////////
int TRI_ResizeMultiPointer (TRI_multi_pointer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////