mirror of https://gitee.com/bigwinds/arangodb
Fix configurability of indexBuckets.
This commit is contained in:
parent
13204298d9
commit
a3923c9eaf
|
@ -730,6 +730,7 @@ TRI_col_info_t ClusterInfo::getCollectionProperties (CollectionInfo const& colle
|
|||
info._isSystem = collection.isSystem();
|
||||
info._isVolatile = collection.isVolatile();
|
||||
info._waitForSync = collection.waitForSync();
|
||||
info._indexBuckets = collection.indexBuckets();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
@ -1347,10 +1348,12 @@ int ClusterInfo::setCollectionPropertiesCoordinator (string const& databaseName,
|
|||
TRI_DeleteObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "doCompact");
|
||||
TRI_DeleteObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "journalSize");
|
||||
TRI_DeleteObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "waitForSync");
|
||||
TRI_DeleteObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "indexBuckets");
|
||||
|
||||
TRI_Insert3ObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "doCompact", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_doCompact));
|
||||
TRI_Insert3ObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "journalSize", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_maximalSize));
|
||||
TRI_Insert3ObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "waitForSync", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_waitForSync));
|
||||
TRI_Insert3ObjectJson(TRI_UNKNOWN_MEM_ZONE, copy, "indexBuckets", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_indexBuckets));
|
||||
|
||||
res.clear();
|
||||
res = ac.setValue("Plan/Collections/" + databaseName + "/" + collectionID, copy, 0.0);
|
||||
|
|
|
@ -226,6 +226,14 @@ namespace triagens {
|
|||
return triagens::basics::JsonHelper::getNumericValue<TRI_voc_size_t>(_json, "journalSize", 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the maximal journal size
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint32_t indexBuckets () const {
|
||||
return triagens::basics::JsonHelper::getNumericValue<uint32_t>(_json, "indexBuckets", 1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the shard keys
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -2121,6 +2121,19 @@ static void JS_PropertiesVocbaseCol (const v8::FunctionCallbackInfo<v8::Value>&
|
|||
}
|
||||
TRI_V8_THROW_EXCEPTION_PARAMETER("volatile collections do not support the waitForSync option");
|
||||
}
|
||||
|
||||
if (po->Has(TRI_V8_ASCII_STRING("indexBuckets"))) {
|
||||
uint32_t tmp = TRI_ObjectToUInt64(
|
||||
po->Get(TRI_V8_ASCII_STRING("indexBuckets")),
|
||||
false);
|
||||
if (tmp < 1 || tmp > 1024) {
|
||||
if (info._keyOptions != nullptr) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, info._keyOptions);
|
||||
}
|
||||
TRI_V8_THROW_EXCEPTION_PARAMETER("indexBucket must be a two-power between 1 and 1024");
|
||||
}
|
||||
info._indexBuckets = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
int res = ClusterInfo::instance()->setCollectionPropertiesCoordinator(databaseName, StringUtils::itoa(collection->_cid), &info);
|
||||
|
|
|
@ -334,7 +334,8 @@ ArangoCollection.prototype.properties = function (properties) {
|
|||
"waitForSync": true,
|
||||
"shardKeys": false,
|
||||
"numberOfShards": false,
|
||||
"keyOptions": false
|
||||
"keyOptions": false,
|
||||
"indexBuckets": true
|
||||
};
|
||||
var a;
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ ArangoDatabase.prototype._create = function (name, properties, type) {
|
|||
if (properties !== undefined) {
|
||||
[ "waitForSync", "journalSize", "isSystem", "isVolatile",
|
||||
"doCompact", "keyOptions", "shardKeys", "numberOfShards",
|
||||
"distributeShardsLike" ].forEach(function(p) {
|
||||
"distributeShardsLike", "indexBuckets" ].forEach(function(p) {
|
||||
if (properties.hasOwnProperty(p)) {
|
||||
body[p] = properties[p];
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ ArangoDatabase.prototype._create = function (name, properties, type) {
|
|||
if (properties !== undefined) {
|
||||
[ "waitForSync", "journalSize", "isSystem", "isVolatile",
|
||||
"doCompact", "keyOptions", "shardKeys", "numberOfShards",
|
||||
"distributeShardsLike" ].forEach(function(p) {
|
||||
"distributeShardsLike", "indexBuckets" ].forEach(function(p) {
|
||||
if (properties.hasOwnProperty(p)) {
|
||||
body[p] = properties[p];
|
||||
}
|
||||
|
|
|
@ -506,7 +506,8 @@ function createLocalCollections (plannedCollections) {
|
|||
|
||||
// collection exists, now compare collection properties
|
||||
var properties = { };
|
||||
var cmp = [ "journalSize", "waitForSync", "doCompact" ];
|
||||
var cmp = [ "journalSize", "waitForSync", "doCompact",
|
||||
"indexBuckets" ];
|
||||
for (i = 0; i < cmp.length; ++i) {
|
||||
var p = cmp[i];
|
||||
if (localCollections[shard][p] !== payload[p]) {
|
||||
|
|
Loading…
Reference in New Issue