mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'engine-api' of https://github.com/arangodb/arangodb into engine-api
This commit is contained in:
commit
ab62d8e99f
|
@ -6,6 +6,17 @@ if python -c "import sys ; sys.exit(sys.platform != 'cygwin')"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
isCygwin=0
|
||||
if test "`uname -o||true`" == "Cygwin"; then
|
||||
isCygwin=1
|
||||
fi
|
||||
|
||||
SED=sed
|
||||
isMac=0
|
||||
if test "`uname`" == "Darwin"; then
|
||||
isMac=1
|
||||
SED=gsed
|
||||
fi
|
||||
|
||||
# debian mac
|
||||
for f in /usr/bin/md5sum /sbin/md5; do
|
||||
|
@ -29,7 +40,7 @@ fi
|
|||
# remove local from LD_LIBRARY_PATH
|
||||
|
||||
if [ "$LD_LIBRARY_PATH" != "" ]; then
|
||||
LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -e 's/:$//'`;
|
||||
LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | ${SED} -e 's/:$//'`;
|
||||
fi
|
||||
|
||||
# find out if we are running on 32 or 64 bit
|
||||
|
@ -190,7 +201,6 @@ esac
|
|||
|
||||
CLEAN_IT=0
|
||||
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--clang)
|
||||
|
@ -330,7 +340,7 @@ while [ $# -gt 0 ]; do
|
|||
--targetDir)
|
||||
shift
|
||||
TARGET_DIR=$1
|
||||
if test "`uname -o||true`" == "Cygwin"; then
|
||||
if test "${isCygwin}" == 1; then
|
||||
CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} -DPACKAGE_TARGET_DIR=`cygpath --windows $1`"
|
||||
else
|
||||
CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} -DPACKAGE_TARGET_DIR=$1"
|
||||
|
@ -552,7 +562,7 @@ if test -n "${ENTERPRISE_GIT_URL}" ; then
|
|||
GITARGS=`git describe --exact-match --tags ${GITSHA}`
|
||||
echo "I'm on tag: ${GITARGS}"
|
||||
else
|
||||
GITARGS=`git branch --no-color| grep '^\*' | sed "s;\* *;;"`
|
||||
GITARGS=`git branch --no-color| grep '^\*' | ${SED} "s;\* *;;"`
|
||||
if echo $GITARGS |grep -q ' '; then
|
||||
GITARGS=devel
|
||||
fi
|
||||
|
@ -566,7 +576,30 @@ if test -n "${ENTERPRISE_GIT_URL}" ; then
|
|||
if test ! -d enterprise; then
|
||||
git clone ${ENTERPRISE_GIT_URL} enterprise
|
||||
fi
|
||||
(cd enterprise; git checkout master; git fetch --tags; git pull --all; git checkout ${GITARGS}; ${FINAL_PULL} )
|
||||
(
|
||||
cd enterprise;
|
||||
EP_GITSHA=`git log -n1 --pretty='%h'`
|
||||
if git describe --exact-match --tags ${EP_GITSHA}; then
|
||||
EP_GITARGS=`git describe --exact-match --tags ${EP_GITSHA}`
|
||||
echo "I'm on tag: ${GITARGS}"
|
||||
else
|
||||
EP_GITARGS=`git branch --no-color| grep '^\*' | ${SED} "s;\* *;;"`
|
||||
if echo $EP_GITARGS |grep -q ' '; then
|
||||
EP_GITARGS=devel
|
||||
fi
|
||||
echo "I'm on Branch: ${GITARGS}"
|
||||
fi
|
||||
|
||||
if test "${EP_GITARGS}" != "${GITARGS}"; then
|
||||
git checkout master;
|
||||
fi
|
||||
git fetch --tags;
|
||||
git pull --all;
|
||||
if test "${EP_GITARGS}" != "${GITARGS}"; then
|
||||
git checkout ${GITARGS};
|
||||
fi
|
||||
${FINAL_PULL}
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
|
@ -577,7 +610,16 @@ cd ${BUILD_DIR}
|
|||
DST=`pwd`
|
||||
SOURCE_DIR=`compute_relative ${DST}/ ${SRC}/`
|
||||
|
||||
if [ ! -f Makefile -o ! -f CMakeCache.txt -o ! -f ALL_BUILD.vcxproj ]; then
|
||||
set +e
|
||||
if test "${isCygwin}" == 0; then
|
||||
test ! -f Makefile -o ! -f CMakeCache.txt
|
||||
else
|
||||
test ! -f ALL_BUILD.vcxproj -o ! -f CMakeCache.txt
|
||||
fi
|
||||
PARTIAL_STATE=$?
|
||||
set -e
|
||||
|
||||
if test "${PARTIAL_STATE}" == 0; then
|
||||
rm -rf CMakeFiles CMakeCache.txt CMakeCPackOptions.cmake cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake
|
||||
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
|
||||
cmake ${SOURCE_DIR} ${CONFIGURE_OPTIONS} -G "${GENERATOR}" || exit 1
|
||||
|
@ -617,7 +659,7 @@ if test -n "${TARGET_DIR}"; then
|
|||
else
|
||||
# we re-use a generic cpack tarball:
|
||||
${PACKAGE_MAKE} TGZ_package
|
||||
PKG_NAME=`grep CPACK_PACKAGE_FILE_NAME CPackConfig.cmake | sed 's/\r//' |sed -e 's;".$;;' -e 's;.*";;'`
|
||||
PKG_NAME=`grep CPACK_PACKAGE_FILE_NAME CPackConfig.cmake | ${SED} 's/\r//' | ${SED} -e 's;".$;;' -e 's;.*";;'`
|
||||
|
||||
|
||||
TARFILE=arangodb-`uname`${TAR_SUFFIX}.tar.gz
|
||||
|
@ -646,11 +688,12 @@ if test -n "${TARGET_DIR}"; then
|
|||
(cd ${SOURCE_DIR}/enterprise; tar -u -f ${TARFILE_TMP} js)
|
||||
fi
|
||||
|
||||
if test "`uname -o||true`" == "Cygwin"; then
|
||||
SSLDIR=`grep FIND_PACKAGE_MESSAGE_DETAILS_OpenSSL CMakeCache.txt | sed 's/\r//' |sed -e "s/.*optimized;//" -e "s/;.*//" -e "s;/lib.*lib;;" -e "s;\([a-zA-Z]*\):;/cygdrive/\1;"`
|
||||
if test "${isCygwin}" == 1; then
|
||||
SSLDIR=`grep FIND_PACKAGE_MESSAGE_DETAILS_OpenSSL CMakeCache.txt | ${SED} 's/\r//' | ${SED} -e "s/.*optimized;//" -e "s/;.*//" -e "s;/lib.*lib;;" -e "s;\([a-zA-Z]*\):;/cygdrive/\1;"`
|
||||
DLLS=`find ${SSLDIR} -name \*.dll |grep -i release`
|
||||
cp ${DLLS} bin/${BUILD_CONFIG}
|
||||
cp bin/${BUILD_CONFIG}/* bin/
|
||||
cp tests/${BUILD_CONFIG}/* tests/
|
||||
fi
|
||||
tar -u -f ${TARFILE_TMP} \
|
||||
bin etc tests
|
||||
|
@ -676,6 +719,6 @@ if test -n "${TARGET_DIR}"; then
|
|||
fi
|
||||
|
||||
gzip < ${TARFILE_TMP} > ${dir}/${TARFILE}
|
||||
${MD5} < ${dir}/${TARFILE} |sed "s; .*;;" > ${dir}/${TARFILE}.md5
|
||||
${MD5} < ${dir}/${TARFILE} | ${SED} "s; .*;;" > ${dir}/${TARFILE}.md5
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -342,9 +342,21 @@ arangod commandline arguments
|
|||
|
||||
__________________________________________________________________________________________________________
|
||||
|
||||
Linux Cordeumps
|
||||
Linux Coredumps
|
||||
===============
|
||||
Hint: on Ubuntu the `apport` package may interfere with this.
|
||||
Generally coredumps have to be enabled using:
|
||||
|
||||
ulimit -c unlimited
|
||||
|
||||
You should then see:
|
||||
|
||||
ulimit -a
|
||||
core file size (blocks, -c) unlimited
|
||||
|
||||
for each shell and its subsequent processes.
|
||||
|
||||
Hint: on Ubuntu the `apport` package may interfere with this; however you may use the `systemd-coredump` package
|
||||
which automates much of the following:
|
||||
|
||||
So that the unit testing framework can autorun gdb it needs to reliably find the corefiles.
|
||||
In Linux this is configured via the `/proc` filesystem, you can make this reboot permanent by
|
||||
|
@ -365,6 +377,22 @@ Solaris Coredumps
|
|||
Solaris configures the system corefile behaviour via the `coreadm` programm.
|
||||
see https://docs.oracle.com/cd/E19455-01/805-7229/6j6q8svhr/ for more details.
|
||||
|
||||
Analyzing Coredumps on Linux
|
||||
============================
|
||||
We offer debug packages containing the debug symbols for your binaries. Please install them if you didn't compile yourselves.
|
||||
|
||||
Given you saw in the log of the arangod with the PID `25216` that it died, you should then find
|
||||
`/var/tmp/core-V8 WorkerThread-25216-1490887259` with this information. We may now start GDB and inspect whats going on:
|
||||
|
||||
gdb /usr/sbin/arangod /var/tmp/*25216*
|
||||
|
||||
These commands give usefull information about the incident:
|
||||
|
||||
backtrace full
|
||||
thread apply all bt
|
||||
|
||||
The first gives the full stacktrace including variables of the last active thread, the later one the stacktraces of all threads.
|
||||
|
||||
Windows debugging
|
||||
=================
|
||||
For the average \*nix user windows debugging has some awkward methods.
|
||||
|
|
|
@ -161,7 +161,11 @@ TRI_voc_rid_t RocksDBCollection::revision(transaction::Methods* trx) const {
|
|||
state->findCollection(_logicalCollection->cid()));
|
||||
TRI_ASSERT(trxCollection != nullptr);
|
||||
|
||||
return trxCollection->revision();
|
||||
TRI_voc_rid_t revisionId = trxCollection->revision();
|
||||
if (!revisionId) {
|
||||
revisionId = _revisionId;
|
||||
}
|
||||
return revisionId;
|
||||
}
|
||||
|
||||
uint64_t RocksDBCollection::numberDocuments() const { return _numberDocuments; }
|
||||
|
@ -188,8 +192,6 @@ void RocksDBCollection::open(bool ignoreErrors) {
|
|||
RocksDBEngine* engine =
|
||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE);
|
||||
auto counterValue = engine->counterManager()->loadCounter(this->objectId());
|
||||
TRI_ASSERT(counterValue.first >= 0);
|
||||
TRI_ASSERT(counterValue.second >= 0);
|
||||
_numberDocuments = counterValue.first;
|
||||
_revisionId = counterValue.second;
|
||||
}
|
||||
|
@ -943,12 +945,6 @@ int RocksDBCollection::insertDocument(arangodb::transaction::Methods* trx,
|
|||
|
||||
rocksdb::Transaction* rtrx = rocksTransaction(trx);
|
||||
|
||||
/*
|
||||
LOG_TOPIC(ERR, Logger::ENGINE)
|
||||
<< "INSERT DOCUMENT. COLLECTION '" << _logicalCollection->name()
|
||||
<< "', OBJECTID: " << _objectId << ", REVISIONID: " << revisionId;
|
||||
|
||||
*/
|
||||
rocksdb::Status status = rtrx->Put(key.string(), value.string());
|
||||
|
||||
if (!status.ok()) {
|
||||
|
@ -971,11 +967,6 @@ int RocksDBCollection::insertDocument(arangodb::transaction::Methods* trx,
|
|||
if (res == TRI_ERROR_OUT_OF_MEMORY) {
|
||||
return res;
|
||||
}
|
||||
if (res == TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED) {
|
||||
LOG_TOPIC(ERR, Logger::FIXME)
|
||||
<< "#" << trx->state()->id()
|
||||
<< " UNIQUE CONSTRAINT VIOLATION IN INDEX: #" << i;
|
||||
}
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
if (res == TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED ||
|
||||
result == TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -236,16 +236,7 @@ std::vector<std::pair<RocksDBKey, RocksDBValue>> collectionKVPairs(
|
|||
});
|
||||
return rv;
|
||||
}
|
||||
std::vector<std::pair<RocksDBKey, RocksDBValue>> indexKVPairs(
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t cid) {
|
||||
std::vector<std::pair<RocksDBKey, RocksDBValue>> rv;
|
||||
RocksDBKeyBounds bounds = RocksDBKeyBounds::DatabaseIndexes(databaseId, cid);
|
||||
iterateBounds(bounds, [&rv](rocksdb::Iterator* it) {
|
||||
rv.emplace_back(RocksDBKey(it->key()),
|
||||
RocksDBValue(RocksDBEntryType::Index, it->value()));
|
||||
});
|
||||
return rv;
|
||||
}
|
||||
|
||||
std::vector<std::pair<RocksDBKey, RocksDBValue>> viewKVPairs(
|
||||
TRI_voc_tick_t databaseId) {
|
||||
std::vector<std::pair<RocksDBKey, RocksDBValue>> rv;
|
||||
|
|
|
@ -82,7 +82,6 @@ std::size_t countKeyRange(rocksdb::DB*, rocksdb::ReadOptions const&,
|
|||
Result removeLargeRange(rocksdb::TransactionDB* db, RocksDBKeyBounds const& bounds);
|
||||
|
||||
std::vector<std::pair<RocksDBKey,RocksDBValue>> collectionKVPairs(TRI_voc_tick_t databaseId);
|
||||
std::vector<std::pair<RocksDBKey,RocksDBValue>> indexKVPairs(TRI_voc_tick_t databaseId, TRI_voc_cid_t cid);
|
||||
std::vector<std::pair<RocksDBKey,RocksDBValue>> viewKVPairs(TRI_voc_tick_t databaseId);
|
||||
|
||||
// optional switch to std::function to reduce amount of includes and to avoid template
|
||||
|
|
|
@ -81,15 +81,17 @@ RocksDBCounterManager::RocksDBCounterManager(rocksdb::DB* db, double interval)
|
|||
|
||||
void RocksDBCounterManager::beginShutdown() {
|
||||
Thread::beginShutdown();
|
||||
_condition.broadcast();
|
||||
// CONDITION_LOCKER(locker, _condition);
|
||||
// locker.signal();
|
||||
|
||||
// wake up the thread that may be waiting in run()
|
||||
CONDITION_LOCKER(guard, _condition);
|
||||
guard.broadcast();
|
||||
}
|
||||
|
||||
void RocksDBCounterManager::run() {
|
||||
while (!isStopping()) {
|
||||
CONDITION_LOCKER(locker, _condition);
|
||||
locker.wait(static_cast<uint64_t>(_interval * 1000000.0));
|
||||
CONDITION_LOCKER(guard, _condition);
|
||||
guard.wait(static_cast<uint64_t>(_interval * 1000000.0));
|
||||
|
||||
if (!isStopping()) {
|
||||
this->sync();
|
||||
}
|
||||
|
|
|
@ -589,6 +589,7 @@ void RocksDBEngine::createIndex(TRI_vocbase_t* vocbase,
|
|||
TRI_voc_cid_t collectionId,
|
||||
TRI_idx_iid_t indexId,
|
||||
arangodb::velocypack::Slice const& data) {
|
||||
/*
|
||||
rocksdb::WriteOptions options; // TODO: check which options would make sense
|
||||
auto key = RocksDBKey::Index(vocbase->id(), collectionId, indexId);
|
||||
auto value = RocksDBValue::Index(data);
|
||||
|
@ -598,6 +599,7 @@ void RocksDBEngine::createIndex(TRI_vocbase_t* vocbase,
|
|||
if (!result.ok()) {
|
||||
THROW_ARANGO_EXCEPTION(result.errorNumber());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void RocksDBEngine::dropIndex(TRI_vocbase_t* vocbase,
|
||||
|
@ -770,22 +772,23 @@ Result RocksDBEngine::dropDatabase(TRI_voc_tick_t id) {
|
|||
|
||||
// remove collections
|
||||
for (auto const& val : collectionKVPairs(id)) {
|
||||
TRI_voc_cid_t cid =
|
||||
basics::VelocyPackHelper::stringUInt64(val.second.slice(), "cid");
|
||||
// remove indexes
|
||||
for (auto& val : indexKVPairs(id, cid)) {
|
||||
// delete index documents
|
||||
uint64_t objectId = basics::VelocyPackHelper::stringUInt64(
|
||||
val.second.slice(), "objectId");
|
||||
RocksDBKeyBounds bounds = RocksDBKeyBounds::IndexEntries(objectId);
|
||||
res = rocksutils::removeLargeRange(_db, bounds);
|
||||
if (res.fail()) {
|
||||
return res;
|
||||
}
|
||||
// delete index
|
||||
res = globalRocksDBRemove(val.first.string(), options);
|
||||
if (res.fail()) {
|
||||
return res;
|
||||
VPackSlice indexes = val.second.slice().get("indexes");
|
||||
if (indexes.isArray()) {
|
||||
for (auto const& it : VPackArrayIterator(indexes)) {
|
||||
// delete index documents
|
||||
uint64_t objectId = basics::VelocyPackHelper::stringUInt64(
|
||||
it, "objectId");
|
||||
RocksDBKeyBounds bounds = RocksDBKeyBounds::IndexEntries(objectId);
|
||||
res = rocksutils::removeLargeRange(_db, bounds);
|
||||
if (res.fail()) {
|
||||
return res;
|
||||
}
|
||||
// delete index
|
||||
res = globalRocksDBRemove(val.first.string(), options);
|
||||
if (res.fail()) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,6 @@ RocksDBKey RocksDBKey::Collection(TRI_voc_tick_t databaseId,
|
|||
return RocksDBKey(RocksDBEntryType::Collection, databaseId, collectionId);
|
||||
}
|
||||
|
||||
RocksDBKey RocksDBKey::Index(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId,
|
||||
TRI_idx_iid_t indexId) {
|
||||
return RocksDBKey(RocksDBEntryType::Index, databaseId, collectionId, indexId);
|
||||
}
|
||||
|
||||
RocksDBKey RocksDBKey::Document(uint64_t collectionId,
|
||||
TRI_voc_rid_t revisionId) {
|
||||
return RocksDBKey(RocksDBEntryType::Document, collectionId, revisionId);
|
||||
|
@ -120,14 +114,6 @@ TRI_voc_cid_t RocksDBKey::collectionId(rocksdb::Slice const& slice) {
|
|||
return collectionId(slice.data(), slice.size());
|
||||
}
|
||||
|
||||
TRI_idx_iid_t RocksDBKey::indexId(RocksDBKey const& key) {
|
||||
return indexId(key._buffer.data(), key._buffer.size());
|
||||
}
|
||||
|
||||
TRI_idx_iid_t RocksDBKey::indexId(rocksdb::Slice const& slice) {
|
||||
return indexId(slice.data(), slice.size());
|
||||
}
|
||||
|
||||
TRI_voc_cid_t RocksDBKey::viewId(RocksDBKey const& key) {
|
||||
return viewId(key._buffer.data(), key._buffer.size());
|
||||
}
|
||||
|
@ -231,26 +217,6 @@ RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t first, uint64_t second)
|
|||
}
|
||||
}
|
||||
|
||||
RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t first, uint64_t second,
|
||||
uint64_t third)
|
||||
: _type(type), _buffer() {
|
||||
switch (_type) {
|
||||
case RocksDBEntryType::Index: {
|
||||
size_t length =
|
||||
sizeof(char) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint64_t);
|
||||
_buffer.reserve(length);
|
||||
_buffer.push_back(static_cast<char>(_type));
|
||||
uint64ToPersistent(_buffer, first); // databaseId
|
||||
uint64ToPersistent(_buffer, second); // collectionId
|
||||
uint64ToPersistent(_buffer, third); // indexId
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_BAD_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
||||
RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t first,
|
||||
arangodb::StringRef const& docKey,
|
||||
VPackSlice const& indexData)
|
||||
|
@ -335,7 +301,6 @@ TRI_voc_tick_t RocksDBKey::databaseId(char const* data, size_t size) {
|
|||
switch (type) {
|
||||
case RocksDBEntryType::Database:
|
||||
case RocksDBEntryType::Collection:
|
||||
case RocksDBEntryType::Index:
|
||||
case RocksDBEntryType::View: {
|
||||
TRI_ASSERT(size >= (sizeof(char) + sizeof(uint64_t)));
|
||||
return uint64FromPersistent(data + sizeof(char));
|
||||
|
@ -351,8 +316,7 @@ TRI_voc_cid_t RocksDBKey::collectionId(char const* data, size_t size) {
|
|||
TRI_ASSERT(size >= sizeof(char));
|
||||
RocksDBEntryType type = static_cast<RocksDBEntryType>(data[0]);
|
||||
switch (type) {
|
||||
case RocksDBEntryType::Collection:
|
||||
case RocksDBEntryType::Index: {
|
||||
case RocksDBEntryType::Collection: {
|
||||
TRI_ASSERT(size >= (sizeof(char) + (2 * sizeof(uint64_t))));
|
||||
return uint64FromPersistent(data + sizeof(char) + sizeof(uint64_t));
|
||||
}
|
||||
|
@ -362,21 +326,6 @@ TRI_voc_cid_t RocksDBKey::collectionId(char const* data, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
TRI_idx_iid_t RocksDBKey::indexId(char const* data, size_t size) {
|
||||
TRI_ASSERT(data != nullptr);
|
||||
TRI_ASSERT(size >= sizeof(char));
|
||||
RocksDBEntryType type = static_cast<RocksDBEntryType>(data[0]);
|
||||
switch (type) {
|
||||
case RocksDBEntryType::Index: {
|
||||
TRI_ASSERT(size >= (sizeof(char) + (3 * sizeof(uint64_t))));
|
||||
return uint64FromPersistent(data + sizeof(char) + (2 * sizeof(uint64_t)));
|
||||
}
|
||||
|
||||
default:
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_TYPE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t RocksDBKey::viewId(char const* data, size_t size) {
|
||||
TRI_ASSERT(data != nullptr);
|
||||
TRI_ASSERT(size >= sizeof(char));
|
||||
|
|
|
@ -56,12 +56,6 @@ class RocksDBKey {
|
|||
static RocksDBKey Collection(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Create a fully-specified index key
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static RocksDBKey Index(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId,
|
||||
TRI_idx_iid_t indexId);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Create a fully-specified document key
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -140,7 +134,7 @@ class RocksDBKey {
|
|||
/// @brief Extracts the databaseId from a key
|
||||
///
|
||||
/// May be called only on the following key types: Database, Collection,
|
||||
/// Index, and View. Other types will throw.
|
||||
/// View. Other types will throw.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static TRI_voc_tick_t databaseId(RocksDBKey const&);
|
||||
static TRI_voc_tick_t databaseId(rocksdb::Slice const&);
|
||||
|
@ -148,21 +142,12 @@ class RocksDBKey {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Extracts the collectionId from a key
|
||||
///
|
||||
/// May be called only on the the following key types: Collection and Index.
|
||||
/// May be called only on the the following key types: Collection.
|
||||
/// Other types will throw.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static TRI_voc_cid_t collectionId(RocksDBKey const&);
|
||||
static TRI_voc_cid_t collectionId(rocksdb::Slice const&);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Extracts the indexId from a key
|
||||
///
|
||||
/// May be called only on Index keys (not index values). Other types will
|
||||
/// throw.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static TRI_idx_iid_t indexId(RocksDBKey const&);
|
||||
static TRI_idx_iid_t indexId(rocksdb::Slice const&);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Extracts the viewId from a key
|
||||
///
|
||||
|
@ -215,8 +200,6 @@ class RocksDBKey {
|
|||
private:
|
||||
RocksDBKey(RocksDBEntryType type, uint64_t first);
|
||||
RocksDBKey(RocksDBEntryType type, uint64_t first, uint64_t second);
|
||||
RocksDBKey(RocksDBEntryType type, uint64_t first, uint64_t second,
|
||||
uint64_t third);
|
||||
RocksDBKey(RocksDBEntryType type, uint64_t first, VPackSlice const& slice);
|
||||
RocksDBKey(RocksDBEntryType type, uint64_t first, arangodb::StringRef const& docKey,
|
||||
VPackSlice const& indexData);
|
||||
|
@ -228,7 +211,6 @@ class RocksDBKey {
|
|||
static RocksDBEntryType type(char const* data, size_t size);
|
||||
static TRI_voc_tick_t databaseId(char const* data, size_t size);
|
||||
static TRI_voc_cid_t collectionId(char const* data, size_t size);
|
||||
static TRI_idx_iid_t indexId(char const* data, size_t size);
|
||||
static TRI_voc_cid_t viewId(char const* data, size_t size);
|
||||
static TRI_voc_rid_t revisionId(char const* data, size_t size);
|
||||
static StringRef primaryKey(char const* data, size_t size);
|
||||
|
|
|
@ -44,16 +44,6 @@ RocksDBKeyBounds RocksDBKeyBounds::DatabaseCollections(
|
|||
return RocksDBKeyBounds(RocksDBEntryType::Collection, databaseId);
|
||||
}
|
||||
|
||||
RocksDBKeyBounds RocksDBKeyBounds::DatabaseIndexes(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t cid) {
|
||||
return RocksDBKeyBounds(RocksDBEntryType::Index, databaseId, cid);
|
||||
}
|
||||
|
||||
RocksDBKeyBounds RocksDBKeyBounds::CollectionIndexes(
|
||||
TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
return RocksDBKeyBounds(RocksDBEntryType::Index, databaseId, collectionId);
|
||||
}
|
||||
|
||||
RocksDBKeyBounds RocksDBKeyBounds::CollectionDocuments(uint64_t collectionId) {
|
||||
return RocksDBKeyBounds(RocksDBEntryType::Document, collectionId);
|
||||
}
|
||||
|
@ -206,29 +196,6 @@ RocksDBKeyBounds::RocksDBKeyBounds(RocksDBEntryType type, uint64_t first)
|
|||
}
|
||||
}
|
||||
|
||||
RocksDBKeyBounds::RocksDBKeyBounds(RocksDBEntryType type, uint64_t first,
|
||||
uint64_t second)
|
||||
: _type(type), _startBuffer(), _endBuffer() {
|
||||
switch (_type) {
|
||||
case RocksDBEntryType::Index: {
|
||||
size_t length = sizeof(char) + (2 * sizeof(uint64_t));
|
||||
_startBuffer.reserve(length);
|
||||
_startBuffer.push_back(static_cast<char>(_type));
|
||||
uint64ToPersistent(_startBuffer, first);
|
||||
uint64ToPersistent(_startBuffer, second);
|
||||
|
||||
_endBuffer.clear();
|
||||
_endBuffer.append(_startBuffer);
|
||||
nextPrefix(_endBuffer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_BAD_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
||||
RocksDBKeyBounds::RocksDBKeyBounds(RocksDBEntryType type, uint64_t first,
|
||||
std::string const& second)
|
||||
: _type(type), _startBuffer(), _endBuffer() {
|
||||
|
|
|
@ -50,18 +50,6 @@ class RocksDBKeyBounds {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
static RocksDBKeyBounds DatabaseCollections(TRI_voc_tick_t databaseId);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Bounds for all collections belonging to a specified database
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static RocksDBKeyBounds DatabaseIndexes(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t cid);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Bounds for all indexes belonging to a specified collection
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static RocksDBKeyBounds CollectionIndexes(TRI_voc_tick_t databaseId,
|
||||
TRI_voc_cid_t collectionId);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Bounds for all documents belonging to a specified collection
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -139,7 +127,6 @@ class RocksDBKeyBounds {
|
|||
private:
|
||||
RocksDBKeyBounds(RocksDBEntryType type);
|
||||
RocksDBKeyBounds(RocksDBEntryType type, uint64_t first);
|
||||
RocksDBKeyBounds(RocksDBEntryType type, uint64_t first, uint64_t second);
|
||||
RocksDBKeyBounds(RocksDBEntryType type, uint64_t first,
|
||||
std::string const& second);
|
||||
RocksDBKeyBounds(RocksDBEntryType type, uint64_t first,
|
||||
|
|
|
@ -255,8 +255,8 @@ RocksDBPrimaryIndex::RocksDBPrimaryIndex(
|
|||
StaticStrings::KeyString, false)}}),
|
||||
true, false,
|
||||
basics::VelocyPackHelper::stringUInt64(info, "objectId")) {
|
||||
_useCache = false;
|
||||
// createCache();
|
||||
_useCache = true;
|
||||
createCache();
|
||||
}
|
||||
|
||||
RocksDBPrimaryIndex::~RocksDBPrimaryIndex() {}
|
||||
|
|
|
@ -176,6 +176,8 @@ Result RocksDBTransactionState::commitTransaction(
|
|||
}
|
||||
|
||||
rocksdb::Snapshot const* snap = this->_rocksReadOptions.snapshot;
|
||||
TRI_ASSERT(snap != nullptr);
|
||||
|
||||
for (auto& trxCollection : _collections) {
|
||||
RocksDBTransactionCollection* collection =
|
||||
static_cast<RocksDBTransactionCollection*>(trxCollection);
|
||||
|
@ -190,6 +192,7 @@ Result RocksDBTransactionState::commitTransaction(
|
|||
coll->setRevision(collection->revision());
|
||||
RocksDBEngine* engine =
|
||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE);
|
||||
|
||||
engine->counterManager()->updateCounter(
|
||||
coll->objectId(), snap, adjustment, collection->revision());
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ static rocksdb::Slice Collection(
|
|||
&collection),
|
||||
1);
|
||||
|
||||
static RocksDBEntryType index = RocksDBEntryType::Index;
|
||||
static rocksdb::Slice Index(
|
||||
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(&index), 1);
|
||||
static RocksDBEntryType counterVal = RocksDBEntryType::CounterValue;
|
||||
static rocksdb::Slice CounterValue(
|
||||
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(&counterVal), 1);
|
||||
|
||||
static RocksDBEntryType document = RocksDBEntryType::Document;
|
||||
static rocksdb::Slice Document(
|
||||
|
@ -74,34 +74,28 @@ static rocksdb::Slice UniqueIndexValue(
|
|||
static RocksDBEntryType view = RocksDBEntryType::View;
|
||||
static rocksdb::Slice View(
|
||||
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(&view), 1);
|
||||
|
||||
static RocksDBEntryType counterVal = RocksDBEntryType::CounterValue;
|
||||
static rocksdb::Slice CounterValue(
|
||||
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(&counterVal), 1);
|
||||
}
|
||||
|
||||
rocksdb::Slice const& arangodb::rocksDBSlice(RocksDBEntryType const& type) {
|
||||
switch (type) {
|
||||
case RocksDBEntryType::Document:
|
||||
return Document;
|
||||
case RocksDBEntryType::Collection:
|
||||
return Collection;
|
||||
case RocksDBEntryType::Database:
|
||||
return Database;
|
||||
case RocksDBEntryType::Collection:
|
||||
return Collection;
|
||||
case RocksDBEntryType::CounterValue:
|
||||
return CounterValue;
|
||||
case RocksDBEntryType::Document:
|
||||
return Document;
|
||||
case RocksDBEntryType::PrimaryIndexValue:
|
||||
return PrimaryIndexValue;
|
||||
case RocksDBEntryType::EdgeIndexValue:
|
||||
return EdgeIndexValue;
|
||||
case RocksDBEntryType::Index:
|
||||
return Index;
|
||||
case RocksDBEntryType::IndexValue:
|
||||
return IndexValue;
|
||||
case RocksDBEntryType::UniqueIndexValue:
|
||||
return UniqueIndexValue;
|
||||
case RocksDBEntryType::View:
|
||||
return View;
|
||||
case RocksDBEntryType::CounterValue:
|
||||
return CounterValue;
|
||||
}
|
||||
|
||||
return Document; // avoids warning - errorslice instead ?!
|
||||
|
|
|
@ -34,14 +34,13 @@ namespace arangodb {
|
|||
enum class RocksDBEntryType : char {
|
||||
Database = '0',
|
||||
Collection = '1',
|
||||
Index = '2',
|
||||
CounterValue = '2',
|
||||
Document = '3',
|
||||
PrimaryIndexValue = '4',
|
||||
EdgeIndexValue = '5',
|
||||
IndexValue = '6',
|
||||
UniqueIndexValue = '7',
|
||||
View = '8',
|
||||
CounterValue = '9'
|
||||
View = '8'
|
||||
};
|
||||
|
||||
rocksdb::Slice const& rocksDBSlice(RocksDBEntryType const& type);
|
||||
|
|
|
@ -37,10 +37,6 @@ RocksDBValue RocksDBValue::Collection(VPackSlice const& data) {
|
|||
return RocksDBValue(RocksDBEntryType::Collection, data);
|
||||
}
|
||||
|
||||
RocksDBValue RocksDBValue::Index(VPackSlice const& data) {
|
||||
return RocksDBValue(RocksDBEntryType::Index, data);
|
||||
}
|
||||
|
||||
RocksDBValue RocksDBValue::Document(VPackSlice const& data) {
|
||||
return RocksDBValue(RocksDBEntryType::Document, data);
|
||||
}
|
||||
|
@ -141,7 +137,6 @@ RocksDBValue::RocksDBValue(RocksDBEntryType type, VPackSlice const& data)
|
|||
switch (_type) {
|
||||
case RocksDBEntryType::Database:
|
||||
case RocksDBEntryType::Collection:
|
||||
case RocksDBEntryType::Index:
|
||||
case RocksDBEntryType::Document:
|
||||
case RocksDBEntryType::View: {
|
||||
_buffer.reserve(static_cast<size_t>(data.byteSize()));
|
||||
|
|
|
@ -47,7 +47,6 @@ class RocksDBValue {
|
|||
|
||||
static RocksDBValue Database(VPackSlice const& data);
|
||||
static RocksDBValue Collection(VPackSlice const& data);
|
||||
static RocksDBValue Index(VPackSlice const& data);
|
||||
static RocksDBValue Document(VPackSlice const& data);
|
||||
static RocksDBValue PrimaryIndexValue(TRI_voc_rid_t revisionId);
|
||||
static RocksDBValue EdgeIndexValue();
|
||||
|
@ -84,7 +83,7 @@ class RocksDBValue {
|
|||
/// @brief Extracts the VelocyPack data from a value
|
||||
///
|
||||
/// May be called only values of the following types: Database, Collection,
|
||||
/// Index, Document, and View. Other types will throw.
|
||||
/// Document, and View. Other types will throw.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static VPackSlice data(RocksDBValue const&);
|
||||
static VPackSlice data(rocksdb::Slice const&);
|
||||
|
|
|
@ -299,7 +299,7 @@ void BenchFeature::start() {
|
|||
|
||||
report(client, results);
|
||||
if (!ok) {
|
||||
std::cout << "At least one of the runs yielded some failures!" << std::endl;
|
||||
std::cout << "At least one of the runs produced failures!" << std::endl;
|
||||
}
|
||||
benchmark->tearDown();
|
||||
|
||||
|
@ -432,11 +432,10 @@ void BenchFeature::printResult(BenchRunResult const& result) {
|
|||
<< std::endl;
|
||||
|
||||
if (result.failures > 0) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "WARNING: " << result.failures
|
||||
<< " arangobench request(s) failed!";
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << result.failures << " arangobench request(s) failed!";
|
||||
}
|
||||
if (result.incomplete > 0) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "WARNING: " << result.incomplete
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << result.incomplete
|
||||
<< " arangobench requests with incomplete results!";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ class BenchmarkThread : public arangodb::Thread {
|
|||
}
|
||||
_warningCount++;
|
||||
if (_warningCount < MaxWarnings) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "batch operation failed because server did not reply";
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "single operation failed because server did not reply";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ class BenchmarkThread : public arangodb::Thread {
|
|||
_warningCount++;
|
||||
if (_warningCount < MaxWarnings) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "request for URL '" << url << "' failed with HTTP code "
|
||||
<< result->getHttpReturnCode();
|
||||
<< result->getHttpReturnCode() << ": " << std::string(result->getBody().c_str(), result->getBody().length());
|
||||
} else if (_warningCount == MaxWarnings) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME) << "...more warnings...";
|
||||
}
|
||||
|
|
|
@ -744,7 +744,7 @@
|
|||
|
||||
#define fileno _fileno
|
||||
#define fsync _commit
|
||||
#define isatty _isatty
|
||||
#define isatty _cyg_isatty
|
||||
#define putenv _putenv
|
||||
#define sleep TRI_sleep
|
||||
#define tzset _tzset
|
||||
|
|
|
@ -605,3 +605,51 @@ void ADB_WindowsExitFunction(int exitCode, void* data) {
|
|||
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
// Detect cygwin ssh / terminals
|
||||
int
|
||||
_cyg_isatty (int fd)
|
||||
{
|
||||
// detect standard windows ttys:
|
||||
if (_isatty (fd)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
HANDLE fh;
|
||||
|
||||
char buff[sizeof(FILE_NAME_INFO) + sizeof(WCHAR)*MAX_PATH];
|
||||
FILE_NAME_INFO *FileInformation = (FILE_NAME_INFO*) buff;
|
||||
|
||||
/* get the HANDLE for the filedescriptor. */
|
||||
fh = (HANDLE) _get_osfhandle (fd);
|
||||
if (!fh || fh == INVALID_HANDLE_VALUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cygwin consoles are pipes. If its not, no reason to continue: */
|
||||
if (GetFileType (fh) != FILE_TYPE_PIPE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!GetFileInformationByHandleEx(fh, FileNameInfo,
|
||||
FileInformation, sizeof(buff))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we expect something along the lines of: \cygwin-0eb90a57d5759b7b-pty3-to-master?? - if we find it its a tty.
|
||||
PWCHAR cp = (PWCHAR) FileInformation->FileName;
|
||||
if (!wcsncmp (cp, L"\\cygwin-", 8)
|
||||
&& !wcsncmp (cp + 24, L"-pty", 4)) {
|
||||
cp = wcschr (cp + 28, '-');
|
||||
if (!cp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!wcsncmp (cp, L"-from-master", sizeof("-from-master") - 1) ||
|
||||
!wcsncmp (cp, L"-to-master", sizeof("-to-master") -1)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -130,9 +130,15 @@ void TRI_LogWindowsEventlog(char const* func, char const* file, int line,
|
|||
void TRI_WindowsEmergencyLog(char const* func, char const* file, int line,
|
||||
char const* fmt, ...);
|
||||
|
||||
#define LOG_FATAL_WINDOWS(...) \
|
||||
#define LOG_FATAL_WINDOWS(...) \
|
||||
do { \
|
||||
TRI_WindowsEmergencyLog(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief detects whether an FD is connected to a (cygwin-)tty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int _cyg_isatty (int fd);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue