mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
ba614c1a6a
|
@ -174,12 +174,15 @@ v3.0.0 (XXXX-XX-XX)
|
|||
* added WorkMonitor to inspect server threads
|
||||
|
||||
* when downloading a Foxx service from the web interface the suggested filename
|
||||
now takes the form $name@$version.zip instead of simply "app.zip"
|
||||
is now based on the service's mount path instead of simply "app.zip"
|
||||
|
||||
* the `@arangodb/request` response object now stores the parsed JSON response
|
||||
body in a property `json` instead of `body` when the request was made using the
|
||||
`json` option. The `body` instead contains the response body as a string.
|
||||
|
||||
* the Foxx API has changed significantly, 2.8 services are still supported
|
||||
using a backwards-compatible "legacy mode"
|
||||
|
||||
|
||||
v2.8.9 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
|
|
@ -238,6 +238,25 @@ more efficiently carry out operations with multiple documents than their single-
|
|||
equivalents, which required one HTTP request per operation. With the batch operations,
|
||||
the HTTP request/response overhead can be amortized across multiple operations.
|
||||
|
||||
!SECTION Persistent indexes
|
||||
|
||||
ArangoDB 3.0 provides an experimental persistent index feature. Persistent indexes store
|
||||
the index values on disk instead of in-memory only. This means the indexes do not need
|
||||
to be rebuilt in-memory when a collection is loaded or reloaded, which should improve
|
||||
collection loading times.
|
||||
|
||||
The persistent indexes in ArangoDB are based on the RocksDB engine.
|
||||
To create a persistent index for a collection, create an index of type "rocksdb" as
|
||||
follows:
|
||||
|
||||
```js
|
||||
db.mycollection.ensureIndex({ type: "rocksdb", fields: [ "fieldname" ]});
|
||||
```
|
||||
|
||||
The persistent indexes are sorted, so they allow equality lookups and range queries.
|
||||
Note that the feature is still highly experimental and has some known deficiencies. It
|
||||
will be finalized until the release of the 3.0 stable version.
|
||||
|
||||
!SECTION Upgraded V8 version
|
||||
|
||||
The V8 engine that is used inside ArangoDB to execute JavaScript code has been upgraded from
|
||||
|
|
|
@ -258,12 +258,11 @@ The following incompatible changes have been made to the JavaScript API in Arang
|
|||
!SUBSECTION Foxx
|
||||
|
||||
The Foxx framework has been completely rewritten for 3.0 with a new, simpler and more
|
||||
familiar API. To make Foxx applications from earlier ArangoDB versions run in 3.0
|
||||
without code changes, the application's manifest file needs to be edited.
|
||||
familiar API. To make Foxx services developed for 2.8 or earlier ArangoDB versions run in 3.0, the service's manifest file needs to be edited.
|
||||
|
||||
To enable the legacy mode for a Foxx application, add `"engines": {"arangodb": "^2.8.0"}`
|
||||
To enable the legacy mode for a Foxx service, add `"engines": {"arangodb": "^2.8.0"}`
|
||||
(or similar version ranges that exclude 3.0 and up) to the service manifest file
|
||||
(named "manifest.json", located in the application's base directory).
|
||||
(named "manifest.json", located in the service's base directory).
|
||||
|
||||
!SUBSECTION Require
|
||||
|
||||
|
@ -274,7 +273,7 @@ instead of `org/arangodb/<module>`, e.g.
|
|||
var cluster = require("@arangodb/cluster");
|
||||
```
|
||||
|
||||
The old format can still be used and is compatible:
|
||||
The old format can still be used for compatibility:
|
||||
|
||||
```js
|
||||
var cluster = require("org/arangodb/cluster");
|
||||
|
|
|
@ -807,22 +807,15 @@ bool AgencyComm::ensureStructureInitialized() {
|
|||
sleep(1);
|
||||
}
|
||||
|
||||
AgencyCommResult result = getValues("InitDone", false);
|
||||
AgencyCommResult result = getValues2("InitDone");
|
||||
|
||||
if (result.successful()) {
|
||||
result.parse("", false);
|
||||
|
||||
std::map<std::string, AgencyCommResultEntry>::iterator it =
|
||||
result._values.begin();
|
||||
if (it != result._values.end()) {
|
||||
auto value = (*it).second._vpack;
|
||||
|
||||
if (value->slice().isBoolean() && value->slice().getBoolean()) {
|
||||
// expecting a value of "true"
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "Found an initialized agency";
|
||||
return true;
|
||||
}
|
||||
// fallthrough to sleeping
|
||||
VPackSlice value = result.slice()[0].get(std::vector<std::string>(
|
||||
{prefixStripped(), "InitDone"}));
|
||||
if (value.isBoolean() && value.getBoolean()) {
|
||||
// expecting a value of "true"
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "Found an initialized agency";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1203,9 +1196,17 @@ AgencyCommResult AgencyComm::setValue(std::string const& key,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool AgencyComm::exists(std::string const& key) {
|
||||
AgencyCommResult result = getValues(key, false);
|
||||
|
||||
return result.successful();
|
||||
AgencyCommResult result = getValues2(key);
|
||||
if (!result.successful()) {
|
||||
return false;
|
||||
}
|
||||
auto parts = arangodb::basics::StringUtils::split(key, "/");
|
||||
std::vector<std::string> allParts;
|
||||
allParts.reserve(parts.size() + 1);
|
||||
allParts.push_back(prefixStripped());
|
||||
allParts.insert(allParts.end(), parts.begin(), parts.end());
|
||||
VPackSlice slice = result.slice()[0].get(allParts);
|
||||
return !slice.isNone();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -246,62 +246,60 @@ bool ServerState::registerWithRole(ServerState::RoleEnum role) {
|
|||
|
||||
AgencyComm comm;
|
||||
AgencyCommResult result;
|
||||
// mop: hmm...why is it below target? :S
|
||||
result = comm.getValues("Target/MapLocalToID/" + StringUtils::urlEncode(_localInfo), false);
|
||||
std::string localInfoEncoded = StringUtils::urlEncode(_localInfo);
|
||||
result = comm.getValues2("Target/MapLocalToID/" + localInfoEncoded);
|
||||
|
||||
std::string id;
|
||||
bool found = true;
|
||||
if (!result.successful()) {
|
||||
found = false;
|
||||
} else {
|
||||
VPackSlice idSlice = result.slice()[0].get(std::vector<std::string>(
|
||||
{comm.prefixStripped(), "Target", "MapLocalToID", localInfoEncoded}));
|
||||
if (!idSlice.isString()) {
|
||||
found = false;
|
||||
} else {
|
||||
id = idSlice.copyString();
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
LOG(DEBUG) << "Determining id from localinfo failed. Continuing with registering ourselves for the first time";
|
||||
id = createIdForRole(comm, role);
|
||||
} else {
|
||||
result.parse("", false);
|
||||
|
||||
std::map<std::string, AgencyCommResultEntry>::const_iterator it =
|
||||
result._values.begin();
|
||||
|
||||
if (it != result._values.end()) {
|
||||
VPackSlice slice = (*it).second._vpack->slice();
|
||||
id = slice.copyString();
|
||||
}
|
||||
}
|
||||
|
||||
const std::string agencyKey = roleToAgencyKey(role);
|
||||
const std::string planKey = "Plan/" + agencyKey + "/" + id;
|
||||
const std::string currentKey = "Current/" + agencyKey + "/" + id;
|
||||
|
||||
std::shared_ptr<VPackBuilder> builder;
|
||||
result = comm.getValues(planKey, false);
|
||||
auto builder = std::make_shared<VPackBuilder>();
|
||||
result = comm.getValues2(planKey);
|
||||
found = true;
|
||||
if (!result.successful()) {
|
||||
VPackSlice plan;
|
||||
found = false;
|
||||
} else {
|
||||
VPackSlice plan = result.slice()[0].get(std::vector<std::string>(
|
||||
{ comm.prefixStripped(), "Plan", agencyKey, id }));
|
||||
if (!plan.isString()) {
|
||||
found = false;
|
||||
} else {
|
||||
builder->add(plan);
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// mop: hmm ... we are registered but not part of the Plan :O
|
||||
// create a plan for ourselves :)
|
||||
builder = std::make_shared<VPackBuilder>();
|
||||
builder->add(VPackValue("none"));
|
||||
|
||||
plan = builder->slice();
|
||||
VPackSlice plan = builder->slice();
|
||||
|
||||
comm.setValue(planKey, plan, 0.0);
|
||||
if (!result.successful()) {
|
||||
LOG(ERR) << "Couldn't create plan " << result.errorMessage();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
result.parse("", false);
|
||||
std::map<std::string, AgencyCommResultEntry>::const_iterator it =
|
||||
result._values.begin();
|
||||
|
||||
if (it != result._values.end()) {
|
||||
builder = (*it).second._vpack;
|
||||
}
|
||||
}
|
||||
|
||||
if (!builder) {
|
||||
LOG(ERR) << "Builder not set. Answer is not in correct format!";
|
||||
return false;
|
||||
}
|
||||
|
||||
result =
|
||||
comm.setValue(currentKey, builder->slice(), 0.0);
|
||||
result = comm.setValue(currentKey, builder->slice(), 0.0);
|
||||
|
||||
if (!result.successful()) {
|
||||
LOG(ERR) << "Could not talk to agency! " << result.errorMessage();
|
||||
|
|
Loading…
Reference in New Issue