1
0
Fork 0

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

This commit is contained in:
Michael Hackstein 2016-11-04 18:15:35 +01:00
commit 1c34e0e14b
21 changed files with 201 additions and 64 deletions

View File

@ -10,6 +10,7 @@ branches:
- "2.7"
- "2.8"
- "3.0"
- "3.1"
language: cpp
cache: ccache

View File

@ -518,6 +518,13 @@ if [ ! -f Makefile -o ! -f CMakeCache.txt ]; then
cmake ${SOURCE_DIR} ${CONFIGURE_OPTIONS} -G "${GENERATOR}" || exit 1
fi
if [ -n "$CPACK" -a -n "${TARGET_DIR}" -a -z "${MSVC}" ]; then
if ! grep -q CMAKE_STRIP CMakeCache.txt; then
echo "cmake failed to detect strip; refusing to build unstripped packages!"
exit 1
fi
fi
${MAKE_CMD_PREFIX} ${MAKE} ${MAKE_PARAMS}
(cd ${SOURCE_DIR}; git rev-parse HEAD > last_compiled_version.sha)

View File

@ -496,11 +496,11 @@ bool Agent::load() {
}
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Reassembling spearhead and read stores.";
{
MUTEX_LOCKER(commitLock, _ioLock);
// {
// MUTEX_LOCKER(commitLock, _ioLock);
_spearhead.apply(
_state.slices(_lastCommitIndex + 1), _lastCommitIndex, _constituent.term());
}
// }
{
CONDITION_LOCKER(guard, _appendCV);
@ -910,7 +910,7 @@ void Agent::notify(query_t const& message) {
// Rebuild key value stores
bool Agent::rebuildDBs() {
MUTEX_LOCKER(mutexLocker, _ioLock);
_spearhead.apply(_state.slices(_lastCommitIndex + 1), _lastCommitIndex,

View File

@ -367,7 +367,7 @@ bool Inception::estimateRAFTInterval() {
2.0, true);
}
}
std::this_thread::sleep_for(std::chrono::duration<double,std::milli>(5));
std::this_thread::sleep_for(std::chrono::duration<double,std::milli>(1));
}
auto s = system_clock::now();
@ -468,9 +468,9 @@ bool Inception::estimateRAFTInterval() {
}
}
maxmean = 1.e-3*std::ceil(1.e3*(.5 + 1.0e-3*(maxmean+3*maxstdev)));
maxmean = 1.e-3*std::ceil(1.e3*(.2 + 1.0e-3*(maxmean+3*maxstdev)));
LOG_TOPIC(INFO, Logger::AGENCY)
LOG_TOPIC(DEBUG, Logger::AGENCY)
<< "Auto-adapting RAFT timing to: {" << maxmean
<< ", " << 5.0*maxmean << "}s";

View File

@ -272,7 +272,7 @@ std::vector<log_t> State::get(arangodb::consensus::index_t start,
std::vector<VPackSlice> State::slices(arangodb::consensus::index_t start,
arangodb::consensus::index_t end) const {
std::vector<VPackSlice> slices;
// MUTEX_LOCKER(mutexLocker, _logLock); // Cannot be read lock (Compaction)
MUTEX_LOCKER(mutexLocker, _logLock); // Cannot be read lock (Compaction)
if (_log.empty()) {
return slices;
@ -562,34 +562,38 @@ bool State::loadRemaining() {
}
auto result = queryResult.result->slice();
index_t back = 0;
{
MUTEX_LOCKER(logLock, _logLock);
if (result.isArray()) {
MUTEX_LOCKER(logLock, _logLock);
if (result.isArray()) {
_log.clear();
for (auto const& i : VPackArrayIterator(result)) {
buffer_t tmp = std::make_shared<arangodb::velocypack::Buffer<uint8_t>>();
auto ii = i.resolveExternals();
auto req = ii.get("request");
tmp->append(req.startAs<char const>(), req.byteSize());
try {
_log.push_back(
_log.clear();
for (auto const& i : VPackArrayIterator(result)) {
buffer_t tmp = std::make_shared<arangodb::velocypack::Buffer<uint8_t>>();
auto ii = i.resolveExternals();
auto req = ii.get("request");
tmp->append(req.startAs<char const>(), req.byteSize());
try {
_log.push_back(
log_t(std::stoi(ii.get(StaticStrings::KeyString).copyString()),
static_cast<term_t>(ii.get("term").getUInt()), tmp));
} catch (std::exception const& e) {
LOG_TOPIC(ERR, Logger::AGENCY)
} catch (std::exception const& e) {
LOG_TOPIC(ERR, Logger::AGENCY)
<< "Failed to convert " +
ii.get(StaticStrings::KeyString).copyString() +
" to integer via std::stoi."
ii.get(StaticStrings::KeyString).copyString() +
" to integer via std::stoi."
<< e.what();
}
}
}
TRI_ASSERT(!_log.empty());
back = _log.back().index;
}
_agent->rebuildDBs();
TRI_ASSERT(!_log.empty());
_agent->lastCommitted(_log.back().index);
_agent->lastCommitted(back);
return true;
}

View File

@ -1615,7 +1615,7 @@ AgencyCommResult AgencyComm::sendWithFailover(
using namespace std::chrono;
auto start = system_clock::now();
seconds ltimeout(static_cast<int>(timeout));
duration<double> to(1.e3*timeout);
{
READ_LOCKER(readLocker, AgencyComm::_globalLock);
@ -1666,7 +1666,7 @@ AgencyCommResult AgencyComm::sendWithFailover(
break;
}
if (system_clock::now() - start > ltimeout) {
if (system_clock::now() - start > to) {
LOG_TOPIC(ERR, Logger::AGENCYCOMM) << "Timed out waiting for leader "
<< agencyEndpoint->_endpoint->specification() << " tries: " << ltries;
break;

View File

@ -65,8 +65,15 @@ bool SimpleAttributeEqualityMatcher::matchOne(
// we can use the index
// use slightly different cost calculation for IN than for EQ
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
estimatedItems *= op->getMember(1)->numMembers();
estimatedCost *= op->getMember(1)->numMembers();
size_t values = 1;
auto m = op->getMember(1);
if (m->isArray() && m->numMembers() > 1) {
// attr IN [ a, b, c ] => this will produce multiple items, so count
// them!
values = m->numMembers();
}
estimatedItems *= values;
estimatedCost *= values;
return true;
}
}

View File

@ -75,7 +75,7 @@
bindVars['param' + i] = '%' + f.val + '%';
} else if (f.op === 'IN' || f.op === 'NOT IN ') {
if (f.val.indexOf(',') !== -1) {
bindVars['param' + i] = f.val.split(',').map(function(v) { return v.replace(/(^ +| +$)/g, ''); });
bindVars['param' + i] = f.val.split(',').map(function (v) { return v.replace(/(^ +| +$)/g, ''); });
} else {
bindVars['param' + i] = [ f.val ];
}

View File

@ -73,6 +73,7 @@
<option value="LIKE">LIKE</option>
<option value="IN">IN</option>
<option value="NOT IN">NOT IN</option>
<option value="=~">REGEX</option>
</select><input id="attribute_value0" type="text" placeholder="Attribute value" class="filterValue">
<a id="addFilterItem" class="add-filter-item"><i class="fa fa-plus-circle"></i></a>
</div>

View File

@ -434,7 +434,8 @@
' <option value="&gt;=">&gt;=</option>' +
' <option value="LIKE">LIKE</option>' +
' <option value="IN">IN</option>' +
' <option value="NOT IN">NOT IN</option>' +
' <option value="=~">NOT IN</option>' +
' <option value="REGEX">REGEX</option>' +
'</select>' +
'<input id="attribute_value' + num +
'" type="text" placeholder="Attribute value" ' +

View File

@ -219,7 +219,15 @@
// render
this.graphData.modified = this.parseData(this.graphData.original, this.graphData.graphInfo);
this.renderGraph(this.graphData.modified, null, true);
var success = false;
try {
this.renderGraph(this.graphData.modified, null, true);
success = true;
} catch (ignore) {
}
return success;
},
renderAQL: function (data) {

View File

@ -61,21 +61,29 @@
}
$('.bodyWrapper').show();
self.checkVersion();
return this;
},
checkVersion: function () {
var self = this;
window.setTimeout(function () {
var a = document.getElementById('loginSVG');
var svgDoc = a.contentDocument;
var svgItem;
if (window.isEnterprise) {
svgItem = svgDoc.getElementById('logo-enterprise');
if (frontendConfig.isEnterprise !== undefined) {
if (frontendConfig.isEnterprise) {
svgItem = svgDoc.getElementById('logo-enterprise');
} else {
svgItem = svgDoc.getElementById('logo-community');
}
svgItem.setAttribute('visibility', 'visible');
} else {
svgItem = svgDoc.getElementById('logo-community');
self.checkVersion();
}
svgItem.setAttribute('visibility', 'visible');
}, 300);
return this;
}, 150);
},
clear: function () {

View File

@ -1179,7 +1179,7 @@
name: 'increaseFontSize',
bindKey: {win: 'Shift-Alt-Up', linux: 'Shift-Alt-Up', mac: 'Shift-Alt-Up'},
exec: function (editor) {
var newSize = parseInt(self.aqlEditor.getFontSize().match(/\d+/)[0]) + 1;
var newSize = parseInt(self.aqlEditor.getFontSize().match(/\d+/)[0], 10) + 1;
newSize += 'pt';
self.aqlEditor.setFontSize(newSize);
setOutputEditorFontSize(newSize);
@ -1191,7 +1191,7 @@
name: 'decreaseFontSize',
bindKey: {win: 'Shift-Alt-Down', linux: 'Shift-Alt-Down', mac: 'Shift-Alt-Down'},
exec: function (editor) {
var newSize = parseInt(self.aqlEditor.getFontSize().match(/\d+/)[0]) - 1;
var newSize = parseInt(self.aqlEditor.getFontSize().match(/\d+/)[0], 10) - 1;
newSize += 'pt';
self.aqlEditor.setFontSize(newSize);
setOutputEditorFontSize(newSize);
@ -1726,6 +1726,8 @@
if (window.location.hash === '#queries') {
var outputEditor = ace.edit('outputEditor' + counter);
var success;
// handle explain query case
if (!data.msg) {
// handle usual query
@ -1743,21 +1745,30 @@
$('.outputEditorWrapper .tableWrapper').css('max-height', maxHeight);
$('#outputEditor' + counter).hide();
success = true;
} else if (result.defaultType === 'graph') {
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after('<div id="outputGraph' + counter + '"></div>');
$('#outputGraph' + counter).show();
self.renderOutputGraph(result, counter);
success = self.renderOutputGraph(result, counter);
$('#outputEditor' + counter).hide();
if (success) {
$('#outputEditor' + counter).hide();
$('#outputEditorWrapper' + counter + ' #copy2gV').show();
$('#outputEditorWrapper' + counter + ' #copy2gV').bind('click', function () {
self.showResultInGraphViewer(result, counter);
});
$('#outputEditorWrapper' + counter + ' #copy2gV').show();
$('#outputEditorWrapper' + counter + ' #copy2gV').bind('click', function () {
self.showResultInGraphViewer(result, counter);
});
} else {
$('#outputGraph' + counter).remove();
}
}
// add active class to choosen display method
$('#' + result.defaultType + '-switch').addClass('active').css('display', 'inline');
if (success !== false) {
$('#' + result.defaultType + '-switch').addClass('active').css('display', 'inline');
} else {
$('#json-switch').addClass('active').css('display', 'inline');
}
var appendSpan = function (value, icon, css) {
if (!css) {
@ -2094,7 +2105,7 @@
};
var found = false;
if (!Array.isArray(result)) {
toReturn.defaultType = 'json';
return toReturn;
@ -2136,7 +2147,7 @@
var totalb = result.length;
_.each(result, function (obj) {
if (obj._from && obj._to) {
if (obj._from && obj._to && obj._id) {
hitsb++;
}
});
@ -2322,7 +2333,9 @@
id: '#outputGraph' + counter,
data: data
});
this.graphViewer.renderAQLPreview();
var success = this.graphViewer.renderAQLPreview();
return success;
},
showResultInGraphViewer: function (data, counter) {

View File

@ -43,7 +43,7 @@ static Completer* COMPLETER = nullptr;
static void LinenoiseCompletionGenerator(char const* text,
linenoiseCompletions* lc) {
if (COMPLETER) {
if (COMPLETER && text != nullptr) {
std::vector<std::string> alternatives = COMPLETER->alternatives(text);
ShellBase::sortAlternatives(alternatives);

View File

@ -3925,7 +3925,14 @@ std::string TRI_StringifyV8Exception(v8::Isolate* isolate,
l = "";
}
l += std::string((size_t)(end - start + 1), '^');
// in fact, we observed start being greater than end sometimes...
// this does not make sense and seems to be a bug in V8, but it happens
// so we need to work around this
if (end >= start) {
l += std::string((size_t)(end - start + 1), '^');
} else {
l = "^";
}
result += "!" + l + "\n";
}

View File

@ -5,13 +5,19 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}/..
EP=""
for i in $@; do
if test "$i" == "--enterprise"; then
EP="EP"
fi
done
./Installation/Jenkins/build.sh \
standard \
--rpath \
--parallel 5 \
--package Bundle \
--buildDir build-bundle \
--buildDir build-${EP}bundle \
--prefix "/opt/arangodb" \
--targetDir /var/tmp/ \
--clang \

View File

@ -6,12 +6,20 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}/..
EP=""
for i in $@; do
if test "$i" == "--enterprise"; then
EP="EP"
fi
done
./Installation/Jenkins/build.sh \
standard \
--rpath \
--parallel 25 \
--package DEB \
--buildDir build-deb \
--buildDir build-${EP}deb \
--targetDir /var/tmp/ \
--jemalloc \
--noopt \

View File

@ -5,11 +5,17 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}/..
EP="y"
for i in $@; do
if test "$i" == "--enterprise"; then
EP="e"
fi
done
./Installation/Jenkins/build.sh \
standard \
--msvc \
--buildDir /cygdrive/c/b/y/ \
--buildDir /cygdrive/c/b/${EP}/ \
--package NSIS \
--targetDir /var/tmp/ \
$@

View File

@ -6,11 +6,18 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}/..
EP=""
for i in $@; do
if test "$i" == "--enterprise"; then
EP="EP"
fi
done
./Installation/Jenkins/build.sh \
standard \
--rpath \
--package RPM \
--buildDir build-rpm \
--buildDir build-${EP}rpm \
--targetDir /var/tmp/ \
--jemalloc \
--noopt \

View File

@ -8,6 +8,13 @@ if test -z ${CXX}; then
export CXX=g++
fi
EP=""
for i in $@; do
if test "$i" == "--enterprise"; then
EP="EP"
fi
done
export CPU_CORES=$(grep -c ^processor /proc/cpuinfo)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -20,7 +27,7 @@ cd ${DIR}/..
--parallel ${CPU_CORES} \
--package TGZ \
--snap \
--buildDir build-snap \
--buildDir build-${EP}snap \
--targetDir /var/tmp/ \
--noopt \
$@

View File

@ -11,6 +11,7 @@ function help() {
echo " -w/--wait-for-sync Boolean (true|false default: true)"
echo " -m/--use-microtime Boolean (true|false default: false)"
echo " -s/--start-delays Integer ( default: 0)"
echo " -r/--random-delays Integer (true|false default: false)"
echo " -g/--gossip-mode Integer (0: Announce first endpoint to all"
echo " 1: Grow list of known endpoints for each"
echo " 2: Cyclic default: 0)"
@ -22,6 +23,28 @@ function help() {
}
function shuffle() {
local i tmp size max rand
size=${#aaid[*]}
max=$(( 32768 / size * size ))
for ((i=size-1; i>0; i--)); do
while (( (rand=$RANDOM) >= max )); do :; done
rand=$(( rand % (i+1) ))
tmp=${aaid[i]} aaid[i]=${aaid[rand]} aaid[rand]=$tmp
done
}
function isuint () {
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
return 1;
else
return 0
fi
}
NRAGENTS=3
POOLSZ=""
TRANSPORT="tcp"
@ -54,6 +77,9 @@ while [[ ${1} ]]; do
-g|--gossip-mode)
GOSSIP_MODE=${2}
shift;;
-r|--random-delays)
RANDOM_DELAYS=${2}
shift;;
-s|--start-delays)
START_DELAYS=${2}
shift;;
@ -93,6 +119,7 @@ printf "\n"
printf " use-microtime: %s," "$USE_MICROTIME"
printf " wait-for-sync: %s," "$WAIT_FOR_SYNC"
printf " start-delays: %s," "$START_DELAYS"
printf " random-delays: %s," "$RANDOM_DELAYS"
printf " gossip-mode: %s\n" "$GOSSIP_MODE"
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
@ -115,15 +142,23 @@ if [ "$GOSSIP_MODE" = "0" ]; then
GOSSIP_PEERS=" --agency.endpoint $TRANSPORT://localhost:$BASE"
fi
rm -rf agency
#rm -rf agency
mkdir -p agency
PIDS=""
for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
aaid=(`seq 0 $(( $POOLSZ - 1 ))`)
shuffle
count=1
for aid in "${aaid[@]}"; do
port=$(( $BASE + $aid ))
if [ "$GOSSIP_MODE" = 2 ]; then
nport=$(( $BASE + $(( $(( $aid + 1 )) % 3 ))))
GOSSIP_PEERS=" --agency.endpoint $TRANSPORT://localhost:$nport"
fi
printf " starting agent %s " "$aid"
build/bin/arangod \
-c none \
--agency.activate true \
@ -146,7 +181,6 @@ for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
--server.authentication false \
--server.endpoint $TRANSPORT://localhost:$port \
--server.statistics false \
--server.threads 4 \
$SSLKEYFILE \
> agency/$port.stdout 2>&1 &
PIDS+=$!
@ -154,7 +188,19 @@ for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
if [ "$GOSSIP_MODE" == "1" ]; then
GOSSIP_PEERS+=" --agency.endpoint $TRANSPORT://localhost:$port"
fi
sleep $START_DELAYS
if [ $count -lt $POOLSZ ]; then
if isuint $START_DELAYS; then
printf "fixed delay %02ds " "$START_DELAYS"
sleep $START_DELAYS
fi
if [ "$RANDOM_DELAYS" == "true" ] ; then
delay=$(( RANDOM % 16 ))
printf "random delay %02ds" "$delay"
sleep $delay
fi
((count+=1))
fi
echo
done
echo " done. Your agents are ready at port $BASE onward."