1
0
Fork 0

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

Conflicts:
	lib/BasicsC/process-utils.c
This commit is contained in:
Max Neunhoeffer 2014-03-04 12:32:27 +01:00
commit 2044fc9c40
11 changed files with 233 additions and 139 deletions

View File

@ -29,6 +29,10 @@
////////////////////////////////////////////////////////////////////////////////
var actions = require("org/arangodb/actions");
var cluster = require("org/arangodb/cluster");
var internal = require("internal");
var console = require("console");
// -----------------------------------------------------------------------------
// --SECTION-- private functions
@ -60,8 +64,8 @@ var actions = require("org/arangodb/actions");
///
/// - `X-Shard-ID`: This specifies the ID of the shard to which the
/// cluster request is sent and thus tells the system to which DB server
/// to send the cluster request. Note that the mapping from the
/// shard ID to the responsible server has to be defined in the
/// to send the cluster request. Note that the mapping from the
/// shard ID to the responsible server has to be defined in the
/// agency under `Current/ShardLocation/<shardID>`. One has to give
/// this header, otherwise the system does not know where to send
/// the request.
@ -75,7 +79,7 @@ var actions = require("org/arangodb/actions");
/// synchronous mode, otherwise the default asynchronous operation
/// mode is used. This is mainly for debugging purposes.
/// - `Host`: This header is ignored and not forwarded to the DB server.
/// - `User-Agent`: This header is ignored and not forwarded to the DB
/// - `User-Agent`: This header is ignored and not forwarded to the DB
/// server.
///
/// All other HTTP headers and the body of the request (if present, see
@ -94,10 +98,10 @@ var actions = require("org/arangodb/actions");
/// is returned when everything went well, or if a timeout occurred. In the
/// latter case a body of type application/json indicating the timeout
/// is returned.
///
///
/// @RESTRETURNCODE{403}
/// is returned if ArangoDB is not running in cluster mode.
///
///
/// @RESTRETURNCODE{404}
/// is returned if ArangoDB was not compiled for cluster operation.
////////////////////////////////////////////////////////////////////////////////
@ -210,7 +214,7 @@ actions.defineHttp({
}
else if (p === "x-shard-id") {
shard = req.headers[p];
}
}
else {
headers[p] = req.headers[p];
}
@ -224,7 +228,7 @@ actions.defineHttp({
else {
body = req.requestBody;
}
var r;
if (typeof SYS_CLUSTER_TEST === "undefined") {
actions.resultError(req, res, actions.HTTP_NOT_FOUND,
@ -232,7 +236,7 @@ actions.defineHttp({
}
else {
try {
r = SYS_CLUSTER_TEST(req, res, shard, path, transID,
r = SYS_CLUSTER_TEST(req, res, shard, path, transID,
headers, body, timeout, asyncMode);
if (r.timeout || typeof r.errorMessage === 'string') {
res.responseCode = actions.HTTP_OK;
@ -278,9 +282,9 @@ function parseAuthorization (authorization) {
/// @RESTBODYPARAM{body,json,required}
///
/// @RESTDESCRIPTION Given a description of a cluster, this plans the details
/// of a cluster and returns a JSON description of a plan to start up this
/// of a cluster and returns a JSON description of a plan to start up this
/// cluster. See @ref JSF_Cluster_Planner_Constructor for details.
///
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200} is returned when everything went well.
@ -319,7 +323,7 @@ actions.defineHttp({
for (d in userconfig.dispatchers) {
if (userconfig.dispatchers.hasOwnProperty(d)) {
var dd = userconfig.dispatchers[d];
if (!dd.hasOwnProperty("username") ||
if (!dd.hasOwnProperty("username") ||
!dd.hasOwnProperty("passwd")) {
dd.username = userpwd.username;
dd.passwd = userpwd.passwd;
@ -356,8 +360,8 @@ actions.defineHttp({
/// @RESTBODYPARAM{body,json,required}
///
/// @RESTDESCRIPTION The body must be an object with the following properties:
///
/// - `clusterPlan`: is a cluster plan (see JSF_cluster_planner_POST),
///
/// - `clusterPlan`: is a cluster plan (see JSF_cluster_planner_POST),
/// - `myname`: is the ID of this dispatcher, this is used to decide
/// which commands are executed locally and which are forwarded
/// to other dispatchers
@ -375,13 +379,13 @@ actions.defineHttp({
/// in the cluster are running or not. The additional property
/// `runInfo` (see above) must be bound as well
///
/// - `runInfo": this is needed for the "shutdown" and "isHealthy" actions
/// - `runInfo": this is needed for the "shutdown" and "isHealthy" actions
/// only and should be the structure that "launch" or "relaunch"
/// returned. It contains runtime information like process IDs.
///
/// This call executes the plan by either doing the work personally
/// or by delegating to other dispatchers.
///
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200} is returned when everything went well.
@ -431,7 +435,7 @@ actions.defineHttp({
for (d in input.clusterPlan.dispatchers) {
if (input.clusterPlan.dispatchers.hasOwnProperty(d)) {
var dd = input.clusterPlan.dispatchers[d];
if (!dd.hasOwnProperty("username") ||
if (!dd.hasOwnProperty("username") ||
!dd.hasOwnProperty("passwd")) {
dd.username = userpwd.username;
dd.passwd = userpwd.passwd;
@ -525,7 +529,7 @@ actions.defineHttp({
}
}
});
////////////////////////////////////////////////////////////////////////////////
/// @fn JSF_cluster_check_port_GET
/// @brief allows to check whether a given port is usable
@ -537,7 +541,7 @@ actions.defineHttp({
/// @RESTQUERYPARAM{port,integer,required}
///
/// @RESTDESCRIPTION Checks whether the requested port is usable.
///
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200} is returned when everything went well.
@ -599,7 +603,7 @@ actions.defineHttp({
/// @RESTQUERYPARAM{DBserver,string,required}
///
/// @RESTDESCRIPTION Queries the statistics of the given DBserver
///
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200} is returned when everything went well.
@ -632,7 +636,7 @@ actions.defineHttp({
}
var DBserver = req.parameters.DBserver;
var coord = { coordTransactionID: ArangoClusterInfo.uniqid() };
var options = { coordTransactionID: coord.coordTransactionID, timeout:10 };
var options = { coordTransactionID: coord.coordTransactionID, timeout:10 };
var op = ArangoClusterComm.asyncRequest("GET","server:"+DBserver,"_system",
"/_admin/statistics","",{},options);
var r = ArangoClusterComm.wait(op);
@ -640,10 +644,10 @@ actions.defineHttp({
if (r.status === "RECEIVED") {
res.responseCode = actions.HTTP_OK;
res.body = r.body;
}
}
else if (r.status === "TIMEOUT") {
res.responseCode = actions.HTTP_BAD;
res.body = JSON.stringify( {"error":true,
res.body = JSON.stringify( {"error":true,
"errorMessage": "operation timed out"});
}
else {
@ -662,7 +666,7 @@ actions.defineHttp({
});
actions.defineHttp({
url : "_admin/clusterHistory",
url : "_admin/history",
context : "admin",
prefix : "false",
callback : function (req, res) {
@ -670,48 +674,90 @@ actions.defineHttp({
actions.resultError(req, res, actions.HTTP_FORBIDDEN, 0,
"only POST requests are allowed");
return;
}
if (!require("org/arangodb/cluster").isCoordinator()) {
actions.resultError(req, res, actions.HTTP_FORBIDDEN, 0,
"only allowed on coordinator");
return;
}
if (!req.parameters.hasOwnProperty("DBserver")) {
actions.resultError(req, res, actions.HTTP_BAD,
"required parameter DBserver was not given");
return;
}
var body = actions.getJsonBody(req, res);
if (body === undefined) {
return;
return;
}
var DBserver = req.parameters.DBserver;
var coord = { coordTransactionID: ArangoClusterInfo.uniqid() };
var options = { coordTransactionID: coord.coordTransactionID, timeout:10 };
var op = ArangoClusterComm.asyncRequest("POST","server:"+DBserver,"_system",
"/_api/cursor",JSON.stringify(body),{},options);
var r = ArangoClusterComm.wait(op);
res.contentType = "application/json; charset=utf-8";
if (r.status === "RECEIVED") {
res.responseCode = actions.HTTP_OK;
res.body = r.body;
}
else if (r.status === "TIMEOUT") {
res.responseCode = actions.HTTP_BAD;
res.body = JSON.stringify( {"error":true,
"errorMessage": "operation timed out"});
//build query
var startDate = body.startDate;
var endDate = body.endDate;
var figures = body.figures;
var filterString = "";
if (startDate) {
filterString += " filter u.time > " + startDate;
} else {
endDate = startDate;
}
else {
res.responseCode = actions.HTTP_BAD;
var bodyobj;
try {
bodyobj = JSON.parse(r.body);
}
catch (err) {
}
res.body = JSON.stringify( {"error":true,
"errorMessage": "error from DBserver, possibly DBserver unknown",
"body": bodyobj} );
if (endDate) {
filterString += " filter u.time < " + endDate;
}
if (cluster.isCoordinator() && !req.parameters.hasOwnProperty("DBserver")) {
filterString += " filter u.clusterId == '" + cluster.coordinatorId() +"'";
}
var returnValue = " return u";
if (figures) {
returnValue = " return {time : u.time, server : {uptime : u.server.uptime} ";
var groups = {};
figures.forEach(function(f) {
var g = f.split(".")[0];
if (!groups[g]) {
groups[g] = [];
}
groups[g].push(f.split(".")[1] + " : u." + f);
});
Object.keys(groups).forEach(function(key) {
returnValue += ", " + key + " : {" + groups[key] +"}";
});
returnValue += "}";
}
var myQueryVal = "FOR u in _statistics "+ filterString + " sort u.time" + returnValue;
if (!req.parameters.hasOwnProperty("DBserver")) {
var cursor = internal.AQL_QUERY(myQueryVal,
{},
{batchSize: 100000}
);
res.contentType = "application/json; charset=utf-8";
if (cursor instanceof Error) {
res.responseCode = actions.HTTP_BAD;
res.body = JSON.stringify( {"error":true,
"errorMessage": "an error occured"});
}
res.responseCode = actions.HTTP_OK;
res.body = JSON.stringify({result : cursor.docs});
} else {
var DBserver = req.parameters.DBserver;
var coord = { coordTransactionID: ArangoClusterInfo.uniqid() };
var options = { coordTransactionID: coord.coordTransactionID, timeout:10 };
var op = ArangoClusterComm.asyncRequest("POST","server:"+DBserver,"_system",
"/_api/cursor",JSON.stringify({query: myQueryVal, batchSize: 100000}),{},options);
var r = ArangoClusterComm.wait(op);
res.contentType = "application/json; charset=utf-8";
if (r.status === "RECEIVED") {
res.responseCode = actions.HTTP_OK;
res.body = r.body;
}
else if (r.status === "TIMEOUT") {
res.responseCode = actions.HTTP_BAD;
res.body = JSON.stringify( {"error":true,
"errorMessage": "operation timed out"});
}
else {
res.responseCode = actions.HTTP_BAD;
var bodyobj;
try {
bodyobj = JSON.parse(r.body);
}
catch (err) {
}
res.body = JSON.stringify( {"error":true,
"errorMessage": "error from DBserver, possibly DBserver unknown",
"body": bodyobj} );
}
}
}
});

View File

@ -1,8 +1,3 @@
.disabledBtn {
opacity: 0.4 !important;
cursor: default !important;
}
#collectionPrev, #collectionNext{
cursor: pointer;
}
@ -38,19 +33,6 @@
cursor: pointer;
}
#addDocumentLine {
padding-top: 7px;
padding-right: 0;
margin-right: -1px;
float: right;
color: black;
}
#addDocumentLine:hover,
#sourceView:hover {
cursor: pointer;
}
table.dataTable thead th {
font-weight: 400 !important;
}

View File

@ -114,15 +114,6 @@
border-radius: 0 !important;
}
.modalTooltips span {
font-size: 20px;
opacity: 0.5;
}
.modalTooltips span:hover {
opacity: 0.8;
}
#infoTab, #collectionTab{
padding-right: 10px;
border-bottom: 0;

View File

@ -212,51 +212,29 @@
window.arangoDocumentsStore.reset();
},
getStatisticsHistory: function(params) {
var startDate = params.startDate;
var endDate = params.endDate;
var self = this;
var body = {
startDate : params.startDate,
endDate : params.endDate,
figures : params.figures
};
var server = params.server;
var url = "";
var figures = params.figures;
var self = this;
var filterString = "";
if (startDate) {
filterString += " filter u.time > " + startDate;
} else {
endDate = startDate;
}
if (endDate) {
filterString += " filter u.time < " + endDate;
}
var returnValue = " return u";
if (figures) {
returnValue = " return {time : u.time, server : {uptime : u.server.uptime} ";
var groups = {};
figures.forEach(function(f) {
var g = f.split(".")[0];
if (!groups[g]) {
groups[g] = [];
}
groups[g].push(f.split(".")[1] + " : u." + f);
});
Object.keys(groups).forEach(function(key) {
returnValue += ", " + key + " : {" + groups[key] +"}";
});
returnValue += "}";
}
var myQueryVal = "FOR u in _statistics "+ filterString + " sort u.time" + returnValue;
if (server) {
url = server.endpoint;
url += "/_admin/clusterHistory";
url += "?DBserver=" + server.target;
url += "/_admin/history";
if (server.isDBServer) {
url += "?DBserver=" + server.target;
}
} else {
url = "/_api/cursor";
url = "/_admin/history";
}
$.ajax({
cache: false,
type: 'POST',
async: false,
url: url,
data: JSON.stringify({query: myQueryVal, batchSize: 10000}),
data: JSON.stringify(body),
contentType: "application/json",
success: function(data) {
self.history = data.result;

View File

@ -24,7 +24,7 @@
<th>
<div>
<a class="modalTooltips" data-toggle="tooltip" data-placement="left" title="The maximal size of a journal or datafile (in MB). Must be at least 1.">
<span rel="tooltip" class="arangoicon icon_arangodb_info" style="color:black"></span>
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
@ -40,7 +40,7 @@
<th>
<div>
<a class="modalTooltips" data-toggle="tooltip" data-placement="left" title="Synchronise to disk before returning from a create or update of a document.">
<span class="arangoicon icon_arangodb_info" style="color:black"></span>
<span class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>

View File

@ -104,7 +104,7 @@
<th><input type="text" id="newCapSize" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="modalInfoTooltips" data-toggle="tooltip" data-placement="left" title="The maximal number of documents for the collection.">
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="The maximal number of documents for the collection.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
@ -115,7 +115,7 @@
<th><input type="text" id="newCapByteSize" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="modalInfoTooltips" data-toggle="tooltip" data-placement="left" title="The maximal size of the active document data in the collection.">
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="The maximal size of the active document data in the collection. (min = 16384)">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
@ -128,28 +128,51 @@
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newGeoFields" value=""/></th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="A list with one or two attribute paths."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="A list with one or two attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Geo JSON:</th>
<th>
<input id="newGeoJson" type="checkbox" name="newGeoJson" value="true">
</th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="If a geo-spatial index on a location is constructed and geoJson is true, then the order within the list is longitude followed by latitude."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="If a geo-spatial index on a location is constructed and geoJson is true, then the order within the list is longitude followed by latitude.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Constraint:</th>
<th>
<input id="newGeoConstraint" type="checkbox" name="newGeoConstraint" value="true">
</th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="If constraint is true, then a geo-spatial constraint is created."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="If constraint is true, then a geo-spatial constraint is created.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Ignore Null:</th>
<th>
<input id="newGeoIgnoreNull" type="checkbox" name="newGeoIgnoreNull" value="true">
</th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="If a geo-spatial constraint is created and ignoreNull is true, then documents with a null in location or at least one null in latitude or longitude are ignored."/>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="If a geo-spatial constraint is created and ignoreNull is true, then documents with a null in location or at least one null in latitude or longitude are ignored.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
@ -160,14 +183,25 @@
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newHashFields" value=""/></th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="A list of attribute paths."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="A list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Unique:</th>
<th>
<input id="newHashUnique" type="checkbox" name="newHashUnique" value="true">
</th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="If true, then create a unique index."/>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
@ -177,12 +211,24 @@
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newFulltextFields" value=""/></th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of fields should look like this for example: [ "text" ]."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title='A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of fields should look like this for example: [ "text" ].'>
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Min. length:</th>
<th><input type="text" id="newFulltextMinLength" value=""/></th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="Minimum character length of words to index. Will default to a server-defined value if unspecified. It is thus recommended to set this value explicitly when creating the index."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="Minimum character length of words to index. Will default to a server-defined value if unspecified. It is thus recommended to set this value explicitly when creating the index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
@ -193,14 +239,25 @@
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newSkiplistFields" value=""/></th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="A list of attribute paths."/></th>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="A list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Unique:</th>
<th>
<input id="newSkiplistUnique" type="checkbox" name="newSkiplistUnique" value="true">
</th>
<th><span class="icon_arangodb_info arangoicon" data-original-title="If true, then create a unique index."/>
<th class="tooltipInfoTh">
<div>
<a class="indexTooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>

View File

@ -61,7 +61,6 @@
contentEl: '.contentDiv',
distributionChartDiv : "#distributionChartDiv",
interval: 12000, // in milliseconds
defaultRollPeriod : 1,
detailTemplate: templateEngine.createTemplate("lineChartDetailView.ejs"),
detailEl: '#modalPlaceholder',
@ -411,7 +410,6 @@
dateWindow : [new Date().getTime() - 20 * 60 * 1000,new Date().getTime()],
colors: [this.colors[0]],
xAxisLabelWidth : "60",
rollPeriod: 3,
rightGap: 10,
showRangeSelector: false,
rangeSelectorHeight: 40,
@ -487,6 +485,7 @@
var time = entry.time * 1000;
var newUptime = entry.server.uptime;
if (self.uptime && newUptime < self.uptime) {
var e = {time : (time-(newUptime+10)* 1000 ) /1000};
self.description.get("figures").forEach(function(figure) {
if (!e[figure.group]) {
@ -583,7 +582,7 @@
updateSeries : function(data) {
this.uptime = data.system.uptime;
this.uptime = data.server.uptime;
this.processSingleStatistic(data);
},

View File

@ -13,4 +13,12 @@
.waitModalBackdrop {
opacity: 0.7 !important;
}
}
.modalTooltips span {
font-size: 20px;
color: $c_btn_inverse;
&:hover {
color: $c_black;
}
}

View File

@ -4,4 +4,12 @@
white-space: normal !important;
}
.indexTooltip {
color: $c_btn_inverse;
&:hover {
color: $c_black;
}
span.arangoicon {
font-size: 18px !important;
}
}

View File

@ -1024,6 +1024,13 @@ select.filterSelect {
word-wrap: break-word !important;
white-space: normal !important; }
.indexTooltip {
color: #736b68; }
.indexTooltip:hover {
color: black; }
.indexTooltip span.arangoicon {
font-size: 18px !important; }
.dbselection {
text-overflow: ellipsis;
white-space: nowrap;
@ -1122,6 +1129,12 @@ select.filterSelect {
.waitModalBackdrop {
opacity: 0.7 !important; }
.modalTooltips span {
font-size: 20px;
color: #736b68; }
.modalTooltips span:hover {
color: black; }
div img.searchSubmitIcon {
height: 14px;
margin-left: -18px;

View File

@ -958,10 +958,22 @@ var dispatcherDisabled = function () {
return ArangoServerState.disableDispatcherFrontend();
};
////////////////////////////////////////////////////////////////////////////////
/// @brief coordinatorId
////////////////////////////////////////////////////////////////////////////////
var coordinatorId= function () {
if (! isCoordinator()) {
console.error("not a coordinator");
}
return ArangoServerState.id();
};
// -----------------------------------------------------------------------------
// --SECTION-- MODULE EXPORTS
// -----------------------------------------------------------------------------
exports.coordinatorId = coordinatorId;
exports.dispatcherDisabled = dispatcherDisabled;
exports.handlePlanChange = handlePlanChange;
exports.isCluster = isCluster;