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
|
* added WorkMonitor to inspect server threads
|
||||||
|
|
||||||
* when downloading a Foxx service from the web interface the suggested filename
|
* 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
|
* 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
|
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.
|
`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)
|
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,
|
equivalents, which required one HTTP request per operation. With the batch operations,
|
||||||
the HTTP request/response overhead can be amortized across multiple 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
|
!SECTION Upgraded V8 version
|
||||||
|
|
||||||
The V8 engine that is used inside ArangoDB to execute JavaScript code has been upgraded from
|
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
|
!SUBSECTION Foxx
|
||||||
|
|
||||||
The Foxx framework has been completely rewritten for 3.0 with a new, simpler and more
|
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
|
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.
|
||||||
without code changes, the application'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
|
(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
|
!SUBSECTION Require
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ instead of `org/arangodb/<module>`, e.g.
|
||||||
var cluster = require("@arangodb/cluster");
|
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
|
```js
|
||||||
var cluster = require("org/arangodb/cluster");
|
var cluster = require("org/arangodb/cluster");
|
||||||
|
|
|
@ -807,22 +807,15 @@ bool AgencyComm::ensureStructureInitialized() {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
AgencyCommResult result = getValues("InitDone", false);
|
AgencyCommResult result = getValues2("InitDone");
|
||||||
|
|
||||||
if (result.successful()) {
|
if (result.successful()) {
|
||||||
result.parse("", false);
|
VPackSlice value = result.slice()[0].get(std::vector<std::string>(
|
||||||
|
{prefixStripped(), "InitDone"}));
|
||||||
std::map<std::string, AgencyCommResultEntry>::iterator it =
|
if (value.isBoolean() && value.getBoolean()) {
|
||||||
result._values.begin();
|
// expecting a value of "true"
|
||||||
if (it != result._values.end()) {
|
LOG_TOPIC(TRACE, Logger::STARTUP) << "Found an initialized agency";
|
||||||
auto value = (*it).second._vpack;
|
return true;
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,9 +1196,17 @@ AgencyCommResult AgencyComm::setValue(std::string const& key,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool AgencyComm::exists(std::string const& key) {
|
bool AgencyComm::exists(std::string const& key) {
|
||||||
AgencyCommResult result = getValues(key, false);
|
AgencyCommResult result = getValues2(key);
|
||||||
|
if (!result.successful()) {
|
||||||
return 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;
|
AgencyComm comm;
|
||||||
AgencyCommResult result;
|
AgencyCommResult result;
|
||||||
// mop: hmm...why is it below target? :S
|
std::string localInfoEncoded = StringUtils::urlEncode(_localInfo);
|
||||||
result = comm.getValues("Target/MapLocalToID/" + StringUtils::urlEncode(_localInfo), false);
|
result = comm.getValues2("Target/MapLocalToID/" + localInfoEncoded);
|
||||||
|
|
||||||
std::string id;
|
std::string id;
|
||||||
|
bool found = true;
|
||||||
if (!result.successful()) {
|
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";
|
LOG(DEBUG) << "Determining id from localinfo failed. Continuing with registering ourselves for the first time";
|
||||||
id = createIdForRole(comm, role);
|
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 agencyKey = roleToAgencyKey(role);
|
||||||
const std::string planKey = "Plan/" + agencyKey + "/" + id;
|
const std::string planKey = "Plan/" + agencyKey + "/" + id;
|
||||||
const std::string currentKey = "Current/" + agencyKey + "/" + id;
|
const std::string currentKey = "Current/" + agencyKey + "/" + id;
|
||||||
|
|
||||||
std::shared_ptr<VPackBuilder> builder;
|
auto builder = std::make_shared<VPackBuilder>();
|
||||||
result = comm.getValues(planKey, false);
|
result = comm.getValues2(planKey);
|
||||||
|
found = true;
|
||||||
if (!result.successful()) {
|
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
|
// mop: hmm ... we are registered but not part of the Plan :O
|
||||||
// create a plan for ourselves :)
|
// create a plan for ourselves :)
|
||||||
builder = std::make_shared<VPackBuilder>();
|
|
||||||
builder->add(VPackValue("none"));
|
builder->add(VPackValue("none"));
|
||||||
|
|
||||||
plan = builder->slice();
|
VPackSlice plan = builder->slice();
|
||||||
|
|
||||||
comm.setValue(planKey, plan, 0.0);
|
comm.setValue(planKey, plan, 0.0);
|
||||||
if (!result.successful()) {
|
if (!result.successful()) {
|
||||||
LOG(ERR) << "Couldn't create plan " << result.errorMessage();
|
LOG(ERR) << "Couldn't create plan " << result.errorMessage();
|
||||||
return false;
|
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 =
|
result = comm.setValue(currentKey, builder->slice(), 0.0);
|
||||||
comm.setValue(currentKey, builder->slice(), 0.0);
|
|
||||||
|
|
||||||
if (!result.successful()) {
|
if (!result.successful()) {
|
||||||
LOG(ERR) << "Could not talk to agency! " << result.errorMessage();
|
LOG(ERR) << "Could not talk to agency! " << result.errorMessage();
|
||||||
|
|
Loading…
Reference in New Issue