1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into readcache

This commit is contained in:
jsteemann 2016-07-26 16:25:50 +02:00
commit 008fc46dfc
15 changed files with 172 additions and 67 deletions

View File

@ -64,7 +64,7 @@ bool Parser::configureWriteQuery(AstNode const* collectionNode,
QueryResult Parser::parse(bool withDetails) {
char const* q = queryString();
if (q == nullptr || *q == '\0') {
if (q == nullptr || *q == '\0' || remainingLength() == 0) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_QUERY_EMPTY);
}

View File

@ -323,6 +323,8 @@ void Query::setExecutionTime() {
/// @brief extract a region from the query
std::string Query::extractRegion(int line, int column) const {
TRI_ASSERT(_queryString != nullptr);
// note: line numbers reported by bison/flex start at 1, columns start at 0
int currentLine = 1;
int currentColumn = 0;
@ -330,7 +332,7 @@ std::string Query::extractRegion(int line, int column) const {
char c;
char const* p = _queryString;
while ((c = *p)) {
while ((static_cast<size_t>(p - _queryString) < _queryLength) && (c = *p)) {
if (currentLine > line ||
(currentLine >= line && currentColumn >= column)) {
break;

View File

@ -288,29 +288,40 @@ authRouter.get('/graph/:name', function (req, res) {
var _ = require('lodash');
var name = req.pathParams.name;
var gm = require('@arangodb/general-graph');
var colors = [
'#EACD3F',
'#6F308A',
'#DA6927',
'#98CDE5',
'#B81F34',
'#C0BC82',
'#7F7E80',
'#61A547',
'#60A446',
'#D285B0',
'#4477B3',
'#DD8465',
'#473896',
'#E0A02F',
'#8F2689',
'#E7E655',
'#7C1514',
'#93AD3C',
'#6D3312',
'#D02C26',
'#2A3415'
];
var colors = {
default: [
'#68BDF6',
'#6DCE9E',
'#FF756E',
'#DE9BF9',
'#FB95AF',
'#FFD86E',
'#A5ABB6'
],
highContrast: [
'#EACD3F',
'#6F308A',
'#DA6927',
'#98CDE5',
'#B81F34',
'#C0BC82',
'#7F7E80',
'#61A547',
'#60A446',
'#D285B0',
'#4477B3',
'#DD8465',
'#473896',
'#E0A02F',
'#8F2689',
'#E7E655',
'#7C1514',
'#93AD3C',
'#6D3312',
'#D02C26',
'#2A3415'
]
};
// var traversal = require("@arangodb/graph/traversal");
var graph = gm._graph(name);
@ -426,7 +437,7 @@ authRouter.get('/graph/:name', function (req, res) {
if (tmpObjEdges.hasOwnProperty(coll)) {
edgeObj.color = tmpObjEdges[coll];
} else {
tmpObjEdges[coll] = colors[Object.keys(tmpObjEdges).length];
tmpObjEdges[coll] = colors.default[Object.keys(tmpObjEdges).length];
edgeObj.color = tmpObjEdges[coll];
}
} else if (config.edgeColorAttribute !== '') {
@ -435,7 +446,7 @@ authRouter.get('/graph/:name', function (req, res) {
if (tmpObjEdges.hasOwnProperty(attr)) {
edgeObj.color = tmpObjEdges[attr];
} else {
tmpObjEdges[attr] = colors[Object.keys(tmpObjEdges).length];
tmpObjEdges[attr] = colors.default[Object.keys(tmpObjEdges).length];
edgeObj.color = tmpObjEdges[attr];
}
}
@ -487,7 +498,7 @@ authRouter.get('/graph/:name', function (req, res) {
if (tmpObjNodes.hasOwnProperty(coll)) {
nodeObj.color = tmpObjNodes[coll];
} else {
tmpObjNodes[coll] = colors[Object.keys(tmpObjNodes).length];
tmpObjNodes[coll] = colors.default[Object.keys(tmpObjNodes).length];
nodeObj.color = tmpObjNodes[coll];
}
} else if (config.nodeColorAttribute !== '') {
@ -496,7 +507,7 @@ authRouter.get('/graph/:name', function (req, res) {
if (tmpObjNodes.hasOwnProperty(attr)) {
nodeObj.color = tmpObjNodes[attr];
} else {
tmpObjNodes[attr] = colors[Object.keys(tmpObjNodes).length];
tmpObjNodes[attr] = colors.default[Object.keys(tmpObjNodes).length];
nodeObj.color = tmpObjNodes[attr];
}
}

File diff suppressed because one or more lines are too long

View File

@ -2710,4 +2710,4 @@ var cutByResolution = function (str) {
</div>
<div id="workMonitorContent" class="innerContent">
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="graphSettingsContent" style="display: none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1469461944991"></script><script src="app.js?version=1469461944991"></script></body></html>
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="graphSettingsContent" style="display: none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1469532665016"></script><script src="app.js?version=1469532665016"></script></body></html>

File diff suppressed because one or more lines are too long

View File

@ -75,7 +75,7 @@
},
'nodeLabelByCollection': {
type: 'select',
name: 'Label by coll?',
name: 'Label by collection?',
desc: 'Set label text by collection. If activated node label attribute will be ignored.',
yes: {
name: 'Yes',
@ -100,12 +100,12 @@
},
'nodeColorAttribute': {
type: 'string',
name: 'Colorize attr',
name: 'Color attribute',
desc: 'If an attribute is given, nodes will then be colorized by the attribute. This setting ignores default node color if set.'
},
'nodeColorByCollection': {
type: 'select',
name: 'Colorize by coll?',
name: 'Color by collection?',
no: {
name: 'No',
val: 'false'
@ -132,7 +132,7 @@
},
'edgeLabelByCollection': {
type: 'select',
name: 'Label by coll?',
name: 'Label by collection?',
desc: 'Set label text by collection. If activated edge label attribute will be ignored.',
yes: {
name: 'Yes',
@ -157,12 +157,12 @@
},
'edgeColorAttribute': {
type: 'string',
name: 'Colorize attr',
name: 'Color attribute',
desc: 'If an attribute is given, edges will then be colorized by the attribute. This setting ignores default edge color if set.'
},
'edgeColorByCollection': {
type: 'select',
name: 'Colorize by coll?',
name: 'Color by collection?',
no: {
name: 'No',
val: 'false'
@ -315,7 +315,7 @@
depth: '2',
nodeColor: '#2ecc71',
nodeColorAttribute: '',
nodeColorByCollection: 'false',
nodeColorByCollection: 'true',
nodeLabelThreshold: 10,
edgeColor: '#cccccc',
edgeColorAttribute: '',
@ -323,10 +323,10 @@
edgeLabelThreshold: 10,
nodeLabel: '_key',
edgeLabel: '',
edgeType: 'line',
edgeType: 'arrow',
nodeSize: '',
edgeEditable: 'false',
nodeLabelByCollection: 'true',
nodeLabelByCollection: 'false',
edgeLabelByCollection: 'true',
nodeStart: ''
};

View File

@ -921,7 +921,7 @@
wheel.multiSelect = true;
wheel.clickModeRotate = false;
wheel.slicePathFunction = slicePath().DonutSlice;
wheel.createWheel([icon.edit, icon.trash, icon.play, icon.connect]);
wheel.createWheel([icon.edit, icon.trash, icon.flag, icon.connect]);
wheel.navItems[0].selected = false;
wheel.navItems[0].hovered = false;
@ -992,6 +992,7 @@
ctx.beginPath();
ctx.moveTo(fromX, fromY);
ctx.lineTo(toX, toY);
ctx.strokeStyle = this.newEdgeColor;
ctx.stroke();
}
},
@ -1024,7 +1025,7 @@
setStartNode: function (id) {
this.graphConfig.nodeStart = id;
this.graphSettingsView.saveGraphSettings(null, id);
this.graphSettingsView.saveGraphSettings(undefined, undefined, id);
},
editNode: function (id) {
@ -1147,15 +1148,18 @@
}
}
// sigmajs graph settings
var settings = {
borderSize: 3,
defaultNodeBorderColor: '#8c8c8c',
doubleClickEnabled: false,
minNodeSize: 20,
minEdgeSize: 1,
maxEdgeSize: 4,
enableEdgeHovering: true,
edgeHoverColor: '#000',
defaultEdgeHoverColor: '#000',
defaultEdgeType: 'line',
edgeHoverColor: '#8c8c8c',
defaultEdgeHoverColor: '#8c8c8c',
defaultEdgeType: 'arrow',
edgeHoverSizeRatio: 2,
edgeHoverExtremities: true,
nodesPowRatio: 1,
@ -1278,9 +1282,13 @@
var callback = function (error, data) {
if (!error) {
var attributes = '';
attributes += 'ID <span class="nodeId">' + data._id + '</span>';
if (Object.keys(data).length > 3) {
attributes += 'KEYS ';
}
_.each(data, function (value, key) {
if (key !== '_key' && key !== '_id' && key !== '_rev' && key !== '_from' && key !== '_to') {
attributes += ('<span class="nodeAttribute">' + key + '</span>');
attributes += '<span class="nodeAttribute">' + key + '</span>';
}
});
var string = '<div id="nodeInfoDiv" class="nodeInfoDiv">' + attributes + '</div>';
@ -1299,24 +1307,32 @@
};
s.bind('overNode', function (e) {
showAttributes(e, true);
if (self.contextState.createEdge === true) {
self.newEdgeColor = '#ff0000';
} else {
self.newEdgeColor = '#000000';
}
});
s.bind('overEdge', function (e) {
s.bind('clickEdge', function (e) {
showAttributes(e, false);
});
/*
s.bind('outNode', function (e) {
if (self.contextState.createEdge === false) {
$('.nodeInfoDiv').remove();
}
});
*/
/*
s.bind('outEdge', function (e) {
if (self.contextState.createEdge === false) {
$('.nodeInfoDiv').remove();
}
});
*/
s.bind('clickNode', function (e) {
if (self.contextState.createEdge === true) {
@ -1328,6 +1344,8 @@
// validate edgeDefinitions
var foundEdgeDefinitions = self.getEdgeDefinitionCollections(fromCollection, toCollection);
self.addEdgeModal(foundEdgeDefinitions, self.contextState._from, self.contextState._to);
} else {
showAttributes(e, true);
}
});

View File

@ -456,6 +456,11 @@
var self = this;
var queryData = this.readQueryData();
if (queryData === 'false') {
return;
}
$('#outputEditorWrapper' + counter + ' .queryExecutionTime').text('');
this.execPending = false;
@ -575,7 +580,7 @@
fillSelectBoxes: function () {
// fill select box with # of results
var querySize = 1000;
var querySize = 100;
var sizeBox = $('#querySize');
sizeBox.empty();
@ -999,7 +1004,7 @@
name: 'executeSelectedQuery',
bindKey: {win: 'Ctrl-Alt-Return', mac: 'Command-Alt-Return', linux: 'Ctrl-Alt-Return'},
exec: function () {
self.executeQuery(true);
self.executeQuery(undefined, true);
}
});
@ -1256,7 +1261,7 @@
return quit;
},
executeQuery: function (selected) {
executeQuery: function (e, selected) {
if (this.verifyQueryAndParams()) {
return;
}
@ -1309,16 +1314,25 @@
} else {
data.query = this.aqlEditor.getValue();
}
if (sizeBox.val() === 'all') {
data.batchSize = 1000000;
if (data.query.length === 0) {
if (selected) {
arangoHelper.arangoError('Query', 'Your query selection is empty!');
} else {
arangoHelper.arangoError('Query', 'Your query is empty!');
}
data = false;
} else {
data.batchSize = parseInt(sizeBox.val(), 10);
if (sizeBox.val() === 'all') {
data.batchSize = 1000000;
} else {
data.batchSize = parseInt(sizeBox.val(), 10);
}
if (Object.keys(this.bindParamTableObj).length > 0) {
data.bindVars = this.bindParamTableObj;
}
}
if (Object.keys(this.bindParamTableObj).length > 0) {
data.bindVars = this.bindParamTableObj;
}
return JSON.stringify(data);
},
@ -1327,6 +1341,10 @@
var queryData = this.readQueryData(selected);
if (queryData === 'false') {
return;
}
if (queryData) {
sentQueryEditor.setValue(self.aqlEditor.getValue(), 1);
@ -1598,7 +1616,7 @@
if (error.code === 409) {
return;
}
if (error.code !== 400 && error.code !== 404) {
if (error.code !== 400 && error.code !== 404 && error.code !== 500) {
arangoHelper.arangoNotification('Query', 'Successfully aborted.');
}
}

View File

@ -46,6 +46,8 @@
.nodeInfoDiv {
border-radius: 3px;
bottom: 0;
color: $c-bluegrey-dark;
font-weight: 500;
height: 25px;
left: 165px;
overflow: hidden;
@ -53,7 +55,8 @@
right: 15px;
z-index: 10;
.nodeAttribute {
.nodeAttribute,
.nodeId {
background-color: $c-info-blue;
border-radius: 3px;
color: $c-white;
@ -61,6 +64,11 @@
margin-right: 5px;
padding: 2px 5px;
}
.nodeId {
background-color: $c-positive;
}
}
.nodeContextMenu {

48
scripts/setupPerfEvents.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# This requires the perf utility to be installed and the OS must be linux.
# Compile with CMAKE_BUILD_TYPE=RelWithDebInfo in the subdirectory "build".
# Run this script in the main source directory.
#
# This script sets up performance monitoring events to measure single
# document operations. Run this script with sudo when the ArangoDB
# process is already running. Then do
# sudo perf record -e "probe_arangod:*" -aR sleep 60
# (to sample for 60 seconds). A file "perf.data" is written to the
# current directory.
# Dump the events in this file with
# sudo perf script
# This logs the times when individual threads hit the events.
# Remove all events with
# sudo perf probe -d "probe_arangod:*"
# List events with
# sudo perf probe -l
ARANGOD_EXECUTABLE=build/bin/arangod
perf probe -x $ARANGOD_EXECUTABLE -d "probe_arangod:*"
echo Adding events, this takes a few seconds...
addEvent() {
x=$1
echo $x
perf probe -x $ARANGOD_EXECUTABLE -a $x=$x 2> /dev/null
perf probe -x $ARANGOD_EXECUTABLE -a ${x}Ret=$x%return 2> /dev/null
}
echo Single document operations...
addEvent insertLocal
addEvent removeLocal
addEvent modifyLocal
addEvent documentLocal
echo Single document operations on coordinator...
addEvent insertCoordinator
addEvent removeCoordinator
addEvent updateCoordinator
addEvent replaceCoordinator
addEvent documentCoordinator
echo work method in HttpServerJob
addEvent work@HttpServerJob.cpp
echo Done.