1
0
Fork 0

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

This commit is contained in:
AutoBuilder 2016-02-25 14:26:16 +01:00
commit df1c591f51
139 changed files with 5281 additions and 1197 deletions

10
.gitignore vendored
View File

@ -25,14 +25,14 @@ js-*.h
testresult.json
build/
build*/
Build64/
Build32/
Debug64/
Debug32/
Release64/
Release32/
WindowsLibraries
WindowsLibraries/
core
TAGS
@ -62,18 +62,24 @@ Documentation/Books/Makefile
Documentation/Books/Users/node_modules/
Documentation/Examples/*.generated
Documentation/Books/ppbooks/
UnitTests/HttpInterface/logs/
UnitTests/basics_suite
UnitTests/geo_suite
arangod/Aql/grammar.c
arangod/Aql/grammar.cpp
arangod/Aql/grammar.h
arangod/Aql/grammar.hpp
arangod/Aql/grammar.output
arangod/Aql/tokens.cpp
bin/
etc/arangodb/*.conf
js/common/bootstrap/errors.js
lib/Basics/local-configuration.h
lib/Basics/stamp-h2
lib/Basics/voc-errors.cpp

View File

@ -1,71 +0,0 @@
# -*- mode: Makefile; -*-
## -----------------------------------------------------------------------------
## --SECTION-- ETCD
## -----------------------------------------------------------------------------
################################################################################
### @brief etcd
################################################################################
@top_srcdir@/bin/etcd-arango$(PROGRAM_SUFFIX):
if GO_AVAILABLE
@echo
@echo "--------------------------------------------------------------------------------"
@echo "BUILDING etcd"
@echo "--------------------------------------------------------------------------------"
@echo
else
@echo
@echo "********************************************************************************"
@echo "SKIPPING etcd - you won't be able to use clusters!"
@echo "Install go from golang.org and re-run configure to change"
@echo "********************************************************************************"
@echo
endif
if ENABLE_INTERNAL_GO
cd @top_srcdir@/3rdParty/etcd \
&& GOROOT="`pwd`/../go-$(TRI_BITS)/" PATH="`pwd`/../go-$(TRI_BITS)/bin:$$PATH" ./build
else
if GO_AVAILABLE
cd @top_srcdir@/3rdParty/etcd && ./build
endif
endif
if GO_AVAILABLE
cp @top_srcdir@/3rdParty/etcd/bin/etcd @top_srcdir@/bin/etcd-arango$(PROGRAM_SUFFIX)
endif
if ENABLE_DARWIN
else
if GO_AVAILABLE
strip @top_srcdir@/bin/etcd-arango$(PROGRAM_SUFFIX)
endif
endif
if GO_AVAILABLE
@echo
@echo "--------------------------------------------------------------------------------"
@echo "BUILD etcd FINISHED"
@echo "--------------------------------------------------------------------------------"
@echo
endif
################################################################################
### @brief additional files to remove
################################################################################
CLEANUP_3RD += clean-etcd
clean-etcd:
cd @top_srcdir@/3rdParty/etcd && go clean
rm -f @top_srcdir@/bin/etcd-arango
## -----------------------------------------------------------------------------
## --SECTION-- END-OF-FILE
## -----------------------------------------------------------------------------
## Local Variables:
## mode: outline-minor
## outline-regexp: "^\\(### @brief\\|## --SECTION--\\|# -\\*- \\)"
## End:

View File

@ -522,6 +522,76 @@ include_directories(${ICU_INCLUDE_DIR})
include(ArangoDBMacros)
################################################################################
## ERRORS FILE
################################################################################
if (USE_MAINTAINER_MODE)
set(ERROR_FILES
lib/Basics/voc-errors.h
lib/Basics/voc-errors.cpp
js/common/bootstrap/errors.js
)
set(ERROR_FILES_GEN)
set(ERRORS_DAT lib/Basics/errors.dat)
foreach (m IN LISTS ERROR_FILES)
add_custom_command(
OUTPUT
${CMAKE_SOURCE_DIR}/${m}
COMMAND
./utils/generateErrorfile.sh ./${ERRORS_DAT} ./${m}
DEPENDS
${CMAKE_SOURCE_DIR}/${ERRORS_DAT}
WORKING_DIRECTORY
${CMAKE_SOURCE_DIR}
COMMENT
"Building errors files ${m}"
VERBATIM
)
list(APPEND ERROR_FILES_GEN ${CMAKE_SOURCE_DIR}/${m})
endforeach ()
add_custom_target(errorfiles ALL DEPENDS ${ERROR_FILES_GEN})
endif ()
################################################################################
## MIMETYPES FILE
################################################################################
if (USE_MAINTAINER_MODE)
set(MIMETYPES_FILES
lib/Basics/voc-mimetypes.h
lib/Basics/voc-mimetypes.cpp
js/common/modules/@arangodb/mimetypes.js
)
set(MIMETYPES_FILES_GEN)
set(MIMETYPES_DAT lib/Basics/mimetypes.dat)
foreach (m IN LISTS MIMETYPES_FILES)
add_custom_command(
OUTPUT
${CMAKE_SOURCE_DIR}/${m}
COMMAND
./utils/generateMimetypes.sh ./${MIMETYPES_DAT} ./${m}
DEPENDS
${CMAKE_SOURCE_DIR}/${MIMETYPES_DAT}
WORKING_DIRECTORY
${CMAKE_SOURCE_DIR}
COMMENT
"Building mimetypes files ${m}"
VERBATIM
)
list(APPEND MIMETYPES_FILES_GEN ${CMAKE_SOURCE_DIR}/${m})
endforeach ()
add_custom_target(mimetypes ALL DEPENDS ${MIMETYPES_FILES_GEN})
endif ()
################################################################################
## SUB-PROJECTS
################################################################################

View File

@ -23,7 +23,8 @@ if (USE_MAINTAINER_MODE)
OUTPUT
${mdst}
COMMAND
${CMAKE_SOURCE_DIR}/utils/manPages.sh ${msrc} ${mdst} ${ARANGODB_VERSION}
${CMAKE_SOURCE_DIR}/utils/manPages.sh
${msrc} ${mdst} ${ARANGODB_VERSION}
DEPENDS
${msrc}
WORKING_DIRECTORY
@ -40,7 +41,8 @@ if (USE_MAINTAINER_MODE)
OUTPUT
${CMAKE_SOURCE_DIR}/README
COMMAND
${CMAKE_SOURCE_DIR}/utils/generateREADME.sh ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/README
${CMAKE_SOURCE_DIR}/utils/generateREADME.sh
${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/README
DEPENDS
${CMAKE_SOURCE_DIR}/README.md
WORKING_DIRECTORY

View File

@ -1,46 +0,0 @@
# -*- mode: Makefile; -*-
## -----------------------------------------------------------------------------
## --SECTION-- DOCUMENTATION
## -----------------------------------------------------------------------------
################################################################################
### @brief install man pages
################################################################################
dist_man_MANS += \
Documentation/man/man1/arangob.1 \
Documentation/man/man1/arangodump.1 \
Documentation/man/man1/arangoimp.1 \
Documentation/man/man1/arangorestore.1 \
Documentation/man/man1/arangosh.1 \
Documentation/man/man8/rcarangod.8 \
Documentation/man/man8/arangod.8 \
Documentation/man/man8/arango-dfdb.8 \
Documentation/man/man8/foxx-manager.8
################################################################################
### @brief man pages
################################################################################
.PHONY: man
man:
for section in 1 8; do \
for i in `ls Documentation/man$$section`; do \
sed -f Documentation/Scripts/man.sed \
-e "s/\<SECTION\>/$$section/" \
-e "s/\<COMMAND\>/$$i/g" \
-e "s/DATE/`date`/g" Documentation/man$$section/$$i \
> Documentation/man/man$$section/$$i.$$section; \
done; \
done
## -----------------------------------------------------------------------------
## --SECTION-- END-OF-FILE
## -----------------------------------------------------------------------------
## Local Variables:
## mode: outline-minor
## outline-regexp: "^\\(### @brief\\|## --SECTION--\\|# -\\*- \\)"
## End:

View File

@ -14,9 +14,13 @@ warning:
@echo " cmake .."
@echo " make"
@echo ""
@echo "If running on MacOSX, please use OPENSSL from homebrew and"
@echo " cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++"
@echo MacOS users:""
@echo " Please use OPENSSL from homebrew and use"
@echo ""
@echo " cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
@echo ""
@echo " Note that some versions of Apple's clang have severe performance"
@echo " issues. Use GCC5 from homebrew in this case."
VERSION_MAJOR := $(wordlist 1,1,$(subst ., ,$(VERSION)))
VERSION_MINOR := $(wordlist 2,2,$(subst ., ,$(VERSION)))

View File

@ -1,441 +0,0 @@
# -*- mode: Makefile; -*-
## -----------------------------------------------------------------------------
## --SECTION-- COMMON DEFINES
## -----------------------------------------------------------------------------
comma := ,
empty :=
space := $(empty) $(empty)
MAJOR_MINOR := $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(VERSION))))
## -----------------------------------------------------------------------------
## --SECTION-- FILES
## -----------------------------------------------------------------------------
################################################################################
### @brief man pages to install
################################################################################
dist_man_MANS =
################################################################################
### @brief files to cleanup
################################################################################
CLEANUP =
################################################################################
### @brief targets for cleanup of 3rd party libraries
################################################################################
CLEANUP_3RD =
## -----------------------------------------------------------------------------
## --SECTION-- PATHS
## -----------------------------------------------------------------------------
################################################################################
### @brief program suffix
################################################################################
PROGRAM_SUFFIX=$(shell echo | sed '$(program_transform_name)')
################################################################################
### @brief system directory
################################################################################
if ENABLE_RELATIVE
TRI_PKGDATADIR = .
TRI_LOCALSTATEDIR = .
TRI_SBINDIR = ${abs_builddir}/bin
TRI_BINDIR = ${abs_builddir}/bin
TRI_LIBEXECDIR = ${abs_builddir}/bin
TRI_SYSCONFDIR = etc/relative
else
TRI_LOCALSTATEDIR = ${localstatedir}
TRI_PKGDATADIR = ${pkgdatadir}
TRI_SBINDIR = ${sbindir}
TRI_BINDIR = ${bindir}
TRI_LIBEXECDIR = ${libexecdir}
TRI_SYSCONFDIR = ${sysconfdir}/${PACKAGE_TARNAME}
endif
## -----------------------------------------------------------------------------
## --SECTION-- FLAGS
## -----------------------------------------------------------------------------
################################################################################
### @brief m4 directory
################################################################################
ACLOCAL_AMFLAGS = -I m4
################################################################################
### @brief preprocessor flags
################################################################################
AM_CPPFLAGS = \
-DTRI_BUILD_DATE='"$(shell date +%Y-%m-%d)"' \
-D_SYSCONFDIR_='"${TRI_SYSCONFDIR}"' \
-I@top_builddir@/3rdParty/velocypack/include \
-I@top_srcdir@/lib \
-I@top_srcdir@/3rdParty/velocypack/include \
-I@top_builddir@/lib \
-I@top_srcdir@/3rdParty/velocypack/include \
@BOOST_CPPFLAGS@ \
@LIBEV_CPPFLAGS@ \
@MATH_CPPFLAGS@ \
@ICU_CPPFLAGS@ \
@ZLIB_CPPFLAGS@ \
@V8_CPPFLAGS@ \
@OPENSSL_CPPFLAGS@
################################################################################
### @brief linker flags
################################################################################
AM_LDFLAGS = \
@LIBEV_LDFLAGS@ \
@MATH_LDFLAGS@ \
@OPENSSL_LDFLAGS@ \
@ICU_LDFLAGS@ \
@ZLIB_LDFLAGS@ \
@V8_LDFLAGS@
################################################################################
### @brief libraries
################################################################################
LIBS = \
@TCMALLOC_LIBS@ \
@RT_LIBS@ \
@LIBEV_LIBS@ \
@MATH_LIBS@ \
@OPENSSL_LIBS@ \
@ICU_LIBS@ \
@ZLIB_LIBS@
## -----------------------------------------------------------------------------
## --SECTION-- LIBRARIES & PROGRAMS
## -----------------------------------------------------------------------------
################################################################################
### @brief auxiliary libraries
################################################################################
noinst_LIBRARIES = \
lib/libarango.a \
lib/libarango_v8.a \
lib/libarango_client.a \
arangod/libarangod.a
################################################################################
### @brief /bin programs
################################################################################
bin_PROGRAMS = \
bin/arangob \
bin/arangodump \
bin/arangorestore \
bin/arangosh \
bin/arangoimp
################################################################################
### @brief /sbin programs
################################################################################
sbin_PROGRAMS = \
bin/arangod
################################################################################
### @brief helper programs
################################################################################
noinst_bin =
################################################################################
### @brief /libexec programs
################################################################################
pkglibexec_SCRIPTS =
if ENABLE_ALL_IN_ONE_ETCD
pkglibexec_SCRIPTS += bin/etcd-arango$(PROGRAM_SUFFIX)
CLEANUP += bin/etcd-arango$(PROGRAM_SUFFIX)
endif
################################################################################
### @brief /bin scripts
################################################################################
bin_SCRIPTS =
################################################################################
### @brief uninstalled programs
################################################################################
noinst_PROGRAMS =
################################################################################
### @brief /etc data
################################################################################
arangosysconfdir=$(sysconfdir)/$(PACKAGE_TARNAME)
arangosysconf_DATA = $(shell find @builddir@/etc/arangodb -name "*$(PROGRAM_SUFFIX).conf" -print)
################################################################################
### @brief /share data
################################################################################
JS_FILE_LIST = $(shell @srcdir@/Installation/file-list-js.sh @srcdir@)
pkgdataJS01dir = $(datadir)/arangodb
pkgdataJS02dir = $(datadir)/arangodb
pkgdataJS03dir = $(datadir)/arangodb
pkgdataJS04dir = $(datadir)/arangodb
pkgdataJS05dir = $(datadir)/arangodb
pkgdataJS06dir = $(datadir)/arangodb
pkgdataJS07dir = $(datadir)/arangodb
pkgdataJS08dir = $(datadir)/arangodb
pkgdataJS09dir = $(datadir)/arangodb
pkgdataJS10dir = $(datadir)/arangodb
nobase_pkgdataJS01_DATA = $(wordlist 1, 1000, $(JS_FILE_LIST))
nobase_pkgdataJS02_DATA = $(wordlist 1001, 2000, $(JS_FILE_LIST))
nobase_pkgdataJS03_DATA = $(wordlist 2001, 3000, $(JS_FILE_LIST))
nobase_pkgdataJS04_DATA = $(wordlist 3001, 4000, $(JS_FILE_LIST))
nobase_pkgdataJS05_DATA = $(wordlist 4001, 5000, $(JS_FILE_LIST))
nobase_pkgdataJS06_DATA = $(wordlist 5001, 6000, $(JS_FILE_LIST))
nobase_pkgdataJS07_DATA = $(wordlist 6001, 7000, $(JS_FILE_LIST))
nobase_pkgdataJS08_DATA = $(wordlist 7001, 8000, $(JS_FILE_LIST))
nobase_pkgdataJS09_DATA = $(wordlist 8001, 9000, $(JS_FILE_LIST))
nobase_pkgdataJS10_DATA = $(wordlist 9001, 100000, $(JS_FILE_LIST))
nobase_pkgdata_DATA =
CLEANUP += @srcdir@/.file-list-js
################################################################################
### @brief /var data
################################################################################
install-data-local:
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb
################################################################################
### @brief /doc
################################################################################
dist_doc_DATA = README README.md LICENSE LICENSES-OTHER-COMPONENTS.md
################################################################################
### @brief symbolic links
################################################################################
install-exec-hook:
rm -f $(DESTDIR)$(bindir)/foxx-manager$(PROGRAM_SUFFIX)
$(LN_S) arangosh$(PROGRAM_SUFFIX) $(DESTDIR)$(bindir)/foxx-manager$(PROGRAM_SUFFIX)
rm -f $(DESTDIR)$(sbindir)/arango-dfdb$(PROGRAM_SUFFIX)
$(LN_S) arangod$(PROGRAM_SUFFIX) $(DESTDIR)$(sbindir)/arango-dfdb$(PROGRAM_SUFFIX)
## -----------------------------------------------------------------------------
## --SECTION-- TARGETS
## -----------------------------------------------------------------------------
################################################################################
### @brief version number
################################################################################
build.h: configure.ac
@echo '#define TRI_VERSION "@PACKAGE_VERSION@"' > build.h
################################################################################
### @brief source files
################################################################################
include lib/Makefile.files
include arangod/Makefile.files
include arangosh/Makefile.files
include etc/Makefile.files
################################################################################
### @brief unit tests
################################################################################
include UnitTests/Makefile.unittests
################################################################################
### @brief error code file
################################################################################
if ENABLE_MAINTAINER_MODE
BUILT_SOURCES += \
@top_srcdir@/lib/Basics/voc-errors.h \
@top_srcdir@/lib/Basics/voc-errors.cpp \
@top_srcdir@/js/common/bootstrap/errors.js
@top_srcdir@/lib/Basics/voc-errors.h: lib/Basics/errors.dat
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat @top_srcdir@/lib/Basics/voc-errors.h
@top_srcdir@/lib/Basics/voc-errors.cpp: lib/Basics/errors.dat
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat @top_srcdir@/lib/Basics/voc-errors.cpp
@top_srcdir@/js/common/bootstrap/errors.js: lib/Basics/errors.dat
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat js/common/bootstrap/errors.js
endif
################################################################################
### @brief mimetypes file
################################################################################
if ENABLE_MAINTAINER_MODE
BUILT_SOURCES += \
@top_srcdir@/lib/Basics/voc-mimetypes.h \
@top_srcdir@/lib/Basics/voc-mimetypes.cpp \
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js
@top_srcdir@/lib/Basics/voc-mimetypes.h: lib/Basics/mimetypes.dat
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat @top_srcdir@/lib/Basics/voc-mimetypes.h
@top_srcdir@/lib/Basics/voc-mimetypes.cpp: lib/Basics/mimetypes.dat
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat @top_srcdir@/lib/Basics/voc-mimetypes.cpp
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js: lib/Basics/mimetypes.dat
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat js/common/modules/@arangodb/mimetypes.js
endif
################################################################################
## cleanup
################################################################################
distclean-local:
@for i in $(CLEANUP_3RD); do $(MAKE) $$i; done
rm -f $(BUILT_SOURCES)
clean-local:
rm -rf $(CLEANUP)
rm -rf `find . -name \*.gcno`
rm -rf `find . -name \*.gcda`
superclean: distclean
rm -rf arangod/*/.deps lib/*/.deps Makefile
################################################################################
### @brief generated files
################################################################################
.PHONY: built-sources
built-sources: \
build.h \
@top_srcdir@/js/common/bootstrap/errors.js \
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js
################################################################################
### @brief tags file
################################################################################
GTAGS_FILES = $(sort $(abspath $(SOURCES) $(HEADERS)))
GTAGS:
echo $(GTAGS_FILES) | tr " " "\n" | gtags -i -f -
################################################################################
### @brief cleanup source and header files
################################################################################
.PHONY: update-disclaimer
update-disclaimer:
find lib arangod arangosh "(" -name "*.c" -o -name "*.h" -o -name "*.cpp" ")" -exec utils/cleanupCFiles "{}" ";"
find lib arangod arangosh "(" -name "*.c" -o -name "*.h" -o -name "*.cpp" ")" -exec chmod "644" "{}" ";"
find js/common/bootstrap js/client/bootstrap js/server/bootstrap -name "*.js" -a ! -name errors.js -exec utils/cleanupCFiles "{}" ";"
find js/common/modules/@arangodb js/client/modules/@arangodb js/server/modules/@arangodb -name "*.js"
find js -name "*.js" -exec chmod "644" "{}" ";"
## -----------------------------------------------------------------------------
## --SECTION-- DEPENDENCIES
## -----------------------------------------------------------------------------
################################################################################
### @brief documentation
################################################################################
include Documentation/Makefile.files
################################################################################
### @brief javascript
################################################################################
include js/Makefile.files
## -----------------------------------------------------------------------------
## --SECTION-- GENERATED FILES
## -----------------------------------------------------------------------------
################################################################################
### @brief generate readme
################################################################################
if ENABLE_MARKDOWN
if ENABLE_HTML2TEXT
BUILT_SOURCES += README
README: README.md
fgrep -v "[Build Status]" $< \
| fgrep -v "ArangoDB-Logo" \
| @MARKDOWN_EXEC@ \
| @HTML2TEXT_EXEC@ -style pretty -nobs \
| sed -e 's:&gt;:>:g' \
| awk 'BEGIN { s = 0; } { if (length($0) == 0) {if (s != 0) print $0;} else {s = 1; print $0; }}' \
> $@.tmp
mv $@.tmp $@
endif
endif
## -----------------------------------------------------------------------------
## --SECTION-- EXTERNAL LIBRARIES
## -----------------------------------------------------------------------------
################################################################################
### @brief libev
################################################################################
include 3rdParty/Makefile.libev
################################################################################
### @brief V8
################################################################################
include 3rdParty/Makefile.v8
################################################################################
### @brief zlib
################################################################################
include 3rdParty/Makefile.zlib
################################################################################
### @brief etcd
################################################################################
if ENABLE_ALL_IN_ONE_ETCD
include 3rdParty/Makefile.etcd
endif

View File

@ -75,7 +75,7 @@ TRI_action_t* TRI_DefineActionVocBase(std::string const& name,
TRI_action_t* oldAction = PrefixActions[url];
if (oldAction->_type != action->_type) {
LOG(ERR) << "trying to define two incompatible actions of type '" << oldAction->_type.c_str() << "' and '" << action->_type.c_str() << "' for prefix url '" << action->_url.c_str() << "'";
LOG(ERR) << "trying to define two incompatible actions of type '" << oldAction->_type << "' and '" << action->_type << "' for prefix url '" << action->_url << "'";
delete oldAction;
} else {
@ -90,7 +90,7 @@ TRI_action_t* TRI_DefineActionVocBase(std::string const& name,
TRI_action_t* oldAction = Actions[url];
if (oldAction->_type != action->_type) {
LOG(ERR) << "trying to define two incompatible actions of type '" << oldAction->_type.c_str() << "' and type '" << action->_type.c_str() << "' for url '" << action->_url.c_str() << "'";
LOG(ERR) << "trying to define two incompatible actions of type '" << oldAction->_type << "' and type '" << action->_type << "' for url '" << action->_url << "'";
delete oldAction;
} else {
@ -101,7 +101,7 @@ TRI_action_t* TRI_DefineActionVocBase(std::string const& name,
}
// some debug output
LOG(DEBUG) << "created " << action->_type.c_str() << " " << (action->_isPrefix ? "prefix " : "") << " '" << url.c_str() << "'";
LOG(DEBUG) << "created " << action->_type << " " << (action->_isPrefix ? "prefix " : "") << " '" << url << "'";
// return old or new action description
return action;

View File

@ -320,7 +320,7 @@ bool ApplicationServer::parse(
bool ok = _options.parse(_description, argc, argv);
if (!ok) {
LOG(ERR) << "cannot parse command line: " << _options.lastError().c_str();
LOG(ERR) << "cannot parse command line: " << _options.lastError();
return false;
}
@ -440,18 +440,18 @@ void ApplicationServer::prepare() {
i != _features.rend(); ++i) {
ApplicationFeature* feature = *i;
LOG(DEBUG) << "preparing server feature '" << feature->getName().c_str()
LOG(DEBUG) << "preparing server feature '" << feature->getName()
<< "'";
bool ok = feature->prepare();
if (!ok) {
LOG(FATAL) << "failed to prepare server feature '"
<< feature->getName().c_str() << "'";
<< feature->getName() << "'";
FATAL_ERROR_EXIT();
}
LOG(TRACE) << "prepared server feature '" << feature->getName().c_str()
LOG(TRACE) << "prepared server feature '" << feature->getName()
<< "'";
}
}
@ -467,18 +467,18 @@ void ApplicationServer::prepare2() {
i != _features.rend(); ++i) {
ApplicationFeature* feature = *i;
LOG(DEBUG) << "preparing(2) server feature '" << feature->getName().c_str()
LOG(DEBUG) << "preparing(2) server feature '" << feature->getName()
<< "'";
bool ok = feature->prepare2();
if (!ok) {
LOG(FATAL) << "failed to prepare(2) server feature '"
<< feature->getName().c_str() << "'";
<< feature->getName() << "'";
FATAL_ERROR_EXIT();
}
LOG(TRACE) << "prepared(2) server feature '" << feature->getName().c_str()
LOG(TRACE) << "prepared(2) server feature '" << feature->getName()
<< "'";
}
}
@ -503,11 +503,11 @@ void ApplicationServer::start() {
if (!ok) {
LOG(FATAL) << "failed to start server feature '"
<< feature->getName().c_str() << "'";
<< feature->getName() << "'";
FATAL_ERROR_EXIT();
}
LOG(DEBUG) << "started server feature '" << feature->getName().c_str()
LOG(DEBUG) << "started server feature '" << feature->getName()
<< "'";
}
@ -517,18 +517,18 @@ void ApplicationServer::start() {
i != _features.rend(); ++i) {
ApplicationFeature* feature = *i;
LOG(DEBUG) << "opening server feature '" << feature->getName().c_str()
LOG(DEBUG) << "opening server feature '" << feature->getName()
<< "'";
bool ok = feature->open();
if (!ok) {
LOG(FATAL) << "failed to open server feature '"
<< feature->getName().c_str() << "'";
<< feature->getName() << "'";
FATAL_ERROR_EXIT();
}
LOG(TRACE) << "opened server feature '" << feature->getName().c_str()
LOG(TRACE) << "opened server feature '" << feature->getName()
<< "'";
}
}
@ -578,7 +578,7 @@ void ApplicationServer::stop() {
feature->close();
LOG(TRACE) << "closed server feature '" << feature->getName().c_str()
LOG(TRACE) << "closed server feature '" << feature->getName()
<< "'";
}
@ -588,10 +588,10 @@ void ApplicationServer::stop() {
i != _features.rend(); ++i) {
ApplicationFeature* feature = *i;
LOG(DEBUG) << "shutting down server feature '" << feature->getName().c_str()
LOG(DEBUG) << "shutting down server feature '" << feature->getName()
<< "'";
feature->stop();
LOG(TRACE) << "shut down server feature '" << feature->getName().c_str()
LOG(TRACE) << "shut down server feature '" << feature->getName()
<< "'";
}
}
@ -612,7 +612,7 @@ void ApplicationServer::extractPrivileges() {
group* g = getgrgid(gidNumber);
if (g == 0) {
LOG(FATAL) << "unknown numeric gid '" << _gid.c_str() << "'";
LOG(FATAL) << "unknown numeric gid '" << _gid << "'";
FATAL_ERROR_EXIT();
}
#endif
@ -624,12 +624,12 @@ void ApplicationServer::extractPrivileges() {
if (g != 0) {
gidNumber = g->gr_gid;
} else {
LOG(FATAL) << "cannot convert groupname '" << _gid.c_str()
LOG(FATAL) << "cannot convert groupname '" << _gid
<< "' to numeric gid";
FATAL_ERROR_EXIT();
}
#else
LOG(FATAL) << "cannot convert groupname '" << _gid.c_str()
LOG(FATAL) << "cannot convert groupname '" << _gid
<< "' to numeric gid";
FATAL_ERROR_EXIT();
#endif
@ -650,7 +650,7 @@ void ApplicationServer::extractPrivileges() {
passwd* p = getpwuid(uidNumber);
if (p == 0) {
LOG(FATAL) << "unknown numeric uid '" << _uid.c_str() << "'";
LOG(FATAL) << "unknown numeric uid '" << _uid << "'";
FATAL_ERROR_EXIT();
}
#endif
@ -662,12 +662,12 @@ void ApplicationServer::extractPrivileges() {
if (p != 0) {
uidNumber = p->pw_uid;
} else {
LOG(FATAL) << "cannot convert username '" << _uid.c_str()
LOG(FATAL) << "cannot convert username '" << _uid
<< "' to numeric uid";
FATAL_ERROR_EXIT();
}
#else
LOG(FATAL) << "cannot convert username '" << _uid.c_str()
LOG(FATAL) << "cannot convert username '" << _uid
<< "' to numeric uid";
FATAL_ERROR_EXIT();
#endif
@ -722,7 +722,7 @@ void ApplicationServer::dropPrivilegesPermanently() {
int res = setuid(_numericUid);
if (res != 0) {
LOG(FATAL) << "cannot set uid '" << _uid.c_str()
LOG(FATAL) << "cannot set uid '" << _uid
<< "': " << strerror(errno);
FATAL_ERROR_EXIT();
}
@ -857,7 +857,7 @@ bool ApplicationServer::readConfigurationFile() {
return true;
}
LOG(DEBUG) << "using init file '" << _configFile.c_str() << "'";
LOG(DEBUG) << "using init file '" << _configFile << "'";
bool ok = _options.parse(_descriptionFile, _configFile);
@ -865,8 +865,8 @@ bool ApplicationServer::readConfigurationFile() {
// but for some reason can not be parsed. Best to report an error.
if (!ok) {
LOG(ERR) << "cannot parse config file '" << _configFile.c_str()
<< "': " << _options.lastError().c_str();
LOG(ERR) << "cannot parse config file '" << _configFile
<< "': " << _options.lastError();
}
return ok;
@ -899,7 +899,7 @@ bool ApplicationServer::readConfigurationFile() {
// check and see if file exists
if (FileUtils::exists(homeDir)) {
LOG(DEBUG) << "using user init file '" << homeDir.c_str() << "'";
LOG(DEBUG) << "using user init file '" << homeDir << "'";
bool ok = _options.parse(_descriptionFile, homeDir);
@ -908,13 +908,13 @@ bool ApplicationServer::readConfigurationFile() {
// but for some reason can not be parsed. Best to report an error.
if (!ok) {
LOG(ERR) << "cannot parse config file '" << homeDir.c_str()
<< "': " << _options.lastError().c_str();
LOG(ERR) << "cannot parse config file '" << homeDir
<< "': " << _options.lastError();
}
return ok;
} else {
LOG(DEBUG) << "no user init file '" << homeDir.c_str() << "' found";
LOG(DEBUG) << "no user init file '" << homeDir << "' found";
}
} else {
LOG(DEBUG) << "no home directory found";
@ -943,7 +943,7 @@ bool ApplicationServer::readConfigurationFile() {
// check and see if a local override file exists
if (FileUtils::exists(localSysDir)) {
LOG(DEBUG) << "using init override file '" << localSysDir.c_str()
LOG(DEBUG) << "using init override file '" << localSysDir
<< "'";
bool ok = _options.parse(_descriptionFile, localSysDir);
@ -952,18 +952,18 @@ bool ApplicationServer::readConfigurationFile() {
// exists
// but for some reason can not be parsed. Best to report an error.
if (!ok) {
LOG(ERR) << "cannot parse config file '" << localSysDir.c_str()
<< "': " << _options.lastError().c_str();
LOG(ERR) << "cannot parse config file '" << localSysDir
<< "': " << _options.lastError();
return ok;
}
} else {
LOG(DEBUG) << "no system init override file '" << localSysDir.c_str()
LOG(DEBUG) << "no system init override file '" << localSysDir
<< "' found";
}
// check and see if file exists
if (FileUtils::exists(sysDir)) {
LOG(DEBUG) << "using init file '" << sysDir.c_str() << "'";
LOG(DEBUG) << "using init file '" << sysDir << "'";
bool ok = _options.parse(_descriptionFile, sysDir);
@ -971,13 +971,13 @@ bool ApplicationServer::readConfigurationFile() {
// exists
// but for some reason can not be parsed. Best to report an error.
if (!ok) {
LOG(ERR) << "cannot parse config file '" << sysDir.c_str()
<< "': " << _options.lastError().c_str();
LOG(ERR) << "cannot parse config file '" << sysDir
<< "': " << _options.lastError();
}
return ok;
} else {
LOG(INFO) << "no system init file '" << sysDir.c_str() << "' found";
LOG(INFO) << "no system init file '" << sysDir << "' found";
}
} else {
LOG(DEBUG) << "no system init file specified";

View File

@ -996,7 +996,7 @@ ExecutionEngine* ExecutionEngine::instantiateFromPlan(
std::string msg("while trying to unregister query ");
msg += queryId + std::string("from shard: ") + shardId +
std::string("communication failed: ") + res->errorMessage;
LOG(WARN) << "" << msg.c_str();
LOG(WARN) << "" << msg;
}
} else {
// Remove query from registry:

View File

@ -53,11 +53,9 @@ class Ast;
class ExecutionEngine;
class ExecutionPlan;
class Executor;
class Expression;
class Parser;
class Query;
class QueryRegistry;
struct Variable;
////////////////////////////////////////////////////////////////////////////////
/// @brief equery part

View File

@ -221,7 +221,7 @@ int QueryList::kill(TRI_voc_tick_t id) {
}
// log outside the lock
LOG(WARN) << "killing AQL query " << id << " '" << queryString.c_str() << "'";
LOG(WARN) << "killing AQL query " << id << " '" << queryString << "'";
return TRI_ERROR_NO_ERROR;
}

View File

@ -92,7 +92,7 @@ void RestAqlHandler::createQueryFromJson() {
(part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to instantiate the query: " << res.details.c_str();
LOG(ERR) << "failed to instantiate the query: " << res.details;
generateError(HttpResponse::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN,
res.details);
@ -160,7 +160,7 @@ void RestAqlHandler::parseQuery() {
queryString.size(), nullptr, nullptr, PART_MAIN);
QueryResult res = query->parse();
if (res.code != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to instantiate the Query: " << res.details.c_str();
LOG(ERR) << "failed to instantiate the Query: " << res.details;
generateError(HttpResponse::BAD, res.code, res.details);
delete query;
return;
@ -222,7 +222,7 @@ void RestAqlHandler::explainQuery() {
options.steal(), PART_MAIN);
QueryResult res = query->explain();
if (res.code != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to instantiate the Query: " << res.details.c_str();
LOG(ERR) << "failed to instantiate the Query: " << res.details;
generateError(HttpResponse::BAD, res.code, res.details);
delete query;
return;
@ -288,7 +288,7 @@ void RestAqlHandler::createQueryFromString() {
(part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to instantiate the Query: " << res.details.c_str();
LOG(ERR) << "failed to instantiate the Query: " << res.details;
generateError(HttpResponse::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN,
res.details);
delete query;
@ -508,7 +508,7 @@ void RestAqlHandler::getInfoQuery(std::string const& operation,
}
} catch (arangodb::basics::Exception const& ex) {
_queryRegistry->close(_vocbase, _qId);
LOG(ERR) << "failed during use of query: " << ex.message().c_str();
LOG(ERR) << "failed during use of query: " << ex.message();
generateError(HttpResponse::SERVER_ERROR, ex.code(), ex.message());
} catch (std::exception const& ex) {
_queryRegistry->close(_vocbase, _qId);

View File

@ -514,7 +514,7 @@ bool AgencyComm::tryConnect() {
// mop: not sure if a timeout makes sense here
while (true) {
LOG(INFO) << "Trying to find an active agency. Checking " << endpointsStr.c_str();
LOG(INFO) << "Trying to find an active agency. Checking " << endpointsStr;
std::list<AgencyEndpoint*>::iterator it = _globalEndpoints.begin();
while (it != _globalEndpoints.end()) {
@ -774,7 +774,7 @@ void AgencyComm::disconnect() {
bool AgencyComm::addEndpoint(std::string const& endpointSpecification,
bool toFront) {
LOG(TRACE) << "adding global agency-endpoint '" << endpointSpecification.c_str() << "'";
LOG(TRACE) << "adding global agency-endpoint '" << endpointSpecification << "'";
{
WRITE_LOCKER(writeLocker, AgencyComm::_globalLock);
@ -962,7 +962,7 @@ bool AgencyComm::setPrefix(std::string const& prefix) {
}
}
LOG(TRACE) << "setting agency-prefix to '" << prefix.c_str() << "'";
LOG(TRACE) << "setting agency-prefix to '" << prefix << "'";
return true;
}
@ -1139,7 +1139,7 @@ void AgencyComm::increaseVersionRepeated(std::string const& key) {
return;
}
uint32_t val = 300 + TRI_UInt32Random() % 400;
LOG(INFO) << "Could not increase " << key.c_str() << " in agency, retrying in " << val << "!";
LOG(INFO) << "Could not increase " << key << " in agency, retrying in " << val << "!";
usleep(val * 1000);
}
}
@ -1767,7 +1767,7 @@ bool AgencyComm::sendWithFailover(
if (_addNewEndpoints) {
AgencyComm::addEndpoint(endpoint, true);
LOG(INFO) << "adding agency-endpoint '" << endpoint.c_str() << "'";
LOG(INFO) << "adding agency-endpoint '" << endpoint << "'";
// re-check the new endpoint
if (AgencyComm::hasEndpoint(endpoint)) {
@ -1776,7 +1776,7 @@ bool AgencyComm::sendWithFailover(
}
}
LOG(ERR) << "found redirection to unknown endpoint '" << endpoint.c_str() << "'. Will not follow!";
LOG(ERR) << "found redirection to unknown endpoint '" << endpoint << "'. Will not follow!";
// this is an error
return false;
@ -1832,7 +1832,7 @@ bool AgencyComm::send(arangodb::httpclient::GeneralClientConnection* connection,
result._connected = false;
result._statusCode = 0;
LOG(TRACE) << "sending " << arangodb::rest::HttpRequest::translateMethod(method).c_str() << " request to agency at endpoint '" << connection->getEndpoint()->getSpecification().c_str() << "', url '" << url.c_str() << "': " << body.c_str();
LOG(TRACE) << "sending " << arangodb::rest::HttpRequest::translateMethod(method) << " request to agency at endpoint '" << connection->getEndpoint()->getSpecification() << "', url '" << url << "': " << body;
arangodb::httpclient::SimpleHttpClient client(connection, timeout, false);
@ -1875,7 +1875,7 @@ bool AgencyComm::send(arangodb::httpclient::GeneralClientConnection* connection,
bool found = false;
result._location = response->getHeaderField("location", found);
LOG(TRACE) << "redirecting to location: '" << result._location.c_str() << "'";
LOG(TRACE) << "redirecting to location: '" << result._location << "'";
if (!found) {
// a 307 without a location header does not make any sense
@ -1898,7 +1898,7 @@ bool AgencyComm::send(arangodb::httpclient::GeneralClientConnection* connection,
result._index = arangodb::basics::StringUtils::uint64(lastIndex);
}
LOG(TRACE) << "request to agency returned status code " << result._statusCode << ", message: '" << result._message.c_str() << "', body: '" << result._body.c_str() << "'";
LOG(TRACE) << "request to agency returned status code " << result._statusCode << ", message: '" << result._message << "', body: '" << result._body << "'";
if (result.successful()) {
return true;

View File

@ -172,7 +172,7 @@ bool ApplicationCluster::prepare() {
arangodb::rest::Endpoint::getUnifiedForm(_agencyEndpoints[i]);
if (unified.empty()) {
LOG(FATAL) << "invalid endpoint '" << _agencyEndpoints[i].c_str() << "' specified for --cluster.agency-endpoint"; FATAL_ERROR_EXIT();
LOG(FATAL) << "invalid endpoint '" << _agencyEndpoints[i] << "' specified for --cluster.agency-endpoint"; FATAL_ERROR_EXIT();
}
AgencyComm::addEndpoint(unified);
@ -215,7 +215,7 @@ bool ApplicationCluster::prepare() {
std::string const endpoints = AgencyComm::getEndpointsString();
if (!AgencyComm::initialize()) {
LOG(FATAL) << "Could not connect to agency endpoints (" << endpoints.c_str() << ")"; FATAL_ERROR_EXIT();
LOG(FATAL) << "Could not connect to agency endpoints (" << endpoints << ")"; FATAL_ERROR_EXIT();
}
ServerState::instance()->setLocalInfo(_myLocalInfo);
@ -238,7 +238,7 @@ bool ApplicationCluster::prepare() {
if (role == ServerState::ROLE_UNDEFINED) {
// no role found
LOG(FATAL) << "unable to determine unambiguous role for server '" << _myId.c_str() << "'. No role configured in agency (" << endpoints.c_str() << ")"; FATAL_ERROR_EXIT();
LOG(FATAL) << "unable to determine unambiguous role for server '" << _myId << "'. No role configured in agency (" << endpoints << ")"; FATAL_ERROR_EXIT();
}
if (_myId.empty()) {
@ -282,7 +282,7 @@ bool ApplicationCluster::start() {
ServerState::RoleEnum role = ServerState::instance()->getRole();
if (_myAddress.empty()) {
LOG(FATAL) << "unable to determine internal address for server '" << _myId.c_str() << "'. Please specify --cluster.my-address or configure the address for this server in the agency."; FATAL_ERROR_EXIT();
LOG(FATAL) << "unable to determine internal address for server '" << _myId << "'. Please specify --cluster.my-address or configure the address for this server in the agency."; FATAL_ERROR_EXIT();
}
// now we can validate --cluster.my-address
@ -290,7 +290,7 @@ bool ApplicationCluster::start() {
arangodb::rest::Endpoint::getUnifiedForm(_myAddress);
if (unified.empty()) {
LOG(FATAL) << "invalid endpoint '" << _myAddress.c_str() << "' specified for --cluster.my-address"; FATAL_ERROR_EXIT();
LOG(FATAL) << "invalid endpoint '" << _myAddress << "' specified for --cluster.my-address"; FATAL_ERROR_EXIT();
}
ServerState::instance()->setState(ServerState::STATE_STARTUP);
@ -303,7 +303,7 @@ bool ApplicationCluster::start() {
ServerState::instance()->setInitialized();
LOG(INFO) << "Cluster feature is turned on. Agency version: " << version.c_str() << ", Agency endpoints: " << endpoints.c_str() << ", server id: '" << _myId.c_str() << "', internal address: " << _myAddress.c_str() << ", role: " << ServerState::roleToString(role).c_str();
LOG(INFO) << "Cluster feature is turned on. Agency version: " << version << ", Agency endpoints: " << endpoints << ", server id: '" << _myId << "', internal address: " << _myAddress << ", role: " << ServerState::roleToString(role);
if (!_disableHeartbeat) {
AgencyCommResult result = comm.getValues("Sync/HeartbeatIntervalMs", false);
@ -339,7 +339,7 @@ bool ApplicationCluster::start() {
}
if (!_heartbeat->init() || !_heartbeat->start()) {
LOG(FATAL) << "heartbeat could not connect to agency endpoints (" << endpoints.c_str() << ")"; FATAL_ERROR_EXIT();
LOG(FATAL) << "heartbeat could not connect to agency endpoints (" << endpoints << ")"; FATAL_ERROR_EXIT();
}
while (!_heartbeat->isReady()) {
@ -380,7 +380,7 @@ bool ApplicationCluster::open() {
if (!result.successful()) {
locker.unlock();
LOG(FATAL) << "unable to register server in agency: http code: " << result.httpCode() << ", body: " << result.body().c_str(); FATAL_ERROR_EXIT();
LOG(FATAL) << "unable to register server in agency: http code: " << result.httpCode() << ", body: " << result.body(); FATAL_ERROR_EXIT();
}
if (role == ServerState::ROLE_COORDINATOR) {

View File

@ -68,15 +68,15 @@ void ClusterCommResult::setDestination(std::string const& dest,
status = CL_COMM_ERROR;
if (logConnectionErrors) {
LOG(ERR) << "cannot find responsible server for shard '"
<< shardID.c_str() << "'";
<< shardID << "'";
} else {
LOG(INFO) << "cannot find responsible server for shard '"
<< shardID.c_str() << "'";
<< shardID << "'";
}
return;
}
}
LOG(DEBUG) << "Responsible server: " << serverID.c_str();
LOG(DEBUG) << "Responsible server: " << serverID;
} else if (dest.substr(0, 7) == "server:") {
shardID = "";
serverID = dest.substr(7);
@ -92,9 +92,9 @@ void ClusterCommResult::setDestination(std::string const& dest,
status = CL_COMM_ERROR;
errorMessage = "did not understand destination'" + dest + "'";
if (logConnectionErrors) {
LOG(ERR) << "did not understand destination '" << dest.c_str() << "'";
LOG(ERR) << "did not understand destination '" << dest << "'";
} else {
LOG(INFO) << "did not understand destination '" << dest.c_str() << "'";
LOG(INFO) << "did not understand destination '" << dest << "'";
}
return;
}
@ -105,10 +105,10 @@ void ClusterCommResult::setDestination(std::string const& dest,
status = CL_COMM_ERROR;
errorMessage = "did not find endpoint of server '" + serverID + "'";
if (logConnectionErrors) {
LOG(ERR) << "did not find endpoint of server '" << serverID.c_str()
LOG(ERR) << "did not find endpoint of server '" << serverID
<< "'";
} else {
LOG(INFO) << "did not find endpoint of server '" << serverID.c_str()
LOG(INFO) << "did not find endpoint of server '" << serverID
<< "'";
}
}
@ -400,16 +400,16 @@ std::unique_ptr<ClusterCommResult> ClusterComm::syncRequest(
"cannot create connection to server '" + res->serverID + "'";
if (logConnectionErrors()) {
LOG(ERR) << "cannot create connection to server '"
<< res->serverID.c_str() << "'";
<< res->serverID << "'";
} else {
LOG(INFO) << "cannot create connection to server '"
<< res->serverID.c_str() << "'";
<< res->serverID << "'";
}
} else {
LOG(DEBUG) << "sending "
<< arangodb::rest::HttpRequest::translateMethod(reqtype).c_str()
<< " request to DB server '" << res->serverID.c_str()
<< "': " << body.c_str();
<< arangodb::rest::HttpRequest::translateMethod(reqtype)
<< " request to DB server '" << res->serverID
<< "': " << body;
// LOCKING-DEBUG
// std::cout << "syncRequest: sending " <<
// arangodb::rest::HttpRequest::translateMethod(reqtype) << " request to
@ -779,7 +779,7 @@ void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
size_t start = 0;
size_t pos;
LOG(DEBUG) << "In asyncAnswer, seeing " << coordinatorHeader.c_str();
LOG(DEBUG) << "In asyncAnswer, seeing " << coordinatorHeader;
pos = coordinatorHeader.find(":", start);
if (pos == std::string::npos) {
LOG(ERR) << "Could not find coordinator ID in X-Arango-Coordinator";
@ -794,10 +794,10 @@ void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
if (endpoint == "") {
if (logConnectionErrors()) {
LOG(ERR) << "asyncAnswer: cannot find endpoint for server '"
<< coordinatorID.c_str() << "'";
<< coordinatorID << "'";
} else {
LOG(INFO) << "asyncAnswer: cannot find endpoint for server '"
<< coordinatorID.c_str() << "'";
<< coordinatorID << "'";
}
return;
}
@ -806,7 +806,7 @@ void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
cm->leaseConnection(endpoint);
if (nullptr == connection) {
LOG(ERR) << "asyncAnswer: cannot create connection to server '"
<< coordinatorID.c_str() << "'";
<< coordinatorID << "'";
return;
}
@ -820,7 +820,7 @@ void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
size_t len = responseToSend->body().length();
LOG(DEBUG) << "asyncAnswer: sending PUT request to DB server '"
<< coordinatorID.c_str() << "'";
<< coordinatorID << "'";
auto client = std::make_unique<arangodb::httpclient::SimpleHttpClient>(
connection->_connection, 3600.0, false);
@ -856,7 +856,7 @@ std::string ClusterComm::processAnswer(std::string& coordinatorHeader,
size_t start = 0;
size_t pos;
LOG(DEBUG) << "In processAnswer, seeing " << coordinatorHeader.c_str();
LOG(DEBUG) << "In processAnswer, seeing " << coordinatorHeader;
pos = coordinatorHeader.find(":", start);
if (pos == std::string::npos) {
@ -1064,10 +1064,10 @@ void ClusterCommThread::run() {
op->result.errorMessage += op->result.serverID;
if (cc->logConnectionErrors()) {
LOG(ERR) << "cannot create connection to server '"
<< op->result.serverID.c_str() << "'";
<< op->result.serverID << "'";
} else {
LOG(INFO) << "cannot create connection to server '"
<< op->result.serverID.c_str() << "'";
<< op->result.serverID << "'";
}
} else {
if (nullptr != op->body.get()) {
@ -1076,7 +1076,7 @@ void ClusterCommThread::run() {
op->reqtype)
.c_str()
<< " request to DB server '"
<< op->result.serverID.c_str()
<< op->result.serverID
<< "': " << op->body->c_str();
} else {
LOG(DEBUG) << "sending "
@ -1084,7 +1084,7 @@ void ClusterCommThread::run() {
op->reqtype)
.c_str()
<< " request to DB server '"
<< op->result.serverID.c_str() << "'";
<< op->result.serverID << "'";
}
auto client =

View File

@ -520,7 +520,7 @@ void ClusterInfo::loadPlannedDatabases() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixPlannedDatabases.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixPlannedDatabases << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -632,7 +632,7 @@ void ClusterInfo::loadCurrentDatabases() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixCurrentDatabases.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixCurrentDatabases << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -658,7 +658,7 @@ void ClusterInfo::loadPlannedCollections() {
if (locker.successful()) {
result = _agency.getValues(prefixPlannedCollections, true);
} else {
LOG(ERR) << "Error while locking " << prefixPlannedCollections.c_str();
LOG(ERR) << "Error while locking " << prefixPlannedCollections;
return;
}
}
@ -683,7 +683,7 @@ void ClusterInfo::loadPlannedCollections() {
if (parts.size() != 2) {
// invalid entry
LOG(WARN) << "found invalid collection key in agency: '" << key.c_str() << "'";
LOG(WARN) << "found invalid collection key in agency: '" << key << "'";
continue;
}
@ -744,7 +744,7 @@ void ClusterInfo::loadPlannedCollections() {
return;
}
LOG(ERR) << "Error while loading " << prefixPlannedCollections.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(ERR) << "Error while loading " << prefixPlannedCollections << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -888,7 +888,7 @@ void ClusterInfo::loadCurrentCollections() {
if (parts.size() != 3) {
// invalid entry
LOG(WARN) << "found invalid collection key in current in agency: '" << key.c_str() << "'";
LOG(WARN) << "found invalid collection key in current in agency: '" << key << "'";
continue;
}
@ -947,7 +947,7 @@ void ClusterInfo::loadCurrentCollections() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixCurrentCollections.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixCurrentCollections << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -2061,7 +2061,7 @@ void ClusterInfo::loadServers() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixServers.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixServers << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -2185,7 +2185,7 @@ void ClusterInfo::loadCurrentCoordinators() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixCurrentCoordinators.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixCurrentCoordinators << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////
@ -2238,7 +2238,7 @@ void ClusterInfo::loadCurrentDBServers() {
return;
}
LOG(DEBUG) << "Error while loading " << prefixCurrentDBServers.c_str() << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage().c_str() << " body: " << result.body().c_str();
LOG(DEBUG) << "Error while loading " << prefixCurrentDBServers << " httpCode: " << result.httpCode() << " errorCode: " << result.errorCode() << " errorMessage: " << result.errorMessage() << " body: " << result.body();
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -37,7 +37,6 @@
#include <mutex>
struct TRI_json_t;
struct TRI_memory_zone_s;
namespace arangodb {
namespace velocypack {

View File

@ -660,8 +660,8 @@ bool HeartbeatThread::sendState() {
std::string const endpoints = AgencyComm::getEndpointsString();
LOG(WARN) << "heartbeat could not be sent to agency endpoints ("
<< endpoints.c_str() << "): http code: " << result.httpCode()
<< ", body: " << result.body().c_str();
<< endpoints << "): http code: " << result.httpCode()
<< ", body: " << result.body();
_numFails = 0;
}

View File

@ -269,15 +269,14 @@ ServerState::RoleEnum ServerState::getRole() {
LOG(ERR) << "Could not talk to agency!";
return ROLE_UNDEFINED;
}
std::string jsonst = builder.slice().toJson();
LOG(DEBUG) << "Have stored " << jsonst.c_str() << " under Current/NewServers/" << _localInfo.c_str() << " in agency.";
LOG(DEBUG) << "Have stored " << builder.slice().toJson() << " under Current/NewServers/" << _localInfo << " in agency.";
}
// role not yet set
role = determineRole(info, id);
std::string roleString = roleToString(role);
LOG(DEBUG) << "Found my role: " << roleString.c_str();
LOG(DEBUG) << "Found my role: " << roleString;
storeRole(role);
@ -590,11 +589,11 @@ void ServerState::setState(StateEnum state) {
}
if (result) {
LOG(INFO) << "changing state of " << ServerState::roleToString(role).c_str() << " server from " << ServerState::stateToString(_state).c_str() << " to " << ServerState::stateToString(state).c_str();
LOG(INFO) << "changing state of " << ServerState::roleToString(role) << " server from " << ServerState::stateToString(_state) << " to " << ServerState::stateToString(state);
_state = state;
} else {
LOG(ERR) << "invalid state transition for " << ServerState::roleToString(role).c_str() << " server from " << ServerState::stateToString(_state).c_str() << " to " << ServerState::stateToString(state).c_str();
LOG(ERR) << "invalid state transition for " << ServerState::roleToString(role) << " server from " << ServerState::stateToString(_state) << " to " << ServerState::stateToString(state);
}
}
@ -773,13 +772,13 @@ bool ServerState::redetermineRole() {
std::string saveIdOfPrimary = _idOfPrimary;
RoleEnum role = determineRole(_localInfo, _id);
std::string roleString = roleToString(role);
LOG(INFO) << "Redetermined role from agency: " << roleString.c_str();
LOG(INFO) << "Redetermined role from agency: " << roleString;
if (role == ServerState::ROLE_UNDEFINED) {
return false;
}
RoleEnum oldRole = loadRole();
if (role != oldRole) {
LOG(INFO) << "Changed role to: " << roleString.c_str();
LOG(INFO) << "Changed role to: " << roleString;
storeRole(role);
return true;
}
@ -804,7 +803,7 @@ ServerState::RoleEnum ServerState::determineRole(std::string const& info,
return ServerState::ROLE_UNDEFINED;
}
// When we get here, we have have successfully looked up our id
LOG(DEBUG) << "Learned my own Id: " << id.c_str();
LOG(DEBUG) << "Learned my own Id: " << id;
setId(id);
}
@ -919,7 +918,7 @@ ServerState::RoleEnum ServerState::checkCoordinatorsList(
if (!result.successful()) {
std::string const endpoints = AgencyComm::getEndpointsString();
LOG(TRACE) << "Could not fetch configuration from agency endpoints (" << endpoints.c_str() << "): got status code " << result._statusCode << ", message: " << result.errorMessage().c_str() << ", key: " << key.c_str();
LOG(TRACE) << "Could not fetch configuration from agency endpoints (" << endpoints << "): got status code " << result._statusCode << ", message: " << result.errorMessage() << ", key: " << key;
return ServerState::ROLE_UNDEFINED;
}
@ -969,7 +968,7 @@ int ServerState::lookupLocalInfoToId(std::string const& localInfo,
if (!result.successful()) {
std::string const endpoints = AgencyComm::getEndpointsString();
LOG(DEBUG) << "Could not fetch configuration from agency endpoints (" << endpoints.c_str() << "): got status code " << result._statusCode << ", message: " << result.errorMessage().c_str() << ", key: " << key.c_str();
LOG(DEBUG) << "Could not fetch configuration from agency endpoints (" << endpoints << "): got status code " << result._statusCode << ", message: " << result.errorMessage() << ", key: " << key;
} else {
result.parse("Target/MapLocalToID/", false);
std::map<std::string, AgencyCommResultEntry>::const_iterator it =
@ -1021,7 +1020,7 @@ ServerState::RoleEnum ServerState::checkServersList(std::string const& id) {
if (!result.successful()) {
std::string const endpoints = AgencyComm::getEndpointsString();
LOG(TRACE) << "Could not fetch configuration from agency endpoints (" << endpoints.c_str() << "): got status code " << result._statusCode << ", message: " << result.errorMessage().c_str() << ", key: " << key.c_str();
LOG(TRACE) << "Could not fetch configuration from agency endpoints (" << endpoints << "): got status code " << result._statusCode << ", message: " << result.errorMessage() << ", key: " << key;
return ServerState::ROLE_UNDEFINED;
}

View File

@ -33,7 +33,6 @@ namespace arangodb {
namespace rest {
class ApplicationScheduler;
class Dispatcher;
class Task;
////////////////////////////////////////////////////////////////////////////////
/// @brief application server with dispatcher

View File

@ -137,7 +137,7 @@ void DispatcherThread::unblock() { _queue->unblockThread(); }
////////////////////////////////////////////////////////////////////////////////
void DispatcherThread::handleJob(Job* job) {
LOG(DEBUG) << "starting to run job: " << job->getName().c_str();
LOG(DEBUG) << "starting to run job: " << job->getName();
// start all the dirty work
try {

View File

@ -31,7 +31,6 @@ namespace arangodb {
namespace rest {
class DispatcherQueue;
class Job;
class Scheduler;
/////////////////////////////////////////////////////////////////////////////
/// @brief job dispatcher thread

View File

@ -32,7 +32,6 @@
namespace arangodb {
namespace rest {
class DispatcherQueue;
class DispatcherThread;
////////////////////////////////////////////////////////////////////////////////
/// @brief abstract base class for jobs

View File

@ -224,7 +224,7 @@ bool ApplicationEndpointServer::afterOptionParsing(ProgramOptions& options) {
_reuseAddress);
if (!ok) {
LOG(FATAL) << "invalid endpoint '" << (*i).c_str() << "'"; FATAL_ERROR_EXIT();
LOG(FATAL) << "invalid endpoint '" << (*i) << "'"; FATAL_ERROR_EXIT();
}
}
@ -264,7 +264,7 @@ bool ApplicationEndpointServer::loadEndpoints() {
return false;
}
LOG(TRACE) << "loading endpoint list from file '" << filename.c_str() << "'";
LOG(TRACE) << "loading endpoint list from file '" << filename << "'";
std::shared_ptr<VPackBuilder> builder;
try {
@ -276,7 +276,7 @@ bool ApplicationEndpointServer::loadEndpoints() {
VPackSlice const slice = builder->slice();
if (!slice.isObject()) {
LOG(WARN) << "error loading ENDPOINTS file '" << filename.c_str() << "'";
LOG(WARN) << "error loading ENDPOINTS file '" << filename << "'";
return false;
}
@ -395,10 +395,10 @@ bool ApplicationEndpointServer::createSslContext() {
return false;
}
LOG(DEBUG) << "using SSL protocol version '" << protocolName((protocol_e)_sslProtocol).c_str() << "'";
LOG(DEBUG) << "using SSL protocol version '" << protocolName((protocol_e)_sslProtocol) << "'";
if (!FileUtils::exists(_httpsKeyfile)) {
LOG(FATAL) << "unable to find SSL keyfile '" << _httpsKeyfile.c_str() << "'"; FATAL_ERROR_EXIT();
LOG(FATAL) << "unable to find SSL keyfile '" << _httpsKeyfile << "'"; FATAL_ERROR_EXIT();
}
// create context
@ -424,10 +424,10 @@ bool ApplicationEndpointServer::createSslContext() {
if (!_sslCipherList.empty()) {
if (SSL_CTX_set_cipher_list(_sslContext, _sslCipherList.c_str()) != 1) {
LOG(ERR) << "SSL error: " << lastSSLError().c_str();
LOG(FATAL) << "cannot set SSL cipher list '" << _sslCipherList.c_str() << "'"; FATAL_ERROR_EXIT();
LOG(ERR) << "SSL error: " << lastSSLError();
LOG(FATAL) << "cannot set SSL cipher list '" << _sslCipherList << "'"; FATAL_ERROR_EXIT();
} else {
LOG(INFO) << "using SSL cipher-list '" << _sslCipherList.c_str() << "'";
LOG(INFO) << "using SSL cipher-list '" << _sslCipherList << "'";
}
}
@ -440,19 +440,19 @@ bool ApplicationEndpointServer::createSslContext() {
_sslContext, (unsigned char const*)_rctx.c_str(), (int)_rctx.size());
if (res != 1) {
LOG(ERR) << "SSL error: " << lastSSLError().c_str();
LOG(FATAL) << "cannot set SSL session id context '" << _rctx.c_str() << "'"; FATAL_ERROR_EXIT();
LOG(ERR) << "SSL error: " << lastSSLError();
LOG(FATAL) << "cannot set SSL session id context '" << _rctx << "'"; FATAL_ERROR_EXIT();
}
// check CA
if (!_cafile.empty()) {
LOG(TRACE) << "trying to load CA certificates from '" << _cafile.c_str() << "'";
LOG(TRACE) << "trying to load CA certificates from '" << _cafile << "'";
int res = SSL_CTX_load_verify_locations(_sslContext, _cafile.c_str(), 0);
if (res == 0) {
LOG(ERR) << "SSL error: " << lastSSLError().c_str();
LOG(FATAL) << "cannot load CA certificates from '" << _cafile.c_str() << "'"; FATAL_ERROR_EXIT();
LOG(ERR) << "SSL error: " << lastSSLError();
LOG(FATAL) << "cannot load CA certificates from '" << _cafile << "'"; FATAL_ERROR_EXIT();
}
STACK_OF(X509_NAME) * certNames;
@ -460,8 +460,8 @@ bool ApplicationEndpointServer::createSslContext() {
certNames = SSL_load_client_CA_file(_cafile.c_str());
if (certNames == nullptr) {
LOG(ERR) << "ssl error: " << lastSSLError().c_str();
LOG(FATAL) << "cannot load CA certificates from '" << _cafile.c_str() << "'"; FATAL_ERROR_EXIT();
LOG(ERR) << "ssl error: " << lastSSLError();
LOG(FATAL) << "cannot load CA certificates from '" << _cafile << "'"; FATAL_ERROR_EXIT();
}
if (Logger::logLevel() == arangodb::LogLevel::TRACE) {
@ -479,7 +479,7 @@ bool ApplicationEndpointServer::createSslContext() {
char* r;
long len = BIO_get_mem_data(bout._bio, &r);
LOG(TRACE) << "name: " << std::string(r, len).c_str();
LOG(TRACE) << "name: " << std::string(r, len);
}
}
}

View File

@ -75,7 +75,7 @@ HttpCommTask::HttpCommTask(HttpServer* server, TRI_socket_t socket,
_sinceCompactification(0),
_originalBodyLength(0),
_setupDone(false) {
LOG(TRACE) << "connection established, client " << TRI_get_fd_or_handle_of_socket(socket) << ", server ip " << _connectionInfo.serverAddress.c_str() << ", server port " << _connectionInfo.serverPort << ", client ip " << _connectionInfo.clientAddress.c_str() << ", client port " << _connectionInfo.clientPort;
LOG(TRACE) << "connection established, client " << TRI_get_fd_or_handle_of_socket(socket) << ", server ip " << _connectionInfo.serverAddress << ", server port " << _connectionInfo.serverPort << ", client ip " << _connectionInfo.clientAddress << ", client port " << _connectionInfo.clientPort;
// acquire a statistics entry and set the type to HTTP
ConnectionStatisticsAgent::acquire();
@ -190,7 +190,7 @@ bool HttpCommTask::processRead() {
_readPosition = ptr - _readBuffer->c_str() + 4;
LOG(TRACE) << "HTTP READ FOR " << (void*)this << ": " << std::string(_readBuffer->c_str() + _startPosition,
_readPosition - _startPosition).c_str();
_readPosition - _startPosition);
// check that we know, how to serve this request and update the connection
// information, i. e. client and server addresses and ports and create a
@ -314,7 +314,7 @@ bool HttpCommTask::processRead() {
l = 6;
}
LOG(WARN) << "got corrupted HTTP request '" << std::string(_readBuffer->c_str() + _startPosition, l).c_str() << "'";
LOG(WARN) << "got corrupted HTTP request '" << std::string(_readBuffer->c_str() + _startPosition, l) << "'";
// bad request, method not allowed
HttpResponse response(HttpResponse::METHOD_NOT_ALLOWED,
@ -399,7 +399,7 @@ bool HttpCommTask::processRead() {
_request->setBody(_readBuffer->c_str() + _bodyPosition, _bodyLength);
LOG(TRACE) << "" << std::string(_readBuffer->c_str() + _bodyPosition,
_bodyLength).c_str();
_bodyLength);
// remove body from read buffer and reset read position
_readRequestBody = false;
@ -762,7 +762,7 @@ void HttpCommTask::processCorsOptions(uint32_t compatibility) {
// server. that's a client problem.
response.setHeader(TRI_CHAR_LENGTH_PAIR("access-control-allow-headers"),
allowHeaders);
LOG(TRACE) << "client requested validation of the following headers: " << allowHeaders.c_str();
LOG(TRACE) << "client requested validation of the following headers: " << allowHeaders;
}
// set caching time (hard-coded value)

View File

@ -36,11 +36,9 @@
namespace arangodb {
namespace rest {
class HttpCommTask;
class HttpHandler;
class HttpRequest;
class HttpResponse;
class HttpServer;
class HttpServerJob;
////////////////////////////////////////////////////////////////////////////////
/// @brief http communication

View File

@ -38,7 +38,6 @@ namespace rest {
class Dispatcher;
class HttpHandlerFactory;
class HttpRequest;
class HttpServer;
////////////////////////////////////////////////////////////////////////////////
/// @brief abstract class for http handlers

View File

@ -244,7 +244,7 @@ HttpHandler* HttpHandlerFactory::createHandler(HttpRequest* request) {
}
else {
LOG(TRACE) << "found prefix match '" << prefix.c_str() << "'";
LOG(TRACE) << "found prefix match '" << prefix << "'";
size_t l = prefix.size() + 1;
size_t n = path.find_first_of('/', l);
@ -288,7 +288,7 @@ HttpHandler* HttpHandlerFactory::createHandler(HttpRequest* request) {
}
}
LOG(TRACE) << "found handler for path '" << path.c_str() << "'";
LOG(TRACE) << "found handler for path '" << path << "'";
HttpHandler* handler = i->second(request, data);
handler->setServer(this);

View File

@ -105,14 +105,14 @@ void HttpServer::startListening() {
auto endpoints = _endpointList->getByPrefix(encryptionType());
for (auto&& i : endpoints) {
LOG(TRACE) << "trying to bind to endpoint '" << i.first.c_str() << "' for requests";
LOG(TRACE) << "trying to bind to endpoint '" << i.first << "' for requests";
bool ok = openEndpoint(i.second);
if (ok) {
LOG(DEBUG) << "bound to endpoint '" << i.first.c_str() << "'";
LOG(DEBUG) << "bound to endpoint '" << i.first << "'";
} else {
LOG(FATAL) << "failed to bind to endpoint '" << i.first.c_str() << "'. Please check whether another instance is already running or review your endpoints configuration."; FATAL_ERROR_EXIT();
LOG(FATAL) << "failed to bind to endpoint '" << i.first << "'. Please check whether another instance is already running or review your endpoints configuration."; FATAL_ERROR_EXIT();
}
}
}

View File

@ -85,7 +85,7 @@ bool HttpsCommTask::setup(Scheduler* scheduler, EventLoop loop) {
if (_ssl == nullptr) {
LOG(DEBUG) << "cannot build new SSL connection: "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
shutdownSsl(false);
return false; // terminate ourselves, ssl is nullptr
@ -202,7 +202,7 @@ bool HttpsCommTask::trySSLAccept() {
// shutdown of connection
if (res == 0) {
LOG(DEBUG) << "SSL_accept failed: "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
shutdownSsl(false);
return false;
@ -222,7 +222,7 @@ bool HttpsCommTask::trySSLAccept() {
}
LOG(TRACE) << "error in SSL handshake: "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
shutdownSsl(false);
return false;
@ -249,7 +249,7 @@ again:
case SSL_ERROR_SSL:
LOG(DEBUG) << "received SSL error (bytes read " << nr << ", socket "
<< TRI_get_fd_or_handle_of_socket(_commSocket)
<< "): " << arangodb::basics::lastSSLError().c_str();
<< "): " << arangodb::basics::lastSSLError();
shutdownSsl(false);
return false;
@ -278,7 +278,7 @@ again:
case SSL_ERROR_SYSCALL:
if (res != 0) {
LOG(DEBUG) << "SSL_read returned syscall error with: "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
} else if (nr == 0) {
LOG(DEBUG)
<< "SSL_read returned syscall error because an EOF was received";
@ -292,7 +292,7 @@ again:
default:
LOG(DEBUG) << "received error with " << res << " and " << nr << ": "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
shutdownSsl(false);
return false;
@ -363,7 +363,7 @@ bool HttpsCommTask::trySSLWrite() {
case SSL_ERROR_SYSCALL:
if (res != 0) {
LOG(DEBUG) << "SSL_write returned syscall error with: "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
} else if (nr == 0) {
LOG(DEBUG) << "SSL_write returned syscall error because an EOF was "
"received";
@ -377,7 +377,7 @@ bool HttpsCommTask::trySSLWrite() {
default:
LOG(DEBUG) << "received error with " << res << " and " << nr << ": "
<< arangodb::basics::lastSSLError().c_str();
<< arangodb::basics::lastSSLError();
shutdownSsl(false);
return false;
@ -437,7 +437,7 @@ void HttpsCommTask::shutdownSsl(bool initShutdown) {
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) {
LOG(DEBUG) << "received shutdown error with " << res << ", " << err
<< ": " << arangodb::basics::lastSSLError().c_str();
<< ": " << arangodb::basics::lastSSLError();
break;
}
}

View File

@ -98,7 +98,7 @@ HttpHandler::status_t PathHandler::execute() {
std::string const& next = *j;
if (next == ".") {
LOG(WARN) << "file '" << name.c_str() << "' contains '.'";
LOG(WARN) << "file '" << name << "' contains '.'";
createResponse(HttpResponse::FORBIDDEN);
_response->body().appendText("path contains '.'");
@ -106,7 +106,7 @@ HttpHandler::status_t PathHandler::execute() {
}
if (next == "..") {
LOG(WARN) << "file '" << name.c_str() << "' contains '..'";
LOG(WARN) << "file '" << name << "' contains '..'";
createResponse(HttpResponse::FORBIDDEN);
_response->body().appendText("path contains '..'");
@ -116,7 +116,7 @@ HttpHandler::status_t PathHandler::execute() {
std::string::size_type sc = next.find_first_not_of(allowed);
if (sc != std::string::npos) {
LOG(WARN) << "file '" << name.c_str() << "' contains illegal character";
LOG(WARN) << "file '" << name << "' contains illegal character";
createResponse(HttpResponse::FORBIDDEN);
_response->body().appendText("path contains illegal character '" +
@ -126,7 +126,7 @@ HttpHandler::status_t PathHandler::execute() {
if (!path.empty()) {
if (!FileUtils::isDirectory(path)) {
LOG(WARN) << "file '" << name.c_str() << "' not found";
LOG(WARN) << "file '" << name << "' not found";
createResponse(HttpResponse::NOT_FOUND);
_response->body().appendText("file not found");
@ -138,7 +138,7 @@ HttpHandler::status_t PathHandler::execute() {
last = next;
if (!allowSymbolicLink && FileUtils::isSymbolicLink(name)) {
LOG(WARN) << "file '" << name.c_str() << "' contains symbolic link";
LOG(WARN) << "file '" << name << "' contains symbolic link";
createResponse(HttpResponse::FORBIDDEN);
_response->body().appendText("symbolic links are not allowed");
@ -147,7 +147,7 @@ HttpHandler::status_t PathHandler::execute() {
}
if (!FileUtils::isRegularFile(name)) {
LOG(WARN) << "file '" << name.c_str() << "' not found";
LOG(WARN) << "file '" << name << "' not found";
createResponse(HttpResponse::NOT_FOUND);
_response->body().appendText("file not found");
@ -159,7 +159,7 @@ HttpHandler::status_t PathHandler::execute() {
try {
FileUtils::slurp(name, _response->body());
} catch (...) {
LOG(WARN) << "file '" << name.c_str() << "' not readable";
LOG(WARN) << "file '" << name << "' not readable";
createResponse(HttpResponse::NOT_FOUND);
_response->body().appendText("file not readable");
@ -190,7 +190,7 @@ HttpHandler::status_t PathHandler::execute() {
} else {
// note: changed the log level to debug. an unknown content-type does not
// justify a warning
LOG(TRACE) << "unknown suffix '" << suffix.c_str() << "'";
LOG(TRACE) << "unknown suffix '" << suffix << "'";
}
}

View File

@ -33,9 +33,6 @@
#include "VocBase/voc-types.h"
namespace arangodb {
namespace aql {
class SortCondition;
}
class EdgeIndexIterator final : public IndexIterator {
public:

View File

@ -55,9 +55,6 @@ struct TRI_hash_index_search_value_t {
};
namespace arangodb {
namespace aql {
class SortCondition;
}
class HashIndex;
class Transaction;

View File

@ -36,7 +36,6 @@
struct TRI_doc_mptr_t;
struct TRI_document_collection_t;
struct TRI_shaped_json_s;
struct TRI_transaction_collection_s;
namespace arangodb {

View File

@ -32,12 +32,6 @@
#include "VocBase/voc-types.h"
namespace arangodb {
namespace aql {
class SortCondition;
}
namespace basics {
struct AttributeName;
}
class Transaction;

View File

@ -966,7 +966,7 @@ int ContinuousSyncer::applyLog(SimpleHttpResult* response,
}
ignoreCount--;
LOG_TOPIC(WARN, Logger::REPLICATION) << "ignoring replication error for database '" << _applier->databaseName() << "': " << errorMsg.c_str();
LOG_TOPIC(WARN, Logger::REPLICATION) << "ignoring replication error for database '" << _applier->databaseName() << "': " << errorMsg;
errorMsg = "";
}

View File

@ -45,7 +45,6 @@ class Slice;
namespace httpclient {
class GeneralClientConnection;
class SimpleHttpClient;
class SimpleHttpResult;
}
namespace rest {

View File

@ -62,7 +62,7 @@ HttpHandler::status_t RestBatchHandler::execute() {
return status_t(HttpHandler::HANDLER_FAILED);
}
LOG(TRACE) << "boundary of multipart-message is '" << boundary.c_str() << "'";
LOG(TRACE) << "boundary of multipart-message is '" << boundary << "'";
size_t errors = 0;
@ -125,7 +125,7 @@ HttpHandler::status_t RestBatchHandler::execute() {
}
// set up request object for the part
LOG(TRACE) << "part header is: " << std::string(headerStart, headerLength).c_str();
LOG(TRACE) << "part header is: " << std::string(headerStart, headerLength);
HttpRequest* request =
new HttpRequest(_request->connectionInfo(), headerStart, headerLength,
_request->compatibility(), false);
@ -145,7 +145,7 @@ HttpHandler::status_t RestBatchHandler::execute() {
request->setDatabaseName(_request->databaseName());
if (bodyLength > 0) {
LOG(TRACE) << "part body is '" << std::string(bodyStart, bodyLength).c_str() << "'";
LOG(TRACE) << "part body is '" << std::string(bodyStart, bodyLength) << "'";
request->setBody(bodyStart, bodyLength);
}
@ -455,7 +455,7 @@ bool RestBatchHandler::extractPart(SearchHelper* helper) {
if (arangodb::rest::HttpRequest::BatchContentType == value) {
hasTypeHeader = true;
} else {
LOG(WARN) << "unexpected content-type '" << value.c_str() << "' for multipart-message. expected: '" << arangodb::rest::HttpRequest::BatchContentType.c_str() << "'";
LOG(WARN) << "unexpected content-type '" << value << "' for multipart-message. expected: '" << arangodb::rest::HttpRequest::BatchContentType << "'";
}
} else if ("content-id" == key) {
helper->contentId = colon;

View File

@ -2503,8 +2503,8 @@ void RestReplicationHandler::handleCommandRestoreDataCoordinator() {
}
} else {
LOG(ERR) << "Bad status from DBServer: " << result.status
<< ", msg: " << result.errorMessage.c_str()
<< ", shard: " << result.shardID.c_str();
<< ", msg: " << result.errorMessage
<< ", shard: " << result.shardID;
if (result.status >= CL_COMM_SENT) {
if (result.result.get() == nullptr) {
LOG(ERR) << "result.result is nullptr";
@ -2512,10 +2512,10 @@ void RestReplicationHandler::handleCommandRestoreDataCoordinator() {
auto msg = result.result->getResultTypeMessage();
LOG(ERR) << "Bad HTTP return code: "
<< result.result->getHttpReturnCode()
<< ", msg: " << msg.c_str();
<< ", msg: " << msg;
auto body = result.result->getBodyVelocyPack();
msg = body->toString();
LOG(ERR) << "Body: " << msg.c_str();
LOG(ERR) << "Body: " << msg;
}
}
}

View File

@ -30,8 +30,6 @@
#include "RestServer/VocbaseContext.h"
#include "Utils/transactions.h"
struct TRI_document_collection_t;
class TRI_vocbase_col_t;
struct TRI_vocbase_t;
class VocShaper;

View File

@ -115,7 +115,7 @@ static void WritePidFile(std::string const& pidFile, int pid) {
std::ofstream out(pidFile.c_str(), std::ios::trunc);
if (!out) {
LOG(FATAL) << "cannot write pid-file '" << pidFile.c_str() << "'";
LOG(FATAL) << "cannot write pid-file '" << pidFile << "'";
FATAL_ERROR_EXIT();
}
@ -130,10 +130,10 @@ static void CheckPidFile(std::string const& pidFile) {
// check if the pid-file exists
if (!pidFile.empty()) {
if (FileUtils::isDirectory(pidFile)) {
LOG(FATAL) << "pid-file '" << pidFile.c_str() << "' is a directory";
LOG(FATAL) << "pid-file '" << pidFile << "' is a directory";
FATAL_ERROR_EXIT();
} else if (FileUtils::exists(pidFile) && FileUtils::size(pidFile) > 0) {
LOG(INFO) << "pid-file '" << pidFile.c_str()
LOG(INFO) << "pid-file '" << pidFile
<< "' already exists, verifying pid";
std::ifstream f(pidFile.c_str());
@ -145,7 +145,7 @@ static void CheckPidFile(std::string const& pidFile) {
f >> oldPid;
if (oldPid == 0) {
LOG(FATAL) << "pid-file '" << pidFile.c_str() << "' is unreadable";
LOG(FATAL) << "pid-file '" << pidFile << "' is unreadable";
FATAL_ERROR_EXIT();
}
@ -158,30 +158,30 @@ static void CheckPidFile(std::string const& pidFile) {
#endif
if (r == 0) {
LOG(FATAL) << "pid-file '" << pidFile.c_str()
LOG(FATAL) << "pid-file '" << pidFile
<< "' exists and process with pid " << oldPid
<< " is still running";
FATAL_ERROR_EXIT();
} else if (errno == EPERM) {
LOG(FATAL) << "pid-file '" << pidFile.c_str()
LOG(FATAL) << "pid-file '" << pidFile
<< "' exists and process with pid " << oldPid
<< " is still running";
FATAL_ERROR_EXIT();
} else if (errno == ESRCH) {
LOG(ERR) << "pid-file '" << pidFile.c_str()
LOG(ERR) << "pid-file '" << pidFile
<< " exists, but no process with pid " << oldPid
<< " exists";
if (!FileUtils::remove(pidFile)) {
LOG(FATAL) << "pid-file '" << pidFile.c_str()
LOG(FATAL) << "pid-file '" << pidFile
<< "' exists, no process with pid " << oldPid
<< " exists, but pid-file cannot be removed";
FATAL_ERROR_EXIT();
}
LOG(INFO) << "removed stale pid-file '" << pidFile.c_str() << "'";
LOG(INFO) << "removed stale pid-file '" << pidFile << "'";
} else {
LOG(FATAL) << "pid-file '" << pidFile.c_str() << "' exists and kill "
LOG(FATAL) << "pid-file '" << pidFile << "' exists and kill "
<< oldPid << " failed";
FATAL_ERROR_EXIT();
}
@ -189,13 +189,13 @@ static void CheckPidFile(std::string const& pidFile) {
// failed to open file
else {
LOG(FATAL) << "pid-file '" << pidFile.c_str()
LOG(FATAL) << "pid-file '" << pidFile
<< "' exists, but cannot be opened";
FATAL_ERROR_EXIT();
}
}
LOG(DEBUG) << "using pid-file '" << pidFile.c_str() << "'";
LOG(DEBUG) << "using pid-file '" << pidFile << "'";
}
}
@ -248,11 +248,11 @@ static int ForkProcess(std::string const& workingDirectory,
if (!workingDirectory.empty()) {
if (!FileUtils::changeDirectory(workingDirectory)) {
LOG(FATAL) << "cannot change into working directory '"
<< workingDirectory.c_str() << "'";
<< workingDirectory << "'";
FATAL_ERROR_EXIT();
} else {
LOG(INFO) << "changed working directory for child process to '"
<< workingDirectory.c_str() << "'";
<< workingDirectory << "'";
}
}
@ -459,7 +459,7 @@ int ArangoServer::start() {
if (!_pidFile.empty()) {
if (!FileUtils::remove(_pidFile)) {
LOG(DEBUG) << "cannot remove pid file '" << _pidFile.c_str() << "'";
LOG(DEBUG) << "cannot remove pid file '" << _pidFile << "'";
}
}
@ -597,7 +597,7 @@ int ArangoServer::startupSupervisor() {
// remove pid file
if (horrible) {
if (!FileUtils::remove(_pidFile)) {
LOG(DEBUG) << "cannot remove pid file '" << _pidFile.c_str() << "'";
LOG(DEBUG) << "cannot remove pid file '" << _pidFile << "'";
}
result = EXIT_FAILURE;
@ -622,7 +622,7 @@ int ArangoServer::startupSupervisor() {
// remove pid file
if (!FileUtils::remove(_pidFile)) {
LOG(DEBUG) << "cannot remove pid file '" << _pidFile.c_str() << "'";
LOG(DEBUG) << "cannot remove pid file '" << _pidFile << "'";
}
// and stop
@ -668,7 +668,7 @@ int ArangoServer::startupDaemon() {
// remove pid file
if (!FileUtils::remove(_pidFile)) {
LOG(DEBUG) << "cannot remove pid file '" << _pidFile.c_str() << "'";
LOG(DEBUG) << "cannot remove pid file '" << _pidFile << "'";
}
}
@ -1300,9 +1300,9 @@ void ArangoServer::buildApplicationServer() {
// .............................................................................
// dump version details
LOG(INFO) << "" << rest::Version::getVerboseVersionString().c_str();
LOG(INFO) << "" << rest::Version::getVerboseVersionString();
LOG(INFO) << "using default language '" << languageName.c_str() << "'";
LOG(INFO) << "using default language '" << languageName << "'";
// if we got here, then we are in server mode
@ -1344,7 +1344,7 @@ void ArangoServer::buildApplicationServer() {
_pidFile = std::string(absoluteFile);
TRI_Free(TRI_UNKNOWN_MEM_ZONE, absoluteFile);
LOG(DEBUG) << "using absolute pid file '" << _pidFile.c_str() << "'";
LOG(DEBUG) << "using absolute pid file '" << _pidFile << "'";
} else {
LOG(FATAL) << "cannot determine current directory";
FATAL_ERROR_EXIT();
@ -1673,10 +1673,10 @@ int ArangoServer::startupServer() {
}
if (0 < ns) {
LOG(INFO) << "scheduler cores: " << ToString(ps).c_str();
LOG(INFO) << "scheduler cores: " << ToString(ps);
}
if (0 < nd) {
LOG(INFO) << "dispatcher cores: " << ToString(pd).c_str();
LOG(INFO) << "dispatcher cores: " << ToString(pd);
}
} else {
LOG(INFO) << "the server has " << n << " (hyper) cores";
@ -1810,9 +1810,9 @@ void ArangoServer::runStartupChecks() {
if ((alignment & 2) == 0) {
LOG(FATAL)
<< "possibly incompatible CPU alignment settings found in '"
<< filename.c_str() << "'. this may cause arangod to abort with "
<< filename << "'. this may cause arangod to abort with "
"SIGBUS. please set the value in '"
<< filename.c_str() << "' to 2";
<< filename << "' to 2";
FATAL_ERROR_EXIT();
}
@ -1823,16 +1823,16 @@ void ArangoServer::runStartupChecks() {
// ignore that we cannot detect the alignment
LOG(TRACE)
<< "unable to detect CPU alignment settings. could not process file '"
<< filename.c_str() << "'";
<< filename << "'";
}
if (!alignmentDetected) {
LOG(WARN)
<< "unable to detect CPU alignment settings. could not process file '"
<< filename.c_str()
<< filename
<< "'. this may cause arangod to abort with SIGBUS. it may be "
"necessary to set the value in '"
<< filename.c_str() << "' to 2";
<< filename << "' to 2";
}
}
#endif
@ -1997,7 +1997,7 @@ int ArangoServer::runScript(TRI_vocbase_t* vocbase) {
TRI_ExecuteGlobalJavaScriptFile(isolate, _scriptFile[i].c_str());
if (!r) {
LOG(FATAL) << "cannot load script '" << _scriptFile[i].c_str()
LOG(FATAL) << "cannot load script '" << _scriptFile[i]
<< "', giving up";
FATAL_ERROR_EXIT();
}

View File

@ -35,7 +35,6 @@
#include "VocBase/vocbase.h"
struct TRI_server_t;
struct TRI_vocbase_defaults_t;
namespace arangodb {
namespace basics {
@ -49,8 +48,6 @@ class ApplicationScheduler;
class AsyncJobManager;
class Dispatcher;
class HttpHandlerFactory;
class HttpServer;
class HttpsServer;
}
class ApplicationV8;

View File

@ -328,7 +328,7 @@ HttpResponse::HttpResponseCode VocbaseContext::authenticate() {
username = up.substr(0, n);
LOG(TRACE) << "checking authentication for user '" << username.c_str() << "'";
LOG(TRACE) << "checking authentication for user '" << username << "'";
bool res =
TRI_CheckAuthenticationAuthInfo(_vocbase, auth, username.c_str(),
up.substr(n + 1).c_str(), &mustChange);

View File

@ -262,7 +262,7 @@ bool CtrlHandler(DWORD eventType) {
}
if (ccTask->_seen == 0) {
LOG(INFO) << "" << shutdownMessage.c_str() << ", beginning shut down sequence";
LOG(INFO) << "" << shutdownMessage << ", beginning shut down sequence";
ccTask->_server->beginShutdown();
++ccTask->_seen;
return true;
@ -272,7 +272,7 @@ bool CtrlHandler(DWORD eventType) {
// user is desperate to kill the server!
// ........................................................................
LOG(INFO) << "" << shutdownMessage.c_str() << ", terminating";
LOG(INFO) << "" << shutdownMessage << ", terminating";
_exit(EXIT_FAILURE); // quick exit for windows
return true;
}

View File

@ -32,7 +32,6 @@ namespace arangodb {
namespace rest {
class ApplicationServer;
class Scheduler;
class SignalTask;
class Task;
////////////////////////////////////////////////////////////////////////////////

View File

@ -179,7 +179,7 @@ bool Scheduler::isShutdownInProgress() { return stopping != 0; }
void Scheduler::shutdown() {
for (auto& it : taskRegistered) {
std::string const name = it.second->name();
LOG(DEBUG) << "forcefully removing task '" << name.c_str() << "'";
LOG(DEBUG) << "forcefully removing task '" << name << "'";
deleteTask(it.second);
}
@ -328,12 +328,12 @@ int Scheduler::unregisterTask(Task* task) {
task); // TODO(fc) XXX remove this! This should be in the Task
if (it == task2thread.end()) {
LOG(WARN) << "unregisterTask called for an unknown task " << (void*)task << " (" << taskName.c_str() << ")";
LOG(WARN) << "unregisterTask called for an unknown task " << (void*)task << " (" << taskName << ")";
return TRI_ERROR_TASK_NOT_FOUND;
}
LOG(TRACE) << "unregisterTask for task " << (void*)task << " (" << taskName.c_str() << ")";
LOG(TRACE) << "unregisterTask for task " << (void*)task << " (" << taskName << ")";
thread = (*it).second;
@ -360,12 +360,12 @@ int Scheduler::destroyTask(Task* task) {
auto it = task2thread.find(task);
if (it == task2thread.end()) {
LOG(WARN) << "destroyTask called for an unknown task " << (void*)task << " (" << taskName.c_str() << ")";
LOG(WARN) << "destroyTask called for an unknown task " << (void*)task << " (" << taskName << ")";
return TRI_ERROR_TASK_NOT_FOUND;
}
LOG(TRACE) << "destroyTask for task " << (void*)task << " (" << taskName.c_str() << ")";
LOG(TRACE) << "destroyTask for task " << (void*)task << " (" << taskName << ")";
thread = (*it).second;
@ -442,7 +442,7 @@ int Scheduler::registerTask(Task* task, ssize_t* got, ssize_t want) {
}
std::string const& name = task->name();
LOG(TRACE) << "registerTask for task " << (void*)task << " (" << name.c_str() << ")";
LOG(TRACE) << "registerTask for task " << (void*)task << " (" << name << ")";
// determine thread
SchedulerThread* thread = nullptr;

View File

@ -29,8 +29,6 @@
#include "Utils/CollectionKeys.h"
#include "VocBase/voc-types.h"
struct TRI_json_t;
namespace arangodb {
class CollectionKeys;

View File

@ -958,7 +958,7 @@ bool ApplicationV8::prepare() {
paths.push_back(std::string("application '" + _appPath + "'"));
}
LOG(INFO) << "JavaScript using " << StringUtils::join(paths, ", ").c_str();
LOG(INFO) << "JavaScript using " << StringUtils::join(paths, ", ");
}
// check whether app-path was specified
@ -972,7 +972,7 @@ bool ApplicationV8::prepare() {
// add v8 options
if (!_v8Options.empty()) {
LOG(INFO) << "using V8 options '" << _v8Options.c_str() << "'";
LOG(INFO) << "using V8 options '" << _v8Options << "'";
v8::V8::SetFlagsFromString(_v8Options.c_str(), (int)_v8Options.size());
}
@ -1359,18 +1359,18 @@ void ApplicationV8::prepareV8Server(size_t i, std::string const& startupFile) {
// load server startup file
switch (_startupLoader.loadScript(isolate, localContext, startupFile)) {
case JSLoader::eSuccess:
LOG(TRACE) << "loaded JavaScript file '" << startupFile.c_str()
LOG(TRACE) << "loaded JavaScript file '" << startupFile
<< "'";
break;
case JSLoader::eFailLoad:
LOG(FATAL) << "cannot load JavaScript utilities from file '"
<< startupFile.c_str() << "'";
<< startupFile << "'";
FATAL_ERROR_EXIT();
break;
case JSLoader::eFailExecute:
LOG(FATAL)
<< "error during execution of JavaScript utilities from file '"
<< startupFile.c_str() << "'";
<< startupFile << "'";
FATAL_ERROR_EXIT();
break;
}

View File

@ -42,7 +42,6 @@ class QueryRegistry;
}
namespace rest {
class HttpRequest;
class ApplicationDispatcher;
class ApplicationScheduler;
}

View File

@ -126,7 +126,7 @@ class v8_action_t : public TRI_action_t {
_callbacks.find(context->isolate);
if (i == _callbacks.end()) {
LOG(WARN) << "no callback function for JavaScript action '" << _url.c_str() << "'";
LOG(WARN) << "no callback function for JavaScript action '" << _url << "'";
GlobalV8Dealer->exitContext(context);

View File

@ -235,8 +235,9 @@ static v8::Handle<v8::Object> SetBasicDocumentAttributesShaped(
/// @brief weak reference callback for a ditch
////////////////////////////////////////////////////////////////////////////////
static void WeakDocumentDitchCallback(const v8::WeakCallbackData<
v8::External, v8::Persistent<v8::External>>& data) {
static void WeakDocumentDitchCallback(
const v8::WeakCallbackData<v8::External, v8::Persistent<v8::External>>&
data) {
auto isolate = data.GetIsolate();
auto persistent = data.GetParameter();
auto myDitch = v8::Local<v8::External>::New(isolate, *persistent);
@ -797,7 +798,8 @@ static void PropertyQueryShapedJson(
if (sid == TRI_SHAPE_ILLEGAL) {
// invalid shape
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(WARN) << "invalid shape id '" << sid << "' found for key '" << key.c_str() << "'";
LOG(WARN) << "invalid shape id '" << sid << "' found for key '" << key
<< "'";
#endif
TRI_V8_RETURN(v8::Handle<v8::Integer>());
}

View File

@ -156,69 +156,4 @@ static inline TRI_voc_rid_t TRI_EXTRACT_MARKER_RID(arangodb::Transaction* trx,
trx, static_cast<TRI_df_marker_t const*>(mptr->getDataPtr()));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief compares the key from a master pointer to the given key
////////////////////////////////////////////////////////////////////////////////
static inline bool TRI_MATCHES_MARKER_KEY(arangodb::Transaction* trx,
TRI_doc_mptr_t const* mptr,
char const* key) {
auto marker = static_cast<TRI_df_marker_t const*>(mptr->getDataPtr());
if (marker->_type == TRI_WAL_MARKER_VPACK_DOCUMENT) {
auto b = reinterpret_cast<char const*>(marker) +
sizeof(arangodb::wal::vpack_document_marker_t);
VPackSlice slice(reinterpret_cast<uint8_t const*>(b), trx->vpackOptions());
VPackValueLength len;
char const* p = slice.get(TRI_VOC_ATTRIBUTE_KEY).getString(len);
if (len != strlen(key)) {
return false;
}
return (memcmp(p, key, len) == 0);
}
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
// invalid marker type
TRI_ASSERT(false);
#endif
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief compares the key from a master pointer to the given key
////////////////////////////////////////////////////////////////////////////////
static inline bool TRI_MATCHES_MARKER_KEY(arangodb::Transaction* trx,
TRI_doc_mptr_t const* left,
TRI_doc_mptr_t const* right) {
auto lm = static_cast<TRI_df_marker_t const*>(left->getDataPtr());
auto rm = static_cast<TRI_df_marker_t const*>(right->getDataPtr());
if (lm->_type == TRI_WAL_MARKER_VPACK_DOCUMENT &&
rm->_type == TRI_WAL_MARKER_VPACK_DOCUMENT) {
auto lb = reinterpret_cast<char const*>(lm) +
sizeof(arangodb::wal::vpack_document_marker_t);
VPackSlice ls(reinterpret_cast<uint8_t const*>(lb), trx->vpackOptions());
VPackValueLength llen;
char const* p = ls.get(TRI_VOC_ATTRIBUTE_KEY).getString(llen);
auto rb = reinterpret_cast<char const*>(rm) +
sizeof(arangodb::wal::vpack_document_marker_t);
VPackSlice rs(reinterpret_cast<uint8_t const*>(rb), trx->vpackOptions());
VPackValueLength rlen;
char const* q = rs.get(TRI_VOC_ATTRIBUTE_KEY).getString(rlen);
if (llen != rlen) {
return false;
}
return (memcmp(p, q, llen) == 0);
}
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
// invalid marker type
TRI_ASSERT(false);
#endif
return false;
}
#endif

View File

@ -573,7 +573,8 @@ TRI_shape_aid_t VocShaper::findOrCreateAttributeByName(char const* name) {
res = TRI_ERROR_INTERNAL;
}
LOG(WARN) << "could not save attribute marker in log: " << TRI_errno_string(res);
LOG(WARN) << "could not save attribute marker in log: "
<< TRI_errno_string(res);
return 0;
}
@ -862,9 +863,11 @@ int VocShaper::insertShape(TRI_df_marker_t const* marker,
bool const isIdentical = EqualElementShape(nullptr, f, l);
if (isIdentical) {
// duplicate shape, but with identical content. simply ignore it
LOG(TRACE) << "found duplicate shape markers for id " << l->_sid << " in collection '" << name.c_str() << "' in shape dictionary";
LOG(TRACE) << "found duplicate shape markers for id " << l->_sid
<< " in collection '" << name << "' in shape dictionary";
} else {
LOG(ERR) << "found heterogenous shape markers for id " << l->_sid << " in collection '" << name.c_str() << "' in shape dictionary";
LOG(ERR) << "found heterogenous shape markers for id " << l->_sid
<< " in collection '" << name << "' in shape dictionary";
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
TRI_ASSERT(false);
#endif
@ -882,9 +885,11 @@ int VocShaper::insertShape(TRI_df_marker_t const* marker,
if (isIdentical) {
// duplicate shape, but with identical content. simply ignore it
LOG(TRACE) << "found duplicate shape markers for id " << l->_sid << " in collection '" << name.c_str() << "' in shape ids table";
LOG(TRACE) << "found duplicate shape markers for id " << l->_sid
<< " in collection '" << name << "' in shape ids table";
} else {
LOG(ERR) << "found heterogenous shape markers for id " << l->_sid << " in collection '" << name.c_str() << "' in shape ids table";
LOG(ERR) << "found heterogenous shape markers for id " << l->_sid
<< " in collection '" << name << "' in shape ids table";
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
TRI_ASSERT(false);
#endif
@ -940,9 +945,11 @@ int VocShaper::insertAttribute(TRI_df_marker_t const* marker,
if (isIdentical) {
// duplicate attribute, but with identical content. simply ignore it
LOG(TRACE) << "found duplicate attribute name '" << name << "' in collection '" << cname.c_str() << "'";
LOG(TRACE) << "found duplicate attribute name '" << name
<< "' in collection '" << cname << "'";
} else {
LOG(ERR) << "found heterogenous attribute name '" << name << "' in collection '" << cname.c_str() << "'";
LOG(ERR) << "found heterogenous attribute name '" << name
<< "' in collection '" << cname << "'";
}
}
@ -958,9 +965,11 @@ int VocShaper::insertAttribute(TRI_df_marker_t const* marker,
if (isIdentical) {
// duplicate attribute, but with identical content. simply ignore it
LOG(TRACE) << "found duplicate attribute id '" << aid << "' in collection '" << cname.c_str() << "'";
LOG(TRACE) << "found duplicate attribute id '" << aid
<< "' in collection '" << cname << "'";
} else {
LOG(ERR) << "found heterogenous attribute id '" << aid << "' in collection '" << cname.c_str() << "'";
LOG(ERR) << "found heterogenous attribute id '" << aid
<< "' in collection '" << cname << "'";
}
}
@ -1041,7 +1050,8 @@ bool VocShaper::extractShapedJson(TRI_shaped_json_t const* document,
if (accessor == nullptr) {
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(TRACE) << "failed to get accessor for sid " << document->_sid << " and path " << pid;
LOG(TRACE) << "failed to get accessor for sid " << document->_sid
<< " and path " << pid;
#endif
return false;
}
@ -1059,7 +1069,8 @@ bool VocShaper::extractShapedJson(TRI_shaped_json_t const* document,
if (*shape == nullptr) {
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(TRACE) << "expecting any object for path " << pid << ", got unknown shape id " << accessor->_resultSid;
LOG(TRACE) << "expecting any object for path " << pid
<< ", got unknown shape id " << accessor->_resultSid;
#endif
*shape = nullptr;
@ -1068,7 +1079,8 @@ bool VocShaper::extractShapedJson(TRI_shaped_json_t const* document,
if (sid != 0 && sid != accessor->_resultSid) {
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(TRACE) << "expecting sid " << sid << " for path " << pid << ", got sid " << accessor->_resultSid;
LOG(TRACE) << "expecting sid " << sid << " for path " << pid << ", got sid "
<< accessor->_resultSid;
#endif
return false;
}
@ -1077,7 +1089,8 @@ bool VocShaper::extractShapedJson(TRI_shaped_json_t const* document,
if (!ok) {
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(TRACE) << "failed to get accessor for sid " << document->_sid << " and path " << pid;
LOG(TRACE) << "failed to get accessor for sid " << document->_sid
<< " and path " << pid;
#endif
return false;
}

View File

@ -52,7 +52,6 @@
////////////////////////////////////////////////////////////////////////////////
struct TRI_json_t;
class TRI_vocbase_col_t;
namespace arangodb {
class CollectionInfo;

View File

@ -389,7 +389,7 @@ static int TruncateAndSealDatafile(TRI_datafile_t* datafile,
if (fd < 0) {
TRI_SYSTEM_ERROR();
LOG(ERR) << "cannot create new datafile '" << filename.c_str() << "': " << TRI_GET_ERRORBUF;
LOG(ERR) << "cannot create new datafile '" << filename << "': " << TRI_GET_ERRORBUF;
return TRI_set_errno(TRI_ERROR_SYS_ERROR);
}
@ -405,7 +405,7 @@ static int TruncateAndSealDatafile(TRI_datafile_t* datafile,
// remove empty file
TRI_UnlinkFile(filename.c_str());
LOG(ERR) << "cannot seek in new datafile '" << filename.c_str() << "': " << TRI_GET_ERRORBUF;
LOG(ERR) << "cannot seek in new datafile '" << filename << "': " << TRI_GET_ERRORBUF;
return TRI_ERROR_SYS_ERROR;
}
@ -421,7 +421,7 @@ static int TruncateAndSealDatafile(TRI_datafile_t* datafile,
// remove empty file
TRI_UnlinkFile(filename.c_str());
LOG(ERR) << "cannot create datafile '" << filename.c_str() << "': " << TRI_GET_ERRORBUF;
LOG(ERR) << "cannot create datafile '" << filename << "': " << TRI_GET_ERRORBUF;
return TRI_ERROR_SYS_ERROR;
}
@ -438,7 +438,7 @@ static int TruncateAndSealDatafile(TRI_datafile_t* datafile,
// remove empty file
TRI_UnlinkFile(filename.c_str());
LOG(ERR) << "cannot memory map file '" << filename.c_str() << "': " << TRI_GET_ERRORBUF;
LOG(ERR) << "cannot memory map file '" << filename << "': " << TRI_GET_ERRORBUF;
return TRI_errno();
}

View File

@ -2603,7 +2603,7 @@ int TRI_FromVelocyPackIndexDocumentCollection(
}
// default:
LOG(WARN) << "index type '" << typeStr.c_str() << "' is not supported in this version of ArangoDB and is ignored";
LOG(WARN) << "index type '" << typeStr << "' is not supported in this version of ArangoDB and is ignored";
return TRI_ERROR_NO_ERROR;
}
@ -3906,7 +3906,7 @@ static arangodb::Index* CreateGeoIndexDocumentCollection(
}
if (idx != nullptr) {
LOG(TRACE) << "geo-index already created for location '" << location.c_str() << "'";
LOG(TRACE) << "geo-index already created for location '" << location << "'";
created = false;
@ -3927,7 +3927,7 @@ static arangodb::Index* CreateGeoIndexDocumentCollection(
{{location, false}}},
std::vector<TRI_shape_pid_t>{loc}, geoJson));
LOG(TRACE) << "created geo-index for location '" << location.c_str() << "': " << loc;
LOG(TRACE) << "created geo-index for location '" << location << "': " << loc;
} else if (!longitude.empty() && !latitude.empty()) {
geoIndex.reset(new arangodb::GeoIndex2(
iid, document,
@ -3935,7 +3935,7 @@ static arangodb::Index* CreateGeoIndexDocumentCollection(
{{latitude, false}}, {{longitude, false}}},
std::vector<TRI_shape_pid_t>{lat, lon}));
LOG(TRACE) << "created geo-index for location '" << location.c_str() << "': " << lat << ", " << lon;
LOG(TRACE) << "created geo-index for location '" << location << "': " << lat << ", " << lon;
}
idx = static_cast<arangodb::GeoIndex2*>(geoIndex.get());
@ -4021,7 +4021,7 @@ static int GeoIndexFromVelocyPack(arangodb::Transaction* trx,
return idx == nullptr ? TRI_errno() : TRI_ERROR_NO_ERROR;
} else {
LOG(ERR) << "ignoring " << typeStr.c_str() << "-index " << iid << ", 'fields' must be a list with 1 entries";
LOG(ERR) << "ignoring " << typeStr << "-index " << iid << ", 'fields' must be a list with 1 entries";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -4045,7 +4045,7 @@ static int GeoIndexFromVelocyPack(arangodb::Transaction* trx,
return idx == nullptr ? TRI_errno() : TRI_ERROR_NO_ERROR;
} else {
LOG(ERR) << "ignoring " << typeStr.c_str() << "-index " << iid << ", 'fields' must be a list with 2 entries";
LOG(ERR) << "ignoring " << typeStr << "-index " << iid << ", 'fields' must be a list with 2 entries";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}

View File

@ -1107,13 +1107,13 @@ int TRI_replication_applier_t::start(TRI_voc_tick_t initialTick, bool useTick,
if (useTick) {
LOG_TOPIC(INFO, Logger::REPLICATION)
<< "started replication applier for database '" << _databaseName.c_str()
<< "started replication applier for database '" << _databaseName
<< "', endpoint '" << _configuration._endpoint << "' from tick "
<< initialTick;
} else {
LOG_TOPIC(INFO, Logger::REPLICATION)
<< "re-started replication applier for database '"
<< _databaseName.c_str() << "', endpoint '" << _configuration._endpoint
<< _databaseName << "', endpoint '" << _configuration._endpoint
<< "'";
}
@ -1233,7 +1233,7 @@ int TRI_replication_applier_t::stop(bool resetError) {
setTermination(false);
LOG_TOPIC(INFO, Logger::REPLICATION)
<< "stopped replication applier for database '" << _databaseName.c_str()
<< "stopped replication applier for database '" << _databaseName
<< "'";
return res;
@ -1299,7 +1299,7 @@ int TRI_replication_applier_t::shutdown() {
setTermination(false);
LOG_TOPIC(INFO, Logger::REPLICATION)
<< "shut down replication applier for database '" << _databaseName.c_str()
<< "shut down replication applier for database '" << _databaseName
<< "'";
return res;

View File

@ -282,13 +282,6 @@ class TRI_replication_applier_t {
TRI_replication_applier_t* TRI_CreateReplicationApplier(TRI_server_t*,
TRI_vocbase_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief get a JSON representation of the replication apply configuration
////////////////////////////////////////////////////////////////////////////////
struct TRI_json_t* TRI_JsonConfigurationReplicationApplier(
TRI_replication_applier_configuration_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief configure the replication applier
////////////////////////////////////////////////////////////////////////////////

View File

@ -312,7 +312,7 @@ static int CreateBaseApplicationDirectory(char const* basePath,
} else {
if ((res != TRI_ERROR_FILE_EXISTS) || (!TRI_IsDirectory(path))) {
LOG(ERR) << "unable to create base application directory "
<< errorMessage.c_str();
<< errorMessage;
} else {
LOG(INFO) << "otherone created base application directory '" << path
<< "'";
@ -356,11 +356,11 @@ static int CreateApplicationDirectory(char const* name, char const* basePath) {
} else if (res == TRI_ERROR_FILE_EXISTS) {
LOG(INFO) << "unable to create application directory '" << path
<< "' for database '" << name
<< "': " << errorMessage.c_str();
<< "': " << errorMessage;
res = TRI_ERROR_NO_ERROR;
} else {
LOG(ERR) << "unable to create application directory '" << path
<< "' for database '" << name << "': " << errorMessage.c_str();
<< "' for database '" << name << "': " << errorMessage;
}
}
@ -421,7 +421,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
// the database directory we found is not writable for the current user
// this can cause serious trouble so we will abort the server start if we
// encounter this situation
LOG(ERR) << "database directory '" << databaseDirectory.c_str()
LOG(ERR) << "database directory '" << databaseDirectory
<< "' is not writable for current user";
res = TRI_ERROR_ARANGO_DATADIR_NOT_WRITABLE;
@ -434,7 +434,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
if (TRI_ExistsFile(tmpfile.c_str())) {
// still a temporary... must ignore
LOG(TRACE) << "ignoring temporary directory '" << tmpfile.c_str() << "'";
LOG(TRACE) << "ignoring temporary directory '" << tmpfile << "'";
continue;
}
@ -450,7 +450,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
if (!TRI_ExistsFile(parametersFile.c_str())) {
// no parameter.json file
LOG(ERR) << "database directory '" << databaseDirectory.c_str()
LOG(ERR) << "database directory '" << databaseDirectory
<< "' does not contain parameters file or parameters file "
"cannot be read";
@ -460,13 +460,13 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
}
LOG(DEBUG) << "reading database parameters from file '"
<< parametersFile.c_str() << "'";
<< parametersFile << "'";
std::shared_ptr<VPackBuilder> builder;
try {
builder = arangodb::basics::VelocyPackHelper::velocyPackFromFile(
parametersFile);
} catch (...) {
LOG(ERR) << "database directory '" << databaseDirectory.c_str()
LOG(ERR) << "database directory '" << databaseDirectory
<< "' does not contain a valid parameters file";
// abort
@ -476,16 +476,16 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
VPackSlice parameters = builder->slice();
std::string parametersString = parameters.toJson();
LOG(DEBUG) << "database parameters: " << parametersString.c_str();
LOG(DEBUG) << "database parameters: " << parametersString;
if (arangodb::basics::VelocyPackHelper::getBooleanValue(parameters,
"deleted", false)) {
// database is deleted, skip it!
LOG(INFO) << "found dropped database in directory '"
<< databaseDirectory.c_str() << "'";
<< databaseDirectory << "'";
LOG(INFO) << "removing superfluous database directory '"
<< databaseDirectory.c_str() << "'";
<< databaseDirectory << "'";
TRI_RemoveDirectory(databaseDirectory.c_str());
continue;
@ -493,7 +493,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
VPackSlice idSlice = parameters.get("id");
if (!idSlice.isString()) {
LOG(ERR) << "database directory '" << databaseDirectory.c_str()
LOG(ERR) << "database directory '" << databaseDirectory
<< "' does not contain a valid parameters file";
res = TRI_ERROR_ARANGO_ILLEGAL_PARAMETER_FILE;
break;
@ -505,7 +505,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
VPackSlice nameSlice = parameters.get("name");
if (!nameSlice.isString()) {
LOG(ERR) << "database directory '" << databaseDirectory.c_str()
LOG(ERR) << "database directory '" << databaseDirectory
<< "' does not contain a valid parameters file";
res = TRI_ERROR_ARANGO_ILLEGAL_PARAMETER_FILE;
@ -547,8 +547,8 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
}
LOG(ERR) << "could not process database directory '"
<< databaseDirectory.c_str() << "' for database '"
<< name.c_str() << "': " << TRI_errno_string(res);
<< databaseDirectory << "' for database '"
<< name << "': " << TRI_errno_string(res);
break;
}
@ -563,7 +563,7 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
}
} catch (...) {
res = TRI_ERROR_OUT_OF_MEMORY;
LOG(ERR) << "could not add database '" << name.c_str()
LOG(ERR) << "could not add database '" << name
<< "': out of memory";
break;
}
@ -829,7 +829,7 @@ static int CreateDatabaseDirectory(TRI_server_t* server, TRI_voc_tick_t tick,
if (res != TRI_ERROR_NO_ERROR) {
if (res != TRI_ERROR_FILE_EXISTS) {
LOG(ERR) << "failed to create database directory: "
<< errorMessage.c_str();
<< errorMessage;
}
return res;
}
@ -1308,7 +1308,7 @@ int TRI_StartServer(TRI_server_t* server, bool checkVersion,
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to create database directory '"
<< server->_databasePath << "': " << errorMessage.c_str();
<< server->_databasePath << "': " << errorMessage;
return TRI_ERROR_ARANGO_DATADIR_NOT_WRITABLE;
}
@ -1354,7 +1354,7 @@ int TRI_StartServer(TRI_server_t* server, bool checkVersion,
<< server->_appPath << "'.";
} else {
LOG(ERR) << "unable to create --javascript.app-path directory '"
<< server->_appPath << "': " << errorMessage.c_str();
<< server->_appPath << "': " << errorMessage;
return TRI_ERROR_SYS_ERROR;
}
}
@ -1615,10 +1615,10 @@ int TRI_CreateDatabaseServer(TRI_server_t* server, TRI_voc_tick_t databaseId,
if (arangodb::wal::LogfileManager::instance()->isInRecovery()) {
LOG(TRACE) << "creating database '" << name << "', directory '"
<< path.c_str() << "'";
<< path << "'";
} else {
LOG(INFO) << "creating database '" << name << "', directory '"
<< path.c_str() << "'";
<< path << "'";
}
vocbase = TRI_OpenVocBase(server, path.c_str(), databaseId, name, defaults,

View File

@ -27,8 +27,6 @@
#include "vocbase.h"
#include <regex.h>
#include "Aql/QueryCache.h"
#include "Aql/QueryList.h"
#include "Basics/conversions.h"
@ -332,39 +330,15 @@ static bool UnloadCollectionCallback(TRI_collection_t* col, void* data) {
////////////////////////////////////////////////////////////////////////////////
static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
TRI_vocbase_t* vocbase;
regmatch_t matches[4];
regex_t re;
int res;
TRI_vocbase_col_t* collection = static_cast<TRI_vocbase_col_t*>(data);
std::string const name(collection->name());
#ifdef _WIN32
// .........................................................................
// Just thank your lucky stars that there are only 4 backslashes
// .........................................................................
res = regcomp(&re, "^(.*)\\\\collection-([0-9][0-9]*)(-[0-9]+)?$",
REG_ICASE | REG_EXTENDED);
#else
res = regcomp(&re, "^(.*)/collection-([0-9][0-9]*)(-[0-9]+)?$",
REG_ICASE | REG_EXTENDED);
#endif
if (res != 0) {
LOG(ERR) << "unable to complile regular expression";
return false;
}
TRI_EVENTUAL_WRITE_LOCK_STATUS_VOCBASE_COL(collection);
if (collection->_status != TRI_VOC_COL_STATUS_DELETED) {
LOG(ERR) << "someone resurrected the collection '" << name << "'";
TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection);
regfree(&re);
return false;
}
@ -375,7 +349,7 @@ static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
if (collection->_collection != nullptr) {
TRI_document_collection_t* document = collection->_collection;
res = TRI_CloseDocumentCollection(document, false);
int res = TRI_CloseDocumentCollection(document, false);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to close collection '" << name
@ -383,8 +357,6 @@ static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection);
regfree(&re);
return true;
}
@ -399,7 +371,7 @@ static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
// remove from list of collections
// .............................................................................
vocbase = collection->_vocbase;
TRI_vocbase_t* vocbase = collection->_vocbase;
{
WRITE_LOCKER(writeLocker, vocbase->_collectionsLock);
@ -420,43 +392,51 @@ static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
// .............................................................................
if (!collection->path().empty()) {
int regExpResult;
std::string const collectionPath = collection->path();
regExpResult = regexec(&re, collection->pathc_str(),
sizeof(matches) / sizeof(matches[0]), matches, 0);
#ifdef _WIN32
size_t pos = collectionPath.find_last_of('\\');
#else
size_t pos = collectionPath.find_last_of('/');
#endif
if (regExpResult == 0) {
char const* first = collection->pathc_str() + matches[1].rm_so;
size_t firstLen = matches[1].rm_eo - matches[1].rm_so;
bool invalid = false;
char const* second = collection->pathc_str() + matches[2].rm_so;
size_t secondLen = matches[2].rm_eo - matches[2].rm_so;
if (pos == std::string::npos || pos + 1 >= collectionPath.size()) {
invalid = true;
}
char* tmp1;
char* tmp2;
char* tmp3;
std::string path;
std::string relName;
if (!invalid) {
// extract path part
if (pos > 0) {
path = collectionPath.substr(0, pos);
}
char* newFilename;
// extract relative filename
relName = collectionPath.substr(pos + 1);
tmp1 = TRI_DuplicateString(first, firstLen);
tmp2 = TRI_DuplicateString(second, secondLen);
tmp3 = TRI_Concatenate2String("deleted-", tmp2);
if (!StringUtils::isPrefix(relName, "collection-") ||
StringUtils::isSuffix(relName, ".tmp")) {
invalid = true;
}
}
TRI_FreeString(TRI_CORE_MEM_ZONE, tmp2);
if (!invalid) {
// prefix the collection name with "deleted-"
newFilename = TRI_Concatenate2File(tmp1, tmp3);
TRI_FreeString(TRI_CORE_MEM_ZONE, tmp1);
TRI_FreeString(TRI_CORE_MEM_ZONE, tmp3);
std::string const newFilename =
FileUtils::buildFilename(path, "deleted-" + relName.substr(std::string("collection-").size()));
// check if target directory already exists
if (TRI_IsDirectory(newFilename)) {
// no need to rename
TRI_RemoveDirectory(newFilename);
if (TRI_IsDirectory(newFilename.c_str())) {
// remove existing target directory
TRI_RemoveDirectory(newFilename.c_str());
}
// perform the rename
res = TRI_RenameFile(collection->pathc_str(), newFilename);
int res = TRI_RenameFile(collection->pathc_str(), newFilename.c_str());
LOG(TRACE) << "renaming collection directory from '"
<< collection->pathc_str() << "' to '" << newFilename << "'";
@ -469,23 +449,19 @@ static bool DropCollectionCallback(TRI_collection_t* col, void* data) {
LOG(DEBUG) << "wiping dropped collection '" << name
<< "' from disk";
res = TRI_RemoveDirectory(newFilename);
res = TRI_RemoveDirectory(newFilename.c_str());
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "cannot wipe dropped collection '" << name
<< "' from disk: " << TRI_errno_string(res);
}
}
TRI_FreeString(TRI_CORE_MEM_ZONE, newFilename);
} else {
LOG(ERR) << "cannot rename dropped collection '" << name
<< "': unknown path '" << collection->pathc_str() << "'";
}
}
regfree(&re);
return true;
}

View File

@ -8,8 +8,6 @@
#include "VocBase/voc-types.h"
#include "Wal/Marker.h"
struct TRI_transaction_collection_s;
namespace arangodb {
class Transaction;

View File

@ -58,7 +58,7 @@ Logfile* Logfile::createNew(std::string const& filename, Logfile::IdType id,
int res = TRI_errno();
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to create logfile '" << filename.c_str() << "': " << TRI_errno_string(res);
LOG(ERR) << "unable to create logfile '" << filename << "': " << TRI_errno_string(res);
return nullptr;
}
}
@ -78,12 +78,12 @@ Logfile* Logfile::openExisting(std::string const& filename, Logfile::IdType id,
int res = TRI_errno();
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to open logfile '" << filename.c_str() << "': " << TRI_errno_string(res);
LOG(ERR) << "unable to open logfile '" << filename << "': " << TRI_errno_string(res);
return nullptr;
}
// cannot figure out the type of error
LOG(ERR) << "unable to open logfile '" << filename.c_str() << "'";
LOG(ERR) << "unable to open logfile '" << filename << "'";
return nullptr;
}

View File

@ -294,7 +294,7 @@ class Logfile {
break;
}
LOG(TRACE) << "changing logfile status from " << statusText(_status).c_str() << " to " << statusText(status).c_str() << " for logfile " << id();
LOG(TRACE) << "changing logfile status from " << statusText(_status) << " to " << statusText(status) << " for logfile " << id();
_status = status;
}

View File

@ -248,11 +248,11 @@ bool LogfileManager::prepare() {
systemErrorStr);
if (res) {
LOG(INFO) << "created database directory '" << _directory.c_str()
LOG(INFO) << "created database directory '" << _directory
<< "'.";
} else {
LOG(FATAL) << "unable to create database directory: "
<< systemErrorStr.c_str();
<< systemErrorStr;
FATAL_ERROR_EXIT();
}
}
@ -346,7 +346,7 @@ bool LogfileManager::start() {
res = readShutdownInfo();
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "could not open shutdown file '" << shutdownFile.c_str()
LOG(ERR) << "could not open shutdown file '" << shutdownFile
<< "': " << TRI_errno_string(res);
return false;
}
@ -1752,7 +1752,7 @@ void LogfileManager::removeLogfile(Logfile* logfile) {
Logfile::IdType const id = logfile->id();
std::string const filename = logfileName(id);
LOG(TRACE) << "removing logfile '" << filename.c_str() << "'";
LOG(TRACE) << "removing logfile '" << filename << "'";
// now close the logfile
delete logfile;
@ -1761,7 +1761,7 @@ void LogfileManager::removeLogfile(Logfile* logfile) {
// now physically remove the file
if (!basics::FileUtils::remove(filename, &res)) {
LOG(ERR) << "unable to remove logfile '" << filename.c_str()
LOG(ERR) << "unable to remove logfile '" << filename
<< "': " << TRI_errno_string(res);
}
}
@ -1919,7 +1919,7 @@ int LogfileManager::readShutdownInfo() {
if (shutdownTime.empty()) {
LOG(TRACE) << "no previous shutdown time found";
} else {
LOG(TRACE) << "previous shutdown was at '" << shutdownTime.c_str() << "'";
LOG(TRACE) << "previous shutdown was at '" << shutdownTime << "'";
}
{
@ -1986,11 +1986,11 @@ int LogfileManager::writeShutdownInfo(bool writeShutdownTime) {
}
if (!ok) {
LOG(ERR) << "unable to write WAL state file '" << filename.c_str() << "'";
LOG(ERR) << "unable to write WAL state file '" << filename << "'";
return TRI_ERROR_CANNOT_WRITE_FILE;
}
} catch (...) {
LOG(ERR) << "unable to write WAL state file '" << filename.c_str() << "'";
LOG(ERR) << "unable to write WAL state file '" << filename << "'";
return TRI_ERROR_OUT_OF_MEMORY;
}
@ -2141,7 +2141,7 @@ int LogfileManager::inventory() {
return res;
}
LOG(TRACE) << "scanning WAL directory: '" << _directory.c_str() << "'";
LOG(TRACE) << "scanning WAL directory: '" << _directory << "'";
std::vector<std::string> files = basics::FileUtils::listFiles(_directory);
@ -2186,8 +2186,8 @@ int LogfileManager::inspectLogfiles() {
if (logfile != nullptr) {
std::string const logfileName = logfile->filename();
LOG(DEBUG) << "logfile " << logfile->id() << ", filename '"
<< logfileName.c_str() << "', status "
<< logfile->statusText().c_str();
<< logfileName << "', status "
<< logfile->statusText();
}
}
#endif
@ -2233,19 +2233,19 @@ int LogfileManager::inspectLogfiles() {
}
LOG(TRACE) << "inspecting logfile " << logfile->id() << " ("
<< logfile->statusText().c_str() << ")";
<< logfile->statusText() << ")";
// update the tick statistics
if (!TRI_IterateDatafile(logfile->df(), &RecoverState::InitialScanMarker,
static_cast<void*>(_recoverState))) {
std::string const logfileName = logfile->filename();
LOG(WARN) << "WAL inspection failed when scanning logfile '"
<< logfileName.c_str() << "'";
<< logfileName << "'";
return TRI_ERROR_ARANGO_RECOVERY;
}
LOG(TRACE) << "inspected logfile " << logfile->id() << " ("
<< logfile->statusText().c_str()
<< logfile->statusText()
<< "), tickMin: " << logfile->df()->_tickMin
<< ", tickMax: " << logfile->df()->_tickMax;
@ -2287,7 +2287,7 @@ int LogfileManager::createReserveLogfile(uint32_t size) {
Logfile::IdType const id = nextId();
std::string const filename = logfileName(id);
LOG(TRACE) << "creating empty logfile '" << filename.c_str() << "' with size "
LOG(TRACE) << "creating empty logfile '" << filename << "' with size "
<< size;
uint32_t realsize;
@ -2338,19 +2338,19 @@ int LogfileManager::ensureDirectory() {
}
if (!basics::FileUtils::isDirectory(directory)) {
LOG(INFO) << "WAL directory '" << directory.c_str()
LOG(INFO) << "WAL directory '" << directory
<< "' does not exist. creating it...";
int res;
if (!basics::FileUtils::createDirectory(directory, &res)) {
LOG(ERR) << "could not create WAL directory: '" << directory.c_str()
LOG(ERR) << "could not create WAL directory: '" << directory
<< "': " << TRI_last_error();
return TRI_ERROR_SYS_ERROR;
}
}
if (!basics::FileUtils::isDirectory(directory)) {
LOG(ERR) << "WAL directory '" << directory.c_str() << "' does not exist";
LOG(ERR) << "WAL directory '" << directory << "' does not exist";
return TRI_ERROR_FILE_NOT_FOUND;
}

View File

@ -79,21 +79,21 @@ static int WaitForDeletion(TRI_server_t* server, TRI_voc_tick_t databaseId,
// wait for at most 30 seconds for the directory to be removed
while (TRI_IsDirectory(result.c_str())) {
if (iterations == 0) {
LOG(TRACE) << "waiting for deletion of database directory '" << result.c_str() << "', called with status code " << statusCode;
LOG(TRACE) << "waiting for deletion of database directory '" << result << "', called with status code " << statusCode;
if (statusCode != TRI_ERROR_FORBIDDEN &&
(statusCode == TRI_ERROR_ARANGO_DATABASE_NOT_FOUND ||
statusCode != TRI_ERROR_NO_ERROR)) {
LOG(WARN) << "forcefully deleting database directory '" << result.c_str() << "'";
LOG(WARN) << "forcefully deleting database directory '" << result << "'";
TRI_RemoveDirectory(result.c_str());
}
} else if (iterations >= 30 * 10) {
LOG(WARN) << "unable to remove database directory '" << result.c_str() << "'";
LOG(WARN) << "unable to remove database directory '" << result << "'";
return TRI_ERROR_INTERNAL;
}
if (iterations == 5 * 10) {
LOG(INFO) << "waiting for deletion of database directory '" << result.c_str() << "'";
LOG(INFO) << "waiting for deletion of database directory '" << result << "'";
}
++iterations;
@ -1268,7 +1268,7 @@ int RecoverState::replayLogfile(Logfile* logfile, int number) {
int const n = static_cast<int>(logfilesToProcess.size());
LOG(INFO) << "replaying WAL logfile '" << logfileName.c_str() << "' (" << number + 1 << " of " << n << ")";
LOG(INFO) << "replaying WAL logfile '" << logfileName << "' (" << number + 1 << " of " << n << ")";
// Advise on sequential use:
TRI_MMFileAdvise(logfile->df()->_data, logfile->df()->_maximalSize,
@ -1278,7 +1278,7 @@ int RecoverState::replayLogfile(Logfile* logfile, int number) {
if (!TRI_IterateDatafile(logfile->df(), &RecoverState::ReplayMarker,
static_cast<void*>(this))) {
LOG(WARN) << "WAL inspection failed when scanning logfile '" << logfileName.c_str() << "'";
LOG(WARN) << "WAL inspection failed when scanning logfile '" << logfileName << "'";
return TRI_ERROR_ARANGO_RECOVERY;
}
@ -1369,7 +1369,7 @@ int RecoverState::removeEmptyLogfiles() {
auto filename = (*it);
if (basics::FileUtils::remove(filename, 0)) {
LOG(TRACE) << "removing empty WAL logfile '" << filename.c_str() << "'";
LOG(TRACE) << "removing empty WAL logfile '" << filename << "'";
}
}

View File

@ -27,8 +27,6 @@
#include "Basics/Common.h"
#include "Wal/Logfile.h"
struct TRI_df_marker_s;
namespace arangodb {
namespace wal {

View File

@ -29,7 +29,6 @@
namespace arangodb {
namespace wal {
class Slots;
struct SyncRegion {
SyncRegion()

View File

@ -97,14 +97,16 @@ class BenchmarkThread : public arangodb::Thread {
_endpoint, _requestTimeout, _connectTimeout, 3, _sslProtocol);
if (_connection == nullptr) {
LOG(FATAL) << "out of memory"; FATAL_ERROR_EXIT();
LOG(FATAL) << "out of memory";
FATAL_ERROR_EXIT();
}
_client =
new httpclient::SimpleHttpClient(_connection, _requestTimeout, true);
if (_client == nullptr) {
LOG(FATAL) << "out of memory"; FATAL_ERROR_EXIT();
LOG(FATAL) << "out of memory";
FATAL_ERROR_EXIT();
}
_client->setLocationRewriter(this, &rewriteLocation);
@ -122,7 +124,8 @@ class BenchmarkThread : public arangodb::Thread {
delete result;
}
LOG(FATAL) << "could not connect to server"; FATAL_ERROR_EXIT();
LOG(FATAL) << "could not connect to server";
FATAL_ERROR_EXIT();
}
delete result;
@ -130,7 +133,8 @@ class BenchmarkThread : public arangodb::Thread {
// if we're the first thread, set up the test
if (_threadNumber == 0) {
if (!_operation->setUp(_client)) {
LOG(FATAL) << "could not set up the test"; FATAL_ERROR_EXIT();
LOG(FATAL) << "could not set up the test";
FATAL_ERROR_EXIT();
}
}
@ -159,13 +163,19 @@ class BenchmarkThread : public arangodb::Thread {
try {
executeBatchRequest(numOps);
} catch (arangodb::basics::Exception const& ex) {
LOG(FATAL) << "Caught exception during test execution: " << ex.code() << " " << ex.what(); FATAL_ERROR_EXIT();
LOG(FATAL) << "Caught exception during test execution: " << ex.code()
<< " " << ex.what();
FATAL_ERROR_EXIT();
} catch (std::bad_alloc const&) {
LOG(FATAL) << "Caught OOM exception during test execution!"; FATAL_ERROR_EXIT();
LOG(FATAL) << "Caught OOM exception during test execution!";
FATAL_ERROR_EXIT();
} catch (std::exception const& ex) {
LOG(FATAL) << "Caught STD exception during test execution: " << ex.what(); FATAL_ERROR_EXIT();
LOG(FATAL) << "Caught STD exception during test execution: "
<< ex.what();
FATAL_ERROR_EXIT();
} catch (...) {
LOG(FATAL) << "Caught unknown exception during test execution!"; FATAL_ERROR_EXIT();
LOG(FATAL) << "Caught unknown exception during test execution!";
FATAL_ERROR_EXIT();
}
}
_operationsCounter->done(_batchSize > 0 ? _batchSize : 1);
@ -205,7 +215,10 @@ class BenchmarkThread : public arangodb::Thread {
basics::StringBuffer batchPayload(TRI_UNKNOWN_MEM_ZONE);
int ret = batchPayload.reserve(numOperations * 1024);
if (ret != TRI_ERROR_NO_ERROR) {
LOG(FATAL) << "Failed to reserve " << numOperations * 1024 << " bytes for " << numOperations << " batch operations: " << ret; FATAL_ERROR_EXIT();
LOG(FATAL) << "Failed to reserve " << numOperations * 1024
<< " bytes for " << numOperations
<< " batch operations: " << ret;
FATAL_ERROR_EXIT();
}
for (unsigned long i = 0; i < numOperations; ++i) {
// append boundary
@ -284,10 +297,12 @@ class BenchmarkThread : public arangodb::Thread {
_warningCount++;
if (_warningCount < MaxWarnings) {
LOG(WARN) << "batch operation failed with HTTP code " << result->getHttpReturnCode() << " - " << result->getHttpReturnMessage().c_str() << " ";
LOG(WARN) << "batch operation failed with HTTP code "
<< result->getHttpReturnCode() << " - "
<< result->getHttpReturnMessage() << " ";
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(WARN) << "We tried to send this size:\n " << batchPayload.length();
LOG(WARN) << "We tried to send this:\n " << batchPayload.c_str();
LOG(WARN) << "We tried to send this:\n "
<< std::string(batchPayload.c_str(), batchPayload.length());
#endif
} else if (_warningCount == MaxWarnings) {
LOG(WARN) << "...more warnings...";
@ -307,8 +322,9 @@ class BenchmarkThread : public arangodb::Thread {
if (_verbose) {
LOG(WARN) << "Server reply: " << result->getBody().c_str();
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(WARN) << "We tried to send this size:\n " << batchPayload.length();
LOG(WARN) << "We tried to send this:\n " << batchPayload.c_str();
LOG(WARN) << "We tried to send this:\n "
<< std::string(batchPayload.c_str(),
batchPayload.length());
#endif
}
}
@ -364,7 +380,8 @@ class BenchmarkThread : public arangodb::Thread {
_warningCount++;
if (_warningCount < MaxWarnings) {
LOG(WARN) << "request for URL '" << url.c_str() << "' failed with HTTP code " << result->getHttpReturnCode();
LOG(WARN) << "request for URL '" << url << "' failed with HTTP code "
<< result->getHttpReturnCode();
} else if (_warningCount == MaxWarnings) {
LOG(WARN) << "...more warnings...";
}

View File

@ -291,14 +291,14 @@ int main(int argc, char* argv[]) {
if (BaseClient.endpointServer() == nullptr) {
std::string endpointString = BaseClient.endpointString();
LOG(FATAL) << "invalid value for --server.endpoint ('"
<< endpointString.c_str() << "')";
<< endpointString << "')";
FATAL_ERROR_EXIT();
}
BenchmarkOperation* testCase = GetTestCase(TestCase);
if (testCase == nullptr) {
LOG(FATAL) << "invalid test case name '" << TestCase.c_str() << "'";
LOG(FATAL) << "invalid test case name '" << TestCase << "'";
FATAL_ERROR_EXIT();
return EXIT_FAILURE; // will not be reached
}

View File

@ -674,7 +674,7 @@ void ImportHelper::handleResult(SimpleHttpResult* result) {
if (details.isArray()) {
for (VPackSlice const& detail : VPackArrayIterator(details)) {
if (detail.isString()) {
LOG(WARN) << "" << detail.copyString().c_str();
LOG(WARN) << "" << detail.copyString();
}
}
}

View File

@ -2344,10 +2344,10 @@ static int WarmupEnvironment(v8::Isolate* isolate,
LOG(TRACE) << "loaded JavaScript file '" << files[i] << "'";
break;
case JSLoader::eFailLoad:
LOG(FATAL) << "cannot load JavaScript file '" << files[i].c_str() << "'"; FATAL_ERROR_EXIT();
LOG(FATAL) << "cannot load JavaScript file '" << files[i] << "'"; FATAL_ERROR_EXIT();
break;
case JSLoader::eFailExecute:
LOG(FATAL) << "error during execution of JavaScript file '" << files[i].c_str() << "'"; FATAL_ERROR_EXIT();
LOG(FATAL) << "error during execution of JavaScript file '" << files[i] << "'"; FATAL_ERROR_EXIT();
break;
}
}

File diff suppressed because one or more lines are too long

View File

@ -2585,6 +2585,8 @@ div.footer-right {
padding: 5px 16px; }
.button-neutral:focus, .button-primary:focus, .button-notification:focus, .button-success:focus, .button-danger:focus, .button-warning:focus, .button-inactive:focus, .button-close:focus {
outline: none; }
.button-neutral i, .button-primary i, .button-notification i, .button-success i, .button-danger i, .button-warning i, .button-inactive i, .button-close i {
margin-left: -5px; }
.button-header {
margin-top: 5px; }
@ -2974,13 +2976,11 @@ div .tile, div .bigtile {
div .tile img:hover, div .bigtile img:hover {
cursor: pointer; }
div .tile a span.add-Icon, div .bigtile a span.add-Icon {
font-size: 22px;
font-size: 20px;
margin-left: 22px;
margin-right: 10px;
margin-top: -5px;
position: relative;
right: 4px;
top: 2px; }
top: 0; }
div .tile a span.icon, div .bigtile a span.icon {
font-size: 50px; }
div .tile a svg.icon, div .bigtile a svg.icon {
@ -5729,6 +5729,14 @@ div.headerBar {
.modal-backdrop.fade.in {
opacity: .4; }
.fade {
opacity: 0;
-moz-transition: opacity 0.03s linear;
-ms-transition: opacity 0.03s linear;
-o-transition: opacity 0.03s linear;
-webkit-transition: opacity 0.03s linear;
transition: opacity 0.03s linear; }
.modal {
border: 0 !important;
border-radius: 3px !important;
@ -6063,13 +6071,11 @@ div .tile, div .bigtile {
div .tile img:hover, div .bigtile img:hover {
cursor: pointer; }
div .tile a span.add-Icon, div .bigtile a span.add-Icon {
font-size: 22px;
font-size: 20px;
margin-left: 22px;
margin-right: 10px;
margin-top: -5px;
position: relative;
right: 4px;
top: 2px; }
top: 0; }
div .tile a span.icon, div .bigtile a span.icon {
font-size: 50px; }
div .tile a svg.icon, div .bigtile a svg.icon {

View File

@ -27139,6 +27139,7 @@ window.ArangoUsers = Backbone.Collection.extend({
known[dep[j]].children.push(nodeData);
}
}
console.log(estCost);
return estCost;
},
@ -27572,6 +27573,762 @@ window.ArangoUsers = Backbone.Collection.extend({
});
}());
/*jshint browser: true */
/*jshint unused: false */
/*global Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _, console, btoa*/
/*global _, arangoHelper, templateEngine, jQuery, Joi, d3*/
(function () {
"use strict";
window.queryView2 = Backbone.View.extend({
el: '#content',
bindParamId: '#bindParamEditor',
template: templateEngine.createTemplate("queryView2.ejs"),
table: templateEngine.createTemplate("arangoTable.ejs"),
outputDiv: '#outputEditors',
outputTemplate: templateEngine.createTemplate("queryViewOutput.ejs"),
outputCounter: 0,
currentQuery: {},
bindParamRegExp: /@(@?)(\w+(\d*))/,
bindParamTableObj: {},
bindParamTableDesc: {
id: "arangoBindParamTable",
titles: ["Key", "Value"],
rows: []
},
execPending: false,
aqlEditor: null,
paramEditor: null,
initialize: function () {
this.refreshAQL();
},
events: {
"click #executeQuery": "executeQuery",
"click #explainQuery": "explainQuery",
"click #clearQuery": "clearQuery",
'click .outputEditorWrapper #downloadQueryResult': 'downloadQueryResult',
'click .outputEditorWrapper .switchAce': 'switchAce',
"click .outputEditorWrapper .fa-close": "closeResult",
"change #arangoBindParamTable input": "updateBindParams"
},
clearQuery: function() {
this.aqlEditor.setValue('');
},
switchAce: function(e) {
var count = $(e.currentTarget).attr('counter');
if ($(e.currentTarget).text() === 'Result') {
$(e.currentTarget).text('AQL');
}
else {
$(e.currentTarget).text('Result');
}
$('#outputEditor' + count).toggle();
$('#sentQueryEditor' + count).toggle();
},
downloadQueryResult: function(e) {
var count = $(e.currentTarget).attr('counter'),
editor = ace.edit("sentQueryEditor" + count),
query = editor.getValue();
if (query !== '' || query !== undefined || query !== null) {
window.open("query/result/download/" + encodeURIComponent(btoa(JSON.stringify({ query: query }))));
}
else {
arangoHelper.arangoError("Query error", "could not query result.");
}
},
timer: {
begin: 0,
end: 0,
start: function() {
this.begin = new Date().getTime();
},
stop: function() {
this.end = new Date().getTime();
},
reset: function() {
this.begin = 0;
this.end = 0;
},
getTimeAndReset: function() {
this.stop();
var result = this.end - this.begin;
this.reset();
return result;
}
},
explainQuery: function() {
if (this.aqlEditor.getValue().length === 0) {
arangoHelper.arangoError("Query", "Your query is empty");
return;
}
this.$(this.outputDiv).prepend(this.outputTemplate.render({
counter: this.outputCounter,
type: "Explain"
}));
var counter = this.outputCounter,
outputEditor = ace.edit("outputEditor" + counter);
outputEditor.setReadOnly(true);
this.fillExplain(outputEditor, counter);
this.outputCounter++;
},
fillExplain: function(outputEditor, counter) {
var self = this,
queryData = this.readQueryData();
$('#outputEditorWrapper' + counter + ' .queryExecutionTime').text('');
this.execPending = false;
if (queryData) {
window.progressView.show(
"Explain is operating..."
);
$.ajax({
type: "POST",
url: "/_admin/aardvark/query/explain/",
data: queryData,
contentType: "application/json",
processData: false,
success: function (data) {
outputEditor.setValue(data.msg);
window.progressView.hide();
self.deselect(outputEditor);
$.noty.clearQueue();
$.noty.closeAll();
},
error: function (data) {
window.progressView.hide();
try {
var temp = JSON.parse(data.responseText);
arangoHelper.arangoError("Explain error", temp.errorNum);
}
catch (e) {
arangoHelper.arangoError("Explain error", "ERROR");
}
window.progressView.hide();
}
});
}
},
getCachedQueryAfterRender: function() {
//get cached query if available
var queryObject = this.getCachedQuery();
if (queryObject !== null && queryObject !== undefined && queryObject !== "") {
this.aqlEditor.setValue(queryObject.query);
if (queryObject.parameter !== '' || queryObject !== undefined) {
//TODO update bind param table
}
}
var a = this.aqlEditor.getValue();
if (a.length === 1 | a.length === 0) {
a = "";
}
this.setCachedQuery(a);
},
getCachedQuery: function() {
if (Storage !== "undefined") {
var cache = localStorage.getItem("cachedQuery");
if (cache !== undefined) {
var query = JSON.parse(cache);
this.currentQuery = query;
return query;
}
}
},
setCachedQuery: function(query, vars) {
if (Storage !== "undefined") {
var myObject = {
query: query,
parameter: vars
};
this.currentQuery = myObject;
localStorage.setItem("cachedQuery", JSON.stringify(myObject));
}
},
closeResult: function(e) {
var target = $("#" + $(e.currentTarget).attr('element')).parent();
$(target).hide('fast', function() {
$(target).remove();
});
},
fillSelectBoxes: function() {
// fill select box with # of results
var querySize = 1000,
sizeBox = $('#querySize');
sizeBox.empty();
[ 100, 250, 500, 1000, 2500, 5000, 10000, "all" ].forEach(function (value) {
sizeBox.append('<option value="' + _.escape(value) + '"' +
(querySize === value ? ' selected' : '') +
'>' + _.escape(value) + ' results</option>');
});
},
render: function() {
this.$el.html(this.template.render({}));
this.afterRender();
},
makeResizeable: function() {
var self = this;
var resizeFunction = function() {
self.aqlEditor.resize();
$('#arangoBindParamTable thead').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable thead th').css('width', $('#bindParamEditor').width() / 2);
$('#arangoBindParamTable tr').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody').css('height', $('#aqlEditor').height() - 18);
$('#arangoBindParamTable tbody').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody tr').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody td').css('width', $('#bindParamEditor').width() / 2);
};
$(".aqlEditorWrapper").resizable({
resize: function() {
resizeFunction();
},
handles: "e"
});
$(".inputEditorWrapper").resizable({
resize: function() {
resizeFunction();
},
handles: "s"
});
//one manual start
resizeFunction();
},
initBindParamTable: function() {
this.$(this.bindParamId).html(this.table.render({content: this.bindParamTableDesc}));
},
updateBindParams: function(e) {
var id = $(e.currentTarget).attr("name");
this.bindParamTableObj[id] = $(e.currentTarget).val();
},
checkForNewBindParams: function() {
var self = this,
words = (this.aqlEditor.getValue()).split(" "),
words1 = [],
pos = 0;
_.each(words, function(word) {
word = word.split("\n");
_.each(word, function(x) {
words1.push(x);
});
});
_.each(words1, function(word) {
// remove newlines and whitespaces
words[pos] = word.replace(/(\r\n|\n|\r)/gm,"");
pos++;
});
words1.sort();
var newObject = {};
_.each(words1, function(word) {
//found a valid bind param expression
if (self.bindParamRegExp.test(word)) {
//if property is not available
newObject[word] = '';
}
});
Object.keys(newObject).forEach(function(keyNew) {
Object.keys(self.bindParamTableObj).forEach(function(keyOld) {
if (keyNew === keyOld) {
newObject[keyNew] = self.bindParamTableObj[keyOld];
}
});
});
self.bindParamTableObj = newObject;
},
renderBindParamTable: function() {
var self = this;
$('#arangoBindParamTable tbody').html('');
var counter = 0;
_.each(this.bindParamTableObj, function(val, key) {
$('#arangoBindParamTable tbody').append(
"<tr>" +
"<td>" + key + "</td>" +
'<td><input name=' + key + ' type="text"></input></td>' +
"</tr>"
);
counter ++;
_.each($('#arangoBindParamTable input'), function(element) {
if ($(element).attr('name') === key) {
$(element).val(val);
}
});
});
if (counter === 0) {
$('#arangoBindParamTable tbody').append(
'<tr class="noBgColor">' +
"<td>No bind parameters defined.</td>" +
'<td></td>' +
"</tr>"
);
}
},
initAce: function() {
var self = this;
//init aql editor
this.aqlEditor = ace.edit("aqlEditor");
this.aqlEditor.getSession().setMode("ace/mode/aql");
this.aqlEditor.setFontSize("13px");
this.aqlEditor.getSession().on('change', function() {
self.checkForNewBindParams();
self.renderBindParamTable();
});
this.aqlEditor.commands.addCommand({
name: "togglecomment",
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
exec: function (editor) {
editor.toggleCommentLines();
},
multiSelectAction: "forEach"
});
//auto focus this editor
$('#aqlEditor .ace_text-input').focus();
},
afterRender: function() {
this.initAce();
this.initBindParamTable();
this.getCachedQueryAfterRender();
this.fillSelectBoxes();
this.makeResizeable();
//set height of editor wrapper
$('.inputEditorWrapper').height($(window).height() / 10 * 3);
},
saveAQL: function (e) {
e.stopPropagation();
//update queries first, before writing
this.refreshAQL();
var varsEditor = ace.edit("varsEditor"),
saveName = $('#new-query-name').val(),
bindVars = varsEditor.getValue();
if ($('#new-query-name').hasClass('invalid-input')) {
return;
}
//Heiko: Form-Validator - illegal query name
if (saveName.trim() === '') {
return;
}
var content = this.aqlEditor.getValue(),
//check for already existing entry
quit = false;
$.each(this.customQueries, function (k, v) {
if (v.name === saveName) {
v.value = content;
quit = true;
return;
}
});
if (quit === true) {
//Heiko: Form-Validator - name already taken
// Update model and save
this.collection.findWhere({name: saveName}).set("value", content);
}
else {
if (bindVars === '' || bindVars === undefined) {
bindVars = '{}';
}
if (typeof bindVars === 'string') {
try {
bindVars = JSON.parse(bindVars);
}
catch (err) {
arangoHelper.arangoError("Query", "Could not parse bind parameter");
}
}
this.collection.add({
name: saveName,
parameter: bindVars,
value: content
});
}
var callback = function(error) {
if (error) {
arangoHelper.arangoError("Query", "Could not save query");
}
else {
var self = this;
this.collection.fetch({
success: function() {
self.updateLocalQueries();
self.renderSelectboxes();
$('#querySelect').val(saveName);
}
});
}
}.bind(this);
this.collection.saveCollectionQueries(callback);
window.modalView.hide();
},
executeQuery: function () {
if (this.aqlEditor.getValue().length === 0) {
arangoHelper.arangoError("Query", "Your query is empty");
return;
}
this.$(this.outputDiv).prepend(this.outputTemplate.render({
counter: this.outputCounter,
type: "Query"
}));
$('#outputEditorWrapper' + this.outputCounter).hide();
$('#outputEditorWrapper' + this.outputCounter).show('fast');
var counter = this.outputCounter,
outputEditor = ace.edit("outputEditor" + counter),
sentQueryEditor = ace.edit("sentQueryEditor" + counter);
outputEditor.setReadOnly(true);
sentQueryEditor.setReadOnly(true);
this.fillResult(outputEditor, sentQueryEditor, counter);
this.outputCounter++;
},
readQueryData: function() {
var selectedText = this.aqlEditor.session.getTextRange(this.aqlEditor.getSelectionRange());
var sizeBox = $('#querySize');
var data = {
query: selectedText || this.aqlEditor.getValue(),
id: "currentFrontendQuery"
};
if (sizeBox.val() !== 'all') {
data.batchSize = parseInt(sizeBox.val(), 10);
}
//parse vars
//var bindVars = varsEditor.getValue();
//TODO bind vars table include
var bindVars = "";
if (bindVars.length > 0) {
try {
var params = JSON.parse(bindVars);
if (Object.keys(params).length !== 0) {
data.bindVars = params;
}
}
catch (e) {
arangoHelper.arangoError("Query error", "Could not parse bind parameters.");
return false;
}
}
return JSON.stringify(data);
},
fillResult: function(outputEditor, sentQueryEditor, counter) {
var self = this;
var queryData = this.readQueryData();
if (queryData) {
sentQueryEditor.setValue(self.aqlEditor.getValue());
$.ajax({
type: "POST",
url: "/_api/cursor",
headers: {
'x-arango-async': 'store'
},
data: queryData,
contentType: "application/json",
processData: false,
success: function (data, textStatus, xhr) {
if (xhr.getResponseHeader('x-arango-async-id')) {
self.queryCallbackFunction(xhr.getResponseHeader('x-arango-async-id'), outputEditor, counter);
}
$.noty.clearQueue();
$.noty.closeAll();
},
error: function (data) {
try {
var temp = JSON.parse(data.responseText);
outputEditor.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
}
catch (e) {
outputEditor.setValue('ERROR');
arangoHelper.arangoError("Query error", "ERROR");
}
window.progressView.hide();
}
});
}
},
setEditorAutoHeight: function (editor) {
editor.setOptions({
maxLines: Infinity
});
},
deselect: function (editor) {
var current = editor.getSelection();
var currentRow = current.lead.row;
var currentColumn = current.lead.column;
current.setSelectionRange({
start: {
row: currentRow,
column: currentColumn
},
end: {
row: currentRow,
column: currentColumn
}
});
editor.focus();
},
queryCallbackFunction: function(queryID, outputEditor, counter) {
var self = this;
var cancelRunningQuery = function() {
$.ajax({
url: '/_api/job/'+ encodeURIComponent(queryID) + "/cancel",
type: 'PUT',
success: function() {
window.clearTimeout(self.checkQueryTimer);
arangoHelper.arangoNotification("Query", "Query canceled.");
window.progressView.hide();
}
});
};
window.progressView.show(
"Query is operating...",
cancelRunningQuery,
"Cancel Query"
);
self.timer.start();
this.execPending = false;
var warningsFunc = function(data) {
var warnings = "";
if (data.extra && data.extra.warnings && data.extra.warnings.length > 0) {
warnings += "Warnings:" + "\r\n\r\n";
data.extra.warnings.forEach(function(w) {
warnings += "[" + w.code + "], '" + w.message + "'\r\n";
});
}
if (warnings !== "") {
warnings += "\r\n" + "Result:" + "\r\n\r\n";
}
outputEditor.setValue(warnings + JSON.stringify(data.result, undefined, 2));
};
var fetchQueryResult = function(data) {
warningsFunc(data);
window.progressView.hide();
var time = self.timer.getTimeAndReset()/1000 + " s";
$('#outputEditorWrapper' + counter + ' .queryExecutionTime2').text(time);
self.setEditorAutoHeight(outputEditor);
self.deselect(outputEditor);
};
//check if async query is finished
var checkQueryStatus = function() {
$.ajax({
type: "PUT",
url: "/_api/job/" + encodeURIComponent(queryID),
contentType: "application/json",
processData: false,
success: function (data, textStatus, xhr) {
//query finished, now fetch results
if (xhr.status === 201) {
fetchQueryResult(data);
}
//query not ready yet, retry
else if (xhr.status === 204) {
self.checkQueryTimer = window.setTimeout(function() {
checkQueryStatus();
}, 500);
}
},
error: function (resp) {
try {
var error = JSON.parse(resp.responseText);
if (error.errorMessage) {
arangoHelper.arangoError("Query", error.errorMessage);
$('#outputEditorWrapper' + counter).hide();
}
}
catch (e) {
arangoHelper.arangoError("Query", "Something went wrong.");
}
window.progressView.hide();
}
});
};
checkQueryStatus();
},
refreshAQL: function() {
var self = this;
var callback = function(error) {
if (error) {
arangoHelper.arangoError('Query', 'Could not reload Queries');
}
else {
self.updateLocalQueries();
}
}.bind(self);
var originCallback = function() {
self.getSystemQueries(callback);
}.bind(self);
this.getAQL(originCallback);
},
getSystemQueries: function (callback) {
var self = this;
$.ajax({
type: "GET",
cache: false,
url: "js/arango/aqltemplates.json",
contentType: "application/json",
processData: false,
success: function (data) {
if (callback) {
callback(false);
}
self.queries = data;
},
error: function () {
if (callback) {
callback(true);
}
arangoHelper.arangoNotification("Query", "Error while loading system templates");
}
});
},
updateLocalQueries: function () {
var self = this;
this.customQueries = [];
this.collection.each(function(model) {
self.customQueries.push({
name: model.get("name"),
value: model.get("value"),
parameter: model.get("parameter")
});
});
},
getAQL: function (originCallback) {
var self = this, result;
this.collection.fetch({
success: function() {
//old storage method
var item = localStorage.getItem("customQueries");
if (item) {
var queries = JSON.parse(item);
//save queries in user collections extra attribute
_.each(queries, function(oldQuery) {
self.collection.add({
value: oldQuery.value,
name: oldQuery.name
});
});
var callback = function(error, data) {
if (error) {
arangoHelper.arangoError(
"Custom Queries",
"Could not import old local storage queries"
);
}
else {
localStorage.removeItem("customQueries");
}
}.bind(self);
self.collection.saveCollectionQueries(callback);
}
self.updateLocalQueries();
if (originCallback) {
originCallback();
}
}
});
}
});
}());
/*jshint browser: true, evil: true */
/*jshint unused: false */
/*global Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
@ -29402,6 +30159,7 @@ window.ArangoUsers = Backbone.Collection.extend({
"collection/:colid/:docid": "document",
"shell": "shell",
"query": "query",
"query2": "query2",
"queryManagement": "queryManagement",
"workMonitor": "workMonitor",
"databases": "databases",
@ -29678,6 +30436,20 @@ window.ArangoUsers = Backbone.Collection.extend({
}
this.queryView.render();
},
query2: function (initialized) {
this.checkUser();
if (!initialized) {
this.waitForInit(this.query2.bind(this));
return;
}
if (!this.queryView2) {
this.queryView2 = new window.queryView2({
collection: this.queryCollection
});
}
this.queryView2.render();
},
test: function (initialized) {
this.checkUser();

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
<script src="sharedLibs.js?version=1456250172555"></script>
<script src="libs.js?version=1456250172555"></script>
<script src="app.js?version=1456250172555"></script>
<script src="sharedLibs.js?version=1456340072524"></script>
<script src="libs.js?version=1456340072524"></script>
<script src="app.js?version=1456340072524"></script>

View File

@ -210,7 +210,8 @@
<div id="installedList" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="addApp" class="add"><span class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Service</a>
<a href="#" id="addApp" class="add"><span class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Service</a>
</div>
</div>
</div>
@ -403,7 +404,8 @@
<div id="collectionsThumbnailsIn" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Collection</a>
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Collection</a>
</div>
</div>
</div>
@ -668,7 +670,7 @@
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createDatabase" class="add">
<span id="newDatabase" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newDatabase" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Database
</a>
</div>
@ -1128,7 +1130,7 @@ if (list.length > 0) {
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createGraph" class="add">
<span id="newGraph" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newGraph" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Graph
</a>
</div>
@ -2519,6 +2521,74 @@ if (list.length > 0) {
<button id="closeQueryModal" class="button-close">Cancel</button>
</div>
</div></script><script id="queryView2.ejs" type="text/template"><div class="headerBar">
<a class="arangoHeader">AQL Editor 2</a>
</div>
<div id="queryContent" class="queryContent">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<button class="button-success"><i class="fa fa-star"></i>Queries</button>
<button class="button-success"><i class="fa fa-save"></i>Save</button>
</div>
<div class="pull-right">
<div class="styled-select">
<select id="querySize" class="query-size"/>
</div>
</div>
</div>
<div class="inputEditorWrapper">
<div class="aqlEditorWrapper" class="arangoEditor">
<div id="aqlEditor"></div>
</div>
<div class="bindParamEditorWrapper" class="arangoEditor">
<div id="bindParamEditor"></div>
</div>
</div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<button id="executeQuery" class="button-success query-button">Execute</button>
<button id="explainQuery" class="button-success query-button">Explain</button>
<button id="clearQuery" class="button-close query-button">Clear</button>
</div>
</div>
</div>
<div id="outputEditors" class="outputEditors">
</div></script><script id="queryViewOutput.ejs" type="text/template"><div id="outputEditorWrapper<%= counter %>" class="outputEditorWrapper">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<span class="toolbarType"><%=type%></span>
<% if (type === 'Query') { %>
<span><i class="fa fa-clock-o"></i><i class="queryExecutionTime2"></i></span>
<% } %>
</div>
<div class="pull-right">
<span><i class="fa fa-close" element="outputEditor<%= counter %>"></i></span>
</div>
<div class="pull-right">
<% if (type === 'Query') { %>
<span class="switchAce" counter="<%=counter%>">Result</span>
<% } else { %>
<span class="SwitchAce" counter="<%=counter%>">AQL</span>
<% } %>
</div>
</div>
<div id="outputEditor<%= counter %>"></div>
<div id="sentQueryEditor<%= counter %>" style="display: none"></div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<% if (type === 'Query') { %>
<button id="downloadQueryResult" counter="<%=counter%>" class="button-success">Download</button>
<% } %>
</div>
</div>
</div></script><script id="shellView.ejs" type="text/template"><div class="headerBar">
<a class="arangoHeader">JS Shell</a>
</div>
@ -2684,7 +2754,7 @@ var cutByResolution = function (str) {
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createUser" class="add">
<span id="newUser" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newUser" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add User
</a>
</div>
@ -2751,4 +2821,4 @@ var cutByResolution = function (str) {
</div>
<div id="workMonitorContent" class="innerContent">
</div></script></head><body><nav class="navbar"><div class="resizecontainer"><div class="navlogo"><a class="logo" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a></div><div id="progressPlaceholderIcon"></div><div class="statmenu" id="statisticBar"></div><div class="usermenu" id="userBar" style="float:right"></div><div class="notificationmenu" id="notificationBar" style="float:right"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="centralRow resizecontainer"><div id="content" class="centralContent"></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><footer class="footer"><div class="resizecontainer" id="footerBar"></div></footer><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="sharedLibs.js?version=1456250172555"></script><script src="libs.js?version=1456250172555"></script><script src="app.js?version=1456250172555"></script></body></html>
</div></script></head><body><nav class="navbar"><div class="resizecontainer"><div class="navlogo"><a class="logo" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a></div><div id="progressPlaceholderIcon"></div><div class="statmenu" id="statisticBar"></div><div class="usermenu" id="userBar" style="float:right"></div><div class="notificationmenu" id="notificationBar" style="float:right"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="centralRow resizecontainer"><div id="content" class="centralContent"></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><footer class="footer"><div class="resizecontainer" id="footerBar"></div></footer><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="sharedLibs.js?version=1456340072524"></script><script src="libs.js?version=1456340072524"></script><script src="app.js?version=1456340072524"></script></body></html>

View File

@ -234,7 +234,8 @@
<div id="installedList" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="addApp" class="add"><span class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Service</a>
<a href="#" id="addApp" class="add"><span class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Service</a>
</div>
</div>
</div>
@ -443,7 +444,8 @@
<div id="collectionsThumbnailsIn" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Collection</a>
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Collection</a>
</div>
</div>
</div>
@ -718,7 +720,7 @@
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createDatabase" class="add">
<span id="newDatabase" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newDatabase" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Database
</a>
</div>
@ -1221,7 +1223,7 @@ if (list.length > 0) {
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createGraph" class="add">
<span id="newGraph" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newGraph" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Graph
</a>
</div>
@ -2708,6 +2710,86 @@ if (list.length > 0) {
</script>
<script id="queryView2.ejs" type="text/template">
<div class="headerBar">
<a class="arangoHeader">AQL Editor 2</a>
</div>
<div id="queryContent" class="queryContent">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<button class="button-success"><i class="fa fa-star"></i>Queries</button>
<button class="button-success"><i class="fa fa-save"></i>Save</button>
</div>
<div class="pull-right">
<div class="styled-select">
<select id="querySize" class="query-size"/>
</div>
</div>
</div>
<div class="inputEditorWrapper">
<div class="aqlEditorWrapper" class="arangoEditor">
<div id="aqlEditor"></div>
</div>
<div class="bindParamEditorWrapper" class="arangoEditor">
<div id="bindParamEditor"></div>
</div>
</div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<button id="executeQuery" class="button-success query-button">Execute</button>
<button id="explainQuery" class="button-success query-button">Explain</button>
<button id="clearQuery" class="button-close query-button">Clear</button>
</div>
</div>
</div>
<div id="outputEditors" class="outputEditors">
</div>
</script>
<script id="queryViewOutput.ejs" type="text/template">
<div id="outputEditorWrapper<%= counter %>" class="outputEditorWrapper">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<span class="toolbarType"><%=type%></span>
<% if (type === 'Query') { %>
<span><i class="fa fa-clock-o"></i><i class="queryExecutionTime2"></i></span>
<% } %>
</div>
<div class="pull-right">
<span><i class="fa fa-close" element="outputEditor<%= counter %>"></i></span>
</div>
<div class="pull-right">
<% if (type === 'Query') { %>
<span class="switchAce" counter="<%=counter%>">Result</span>
<% } else { %>
<span class="SwitchAce" counter="<%=counter%>">AQL</span>
<% } %>
</div>
</div>
<div id="outputEditor<%= counter %>"></div>
<div id="sentQueryEditor<%= counter %>" style="display: none"></div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<% if (type === 'Query') { %>
<button id="downloadQueryResult" counter="<%=counter%>" class="button-success">Download</button>
<% } %>
</div>
</div>
</div>
</script>
<script id="shellView.ejs" type="text/template">
<div class="headerBar">
<a class="arangoHeader">JS Shell</a>
@ -2895,7 +2977,7 @@ var cutByResolution = function (str) {
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createUser" class="add">
<span id="newUser" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newUser" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add User
</a>
</div>
@ -3015,9 +3097,9 @@ var cutByResolution = function (str) {
</div>
</div>
<script src="sharedLibs.js?version=1456250172555"></script>
<script src="libs.js?version=1456250172555"></script>
<script src="app.js?version=1456250172555"></script>
<script src="sharedLibs.js?version=1456340072524"></script>
<script src="libs.js?version=1456340072524"></script>
<script src="app.js?version=1456340072524"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -2203,7 +2203,7 @@ div.queryline .fa.fa-search:hover {
.navbar .arango-collection-select, div.queryline select,
div.queryline input, input.search-input, .modal-body .select2-choices input, .modal-body input,
.modal-body select,
.modal-body textarea, .login-window .login-input {
.modal-body textarea, .login-window .login-input, .inputEditorWrapper .bindParamEditorWrapper table td input {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
@ -2216,7 +2216,7 @@ div.queryline input, input.search-input, .modal-body .select2-choices input, .mo
.navbar .arango-collection-select:focus, div.queryline select:focus,
div.queryline input:focus, input.search-input:focus, .modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus, .login-window .login-input:focus {
.modal-body textarea:focus, .login-window .login-input:focus, .inputEditorWrapper .bindParamEditorWrapper table td input:focus {
border-color: #999;
box-shadow: none;
outline: none;
@ -2575,6 +2575,8 @@ div.footer-right {
padding: 5px 16px; }
.button-neutral:focus, .button-primary:focus, .button-notification:focus, .button-success:focus, .button-danger:focus, .button-warning:focus, .button-inactive:focus, .button-close:focus, .ajax-file-upload-red:focus, .ajax-file-upload:focus {
outline: none; }
.button-neutral i, .button-primary i, .button-notification i, .button-success i, .button-danger i, .button-warning i, .button-inactive i, .button-close i, .ajax-file-upload-red i, .ajax-file-upload i {
margin-left: -5px; }
.button-header {
margin-top: 5px; }
@ -2964,13 +2966,11 @@ div .tile, div .bigtile {
div .tile img:hover, div .bigtile img:hover {
cursor: pointer; }
div .tile a span.add-Icon, div .bigtile a span.add-Icon {
font-size: 22px;
font-size: 20px;
margin-left: 22px;
margin-right: 10px;
margin-top: -5px;
position: relative;
right: 4px;
top: 2px; }
top: 0; }
div .tile a span.icon, div .bigtile a span.icon {
font-size: 50px; }
div .tile a svg.icon, div .bigtile a svg.icon {
@ -5719,6 +5719,14 @@ div.headerBar {
.modal-backdrop.fade.in {
opacity: .4; }
.fade {
opacity: 0;
-moz-transition: opacity 0.03s linear;
-ms-transition: opacity 0.03s linear;
-o-transition: opacity 0.03s linear;
-webkit-transition: opacity 0.03s linear;
transition: opacity 0.03s linear; }
.modal {
border: 0 !important;
border-radius: 3px !important;
@ -6033,6 +6041,52 @@ div.headerBar {
.tooltipInfoTh {
width: 10%; }
.arangoToolbar span {
padding: 1px 4px 3px;
position: relative;
top: 4px; }
.arangoToolbar {
background-color: #fff;
border: 1px solid rgba(140, 138, 137, 0.25);
height: 40px;
width: 100%; }
.arangoToolbar .pull-right,
.arangoToolbar .pull-left {
height: 30px;
margin-top: 5px; }
.arangoToolbar .pull-left button {
margin-left: 5px; }
.arangoToolbar .pull-right select:first-child,
.arangoToolbar .pull-right button:first-child {
margin-right: 5px; }
.arangoToolbar span {
font-weight: 100;
margin-left: 10px; }
.arangoToolbar i {
font-style: normal; }
.arangoToolbar i.fa {
margin-right: 5px; }
.arangoToolbar i.fa-close {
color: #666;
cursor: pointer; }
.arangoToolbar i.fa-close:hover {
color: #000; }
.arangoToolbar .toolbarType {
background: #5bc0de;
border-radius: 3px;
color: #fff; }
.arangoToolbar .styled-select {
width: auto; }
.arangoToolbarTop {
border-top-left-radius: 3px;
border-top-right-radius: 3px; }
.arangoToolbarBottom {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px; }
.dbselection {
float: left;
margin-right: 3px;
@ -6712,6 +6766,93 @@ toolbar {
position: relative;
top: -1px; }
.inputEditorWrapper {
border-bottom: 3px solid rgba(140, 138, 137, 0.25) !important;
border-left: 1px solid rgba(140, 138, 137, 0.25);
border-right: 1px solid rgba(140, 138, 137, 0.25);
clear: both;
height: 300px;
min-height: 300px;
width: 100%; }
.inputEditorWrapper .aqlEditorWrapper {
background: #f6f6f6;
border: 0 !important;
border-right: 3px solid rgba(140, 138, 137, 0.25) !important;
float: left;
height: 100% !important;
max-width: 85%;
min-width: 20%;
width: 70%; }
.inputEditorWrapper .bindParamEditorWrapper {
background: #eee;
overflow: hidden; }
.inputEditorWrapper .bindParamEditorWrapper table {
border-top: 0;
font: 13px/normal Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace; }
.inputEditorWrapper .bindParamEditorWrapper table tbody {
display: block;
overflow-y: auto; }
.inputEditorWrapper .bindParamEditorWrapper table tr.noBgColor {
background-color: transparent !important; }
.inputEditorWrapper .bindParamEditorWrapper table thead {
display: block; }
.inputEditorWrapper .bindParamEditorWrapper table td {
padding: 0 5px;
width: 50%; }
.inputEditorWrapper .bindParamEditorWrapper table td input {
clear: both;
float: right;
font: 13px/normal Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace !important;
height: 17px;
margin-bottom: 3px;
margin-top: 3px;
width: auto !important; }
.inputEditorWrapper .bindParamEditorWrapper table th {
font: 13px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
height: 17px;
padding: 0;
width: 50%; }
.inputEditorWrapper .aqlEditorWrapper,
.inputEditorWrapper .bindParamEditorWrapper {
height: 100%; }
.inputEditorWrapper .aqlEditorWrapper div,
.inputEditorWrapper .bindParamEditorWrapper div {
height: 100%; }
.inputEditorWrapper .ui-resizable-s {
cursor: ns-resize; }
.inputEditorWrapper .ui-resizable-e {
cursor: ew-resize; }
.queryContent {
clear: both;
margin-top: 0;
width: 100%; }
.outputEditors {
margin-bottom: 60px; }
.outputEditorWrapper {
clear: both;
height: 100px;
padding-top: 20px;
width: 100%; }
.outputEditorWrapper .switchAce {
background-color: rgba(0, 0, 0, 0.6);
border-radius: 3px;
color: #fff;
cursor: pointer;
position: relative;
right: -27px;
top: 45px;
z-index: 10; }
.outputEditorWrapper .ace_editor {
border-left: 1px solid rgba(140, 138, 137, 0.25);
border-right: 1px solid rgba(140, 138, 137, 0.25);
height: 280px;
width: 100%; }
.outputEditorWrapper .ace_editor .ace_active-line {
background: #fff !important; }
.display-none {
display: none; }

View File

@ -16,6 +16,7 @@
"collection/:colid/:docid": "document",
"shell": "shell",
"query": "query",
"query2": "query2",
"queryManagement": "queryManagement",
"workMonitor": "workMonitor",
"databases": "databases",
@ -292,6 +293,20 @@
}
this.queryView.render();
},
query2: function (initialized) {
this.checkUser();
if (!initialized) {
this.waitForInit(this.query2.bind(this));
return;
}
if (!this.queryView2) {
this.queryView2 = new window.queryView2({
collection: this.queryCollection
});
}
this.queryView2.render();
},
test: function (initialized) {
this.checkUser();

View File

@ -48,7 +48,8 @@
<div id="installedList" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="addApp" class="add"><span class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Service</a>
<a href="#" id="addApp" class="add"><span class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Service</a>
</div>
</div>
</div>

View File

@ -109,7 +109,8 @@
<div id="collectionsThumbnailsIn" class="tileList">
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left icon_arangodb_roundplus arangoicon add-Icon" /> Add Collection</a>
<a href="#" id="createCollection" class="add"><span id="newCollection" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i>
</span> Add Collection</a>
</div>
</div>
</div>

View File

@ -44,7 +44,7 @@
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createDatabase" class="add">
<span id="newDatabase" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newDatabase" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Database
</a>
</div>

View File

@ -43,7 +43,7 @@
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createGraph" class="add">
<span id="newGraph" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newGraph" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add Graph
</a>
</div>

View File

@ -0,0 +1,79 @@
<script id="queryView2.ejs" type="text/template">
<div class="headerBar">
<a class="arangoHeader">AQL Editor 2</a>
</div>
<div id="queryContent" class="queryContent">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<button class="button-success"><i class="fa fa-star"></i>Queries</button>
<button class="button-success"><i class="fa fa-save"></i>Save</button>
</div>
<div class="pull-right">
<div class="styled-select">
<select id="querySize" class="query-size"/>
</div>
</div>
</div>
<div class="inputEditorWrapper">
<div class="aqlEditorWrapper" class="arangoEditor">
<div id="aqlEditor"></div>
</div>
<div class="bindParamEditorWrapper" class="arangoEditor">
<div id="bindParamEditor"></div>
</div>
</div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<button id="executeQuery" class="button-success query-button">Execute</button>
<button id="explainQuery" class="button-success query-button">Explain</button>
<button id="clearQuery" class="button-close query-button">Clear</button>
</div>
</div>
</div>
<div id="outputEditors" class="outputEditors">
</div>
</script>
<script id="queryViewOutput.ejs" type="text/template">
<div id="outputEditorWrapper<%= counter %>" class="outputEditorWrapper">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
<span class="toolbarType"><%=type%></span>
<% if (type === 'Query') { %>
<span><i class="fa fa-clock-o"></i><i class="queryExecutionTime2"></i></span>
<% } %>
</div>
<div class="pull-right">
<span><i class="fa fa-close" element="outputEditor<%= counter %>"></i></span>
</div>
<div class="pull-right">
<% if (type === 'Query') { %>
<span class="switchAce" counter="<%=counter%>">Result</span>
<% } else { %>
<span class="SwitchAce" counter="<%=counter%>">AQL</span>
<% } %>
</div>
</div>
<div id="outputEditor<%= counter %>"></div>
<div id="sentQueryEditor<%= counter %>" style="display: none"></div>
<div class="arangoToolbar arangoToolbarBottom">
<div class="pull-right">
<% if (type === 'Query') { %>
<button id="downloadQueryResult" counter="<%=counter%>" class="button-success">Download</button>
<% } %>
</div>
</div>
</div>
</script>

View File

@ -59,7 +59,7 @@
<div class="tile">
<div class="fullBorderBox">
<a href="#" id="createUser" class="add">
<span id="newUser" class="pull-left icon_arangodb_roundplus arangoicon add-Icon"/>
<span id="newUser" class="pull-left add-Icon"><i class="fa fa-plus-circle"></i></span>
Add User
</a>
</div>

View File

@ -800,6 +800,7 @@
known[dep[j]].children.push(nodeData);
}
}
console.log(estCost);
return estCost;
},

View File

@ -0,0 +1,755 @@
/*jshint browser: true */
/*jshint unused: false */
/*global Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _, console, btoa*/
/*global _, arangoHelper, templateEngine, jQuery, Joi, d3*/
(function () {
"use strict";
window.queryView2 = Backbone.View.extend({
el: '#content',
bindParamId: '#bindParamEditor',
template: templateEngine.createTemplate("queryView2.ejs"),
table: templateEngine.createTemplate("arangoTable.ejs"),
outputDiv: '#outputEditors',
outputTemplate: templateEngine.createTemplate("queryViewOutput.ejs"),
outputCounter: 0,
currentQuery: {},
bindParamRegExp: /@(@?)(\w+(\d*))/,
bindParamTableObj: {},
bindParamTableDesc: {
id: "arangoBindParamTable",
titles: ["Key", "Value"],
rows: []
},
execPending: false,
aqlEditor: null,
paramEditor: null,
initialize: function () {
this.refreshAQL();
},
events: {
"click #executeQuery": "executeQuery",
"click #explainQuery": "explainQuery",
"click #clearQuery": "clearQuery",
'click .outputEditorWrapper #downloadQueryResult': 'downloadQueryResult',
'click .outputEditorWrapper .switchAce': 'switchAce',
"click .outputEditorWrapper .fa-close": "closeResult",
"change #arangoBindParamTable input": "updateBindParams"
},
clearQuery: function() {
this.aqlEditor.setValue('');
},
switchAce: function(e) {
var count = $(e.currentTarget).attr('counter');
if ($(e.currentTarget).text() === 'Result') {
$(e.currentTarget).text('AQL');
}
else {
$(e.currentTarget).text('Result');
}
$('#outputEditor' + count).toggle();
$('#sentQueryEditor' + count).toggle();
},
downloadQueryResult: function(e) {
var count = $(e.currentTarget).attr('counter'),
editor = ace.edit("sentQueryEditor" + count),
query = editor.getValue();
if (query !== '' || query !== undefined || query !== null) {
window.open("query/result/download/" + encodeURIComponent(btoa(JSON.stringify({ query: query }))));
}
else {
arangoHelper.arangoError("Query error", "could not query result.");
}
},
timer: {
begin: 0,
end: 0,
start: function() {
this.begin = new Date().getTime();
},
stop: function() {
this.end = new Date().getTime();
},
reset: function() {
this.begin = 0;
this.end = 0;
},
getTimeAndReset: function() {
this.stop();
var result = this.end - this.begin;
this.reset();
return result;
}
},
explainQuery: function() {
if (this.aqlEditor.getValue().length === 0) {
arangoHelper.arangoError("Query", "Your query is empty");
return;
}
this.$(this.outputDiv).prepend(this.outputTemplate.render({
counter: this.outputCounter,
type: "Explain"
}));
var counter = this.outputCounter,
outputEditor = ace.edit("outputEditor" + counter);
outputEditor.setReadOnly(true);
this.fillExplain(outputEditor, counter);
this.outputCounter++;
},
fillExplain: function(outputEditor, counter) {
var self = this,
queryData = this.readQueryData();
$('#outputEditorWrapper' + counter + ' .queryExecutionTime').text('');
this.execPending = false;
if (queryData) {
window.progressView.show(
"Explain is operating..."
);
$.ajax({
type: "POST",
url: "/_admin/aardvark/query/explain/",
data: queryData,
contentType: "application/json",
processData: false,
success: function (data) {
outputEditor.setValue(data.msg);
window.progressView.hide();
self.deselect(outputEditor);
$.noty.clearQueue();
$.noty.closeAll();
},
error: function (data) {
window.progressView.hide();
try {
var temp = JSON.parse(data.responseText);
arangoHelper.arangoError("Explain error", temp.errorNum);
}
catch (e) {
arangoHelper.arangoError("Explain error", "ERROR");
}
window.progressView.hide();
}
});
}
},
getCachedQueryAfterRender: function() {
//get cached query if available
var queryObject = this.getCachedQuery();
if (queryObject !== null && queryObject !== undefined && queryObject !== "") {
this.aqlEditor.setValue(queryObject.query);
//if (queryObject.parameter !== '' || queryObject !== undefined) {
//TODO update bind param table
//}
}
var a = this.aqlEditor.getValue();
if (a.length <= 1) {
a = "";
}
this.setCachedQuery(a);
},
getCachedQuery: function() {
if (Storage !== "undefined") {
var cache = localStorage.getItem("cachedQuery");
if (cache !== undefined) {
var query = JSON.parse(cache);
this.currentQuery = query;
return query;
}
}
},
setCachedQuery: function(query, vars) {
if (Storage !== "undefined") {
var myObject = {
query: query,
parameter: vars
};
this.currentQuery = myObject;
localStorage.setItem("cachedQuery", JSON.stringify(myObject));
}
},
closeResult: function(e) {
var target = $("#" + $(e.currentTarget).attr('element')).parent();
$(target).hide('fast', function() {
$(target).remove();
});
},
fillSelectBoxes: function() {
// fill select box with # of results
var querySize = 1000,
sizeBox = $('#querySize');
sizeBox.empty();
[ 100, 250, 500, 1000, 2500, 5000, 10000, "all" ].forEach(function (value) {
sizeBox.append('<option value="' + _.escape(value) + '"' +
(querySize === value ? ' selected' : '') +
'>' + _.escape(value) + ' results</option>');
});
},
render: function() {
this.$el.html(this.template.render({}));
this.afterRender();
},
makeResizeable: function() {
var self = this;
var resizeFunction = function() {
self.aqlEditor.resize();
$('#arangoBindParamTable thead').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable thead th').css('width', $('#bindParamEditor').width() / 2);
$('#arangoBindParamTable tr').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody').css('height', $('#aqlEditor').height() - 18);
$('#arangoBindParamTable tbody').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody tr').css('width', $('#bindParamEditor').width());
$('#arangoBindParamTable tbody td').css('width', $('#bindParamEditor').width() / 2);
};
$(".aqlEditorWrapper").resizable({
resize: function() {
resizeFunction();
},
handles: "e"
});
$(".inputEditorWrapper").resizable({
resize: function() {
resizeFunction();
},
handles: "s"
});
//one manual start
resizeFunction();
},
initBindParamTable: function() {
this.$(this.bindParamId).html(this.table.render({content: this.bindParamTableDesc}));
},
updateBindParams: function(e) {
var id = $(e.currentTarget).attr("name");
this.bindParamTableObj[id] = $(e.currentTarget).val();
},
checkForNewBindParams: function() {
var self = this,
words = (this.aqlEditor.getValue()).split(" "),
words1 = [],
pos = 0;
_.each(words, function(word) {
word = word.split("\n");
_.each(word, function(x) {
words1.push(x);
});
});
_.each(words1, function(word) {
// remove newlines and whitespaces
words[pos] = word.replace(/(\r\n|\n|\r)/gm,"");
pos++;
});
words1.sort();
var newObject = {};
_.each(words1, function(word) {
//found a valid bind param expression
if (self.bindParamRegExp.test(word)) {
//if property is not available
newObject[word] = '';
}
});
Object.keys(newObject).forEach(function(keyNew) {
Object.keys(self.bindParamTableObj).forEach(function(keyOld) {
if (keyNew === keyOld) {
newObject[keyNew] = self.bindParamTableObj[keyOld];
}
});
});
self.bindParamTableObj = newObject;
},
renderBindParamTable: function() {
var self = this;
$('#arangoBindParamTable tbody').html('');
var counter = 0;
_.each(this.bindParamTableObj, function(val, key) {
$('#arangoBindParamTable tbody').append(
"<tr>" +
"<td>" + key + "</td>" +
'<td><input name=' + key + ' type="text"></input></td>' +
"</tr>"
);
counter ++;
_.each($('#arangoBindParamTable input'), function(element) {
if ($(element).attr('name') === key) {
$(element).val(val);
}
});
});
if (counter === 0) {
$('#arangoBindParamTable tbody').append(
'<tr class="noBgColor">' +
"<td>No bind parameters defined.</td>" +
'<td></td>' +
"</tr>"
);
}
},
initAce: function() {
var self = this;
//init aql editor
this.aqlEditor = ace.edit("aqlEditor");
this.aqlEditor.getSession().setMode("ace/mode/aql");
this.aqlEditor.setFontSize("13px");
this.aqlEditor.getSession().on('change', function() {
self.checkForNewBindParams();
self.renderBindParamTable();
});
this.aqlEditor.commands.addCommand({
name: "togglecomment",
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
exec: function (editor) {
editor.toggleCommentLines();
},
multiSelectAction: "forEach"
});
//auto focus this editor
$('#aqlEditor .ace_text-input').focus();
},
afterRender: function() {
this.initAce();
this.initBindParamTable();
this.getCachedQueryAfterRender();
this.fillSelectBoxes();
this.makeResizeable();
//set height of editor wrapper
$('.inputEditorWrapper').height($(window).height() / 10 * 3);
},
saveAQL: function (e) {
e.stopPropagation();
//update queries first, before writing
this.refreshAQL();
var varsEditor = ace.edit("varsEditor"),
saveName = $('#new-query-name').val(),
bindVars = varsEditor.getValue();
if ($('#new-query-name').hasClass('invalid-input')) {
return;
}
//Heiko: Form-Validator - illegal query name
if (saveName.trim() === '') {
return;
}
var content = this.aqlEditor.getValue(),
//check for already existing entry
quit = false;
$.each(this.customQueries, function (k, v) {
if (v.name === saveName) {
v.value = content;
quit = true;
return;
}
});
if (quit === true) {
//Heiko: Form-Validator - name already taken
// Update model and save
this.collection.findWhere({name: saveName}).set("value", content);
}
else {
if (bindVars === '' || bindVars === undefined) {
bindVars = '{}';
}
if (typeof bindVars === 'string') {
try {
bindVars = JSON.parse(bindVars);
}
catch (err) {
arangoHelper.arangoError("Query", "Could not parse bind parameter");
}
}
this.collection.add({
name: saveName,
parameter: bindVars,
value: content
});
}
var callback = function(error) {
if (error) {
arangoHelper.arangoError("Query", "Could not save query");
}
else {
var self = this;
this.collection.fetch({
success: function() {
self.updateLocalQueries();
self.renderSelectboxes();
$('#querySelect').val(saveName);
}
});
}
}.bind(this);
this.collection.saveCollectionQueries(callback);
window.modalView.hide();
},
executeQuery: function () {
if (this.aqlEditor.getValue().length === 0) {
arangoHelper.arangoError("Query", "Your query is empty");
return;
}
this.$(this.outputDiv).prepend(this.outputTemplate.render({
counter: this.outputCounter,
type: "Query"
}));
$('#outputEditorWrapper' + this.outputCounter).hide();
$('#outputEditorWrapper' + this.outputCounter).show('fast');
var counter = this.outputCounter,
outputEditor = ace.edit("outputEditor" + counter),
sentQueryEditor = ace.edit("sentQueryEditor" + counter);
outputEditor.setReadOnly(true);
sentQueryEditor.setReadOnly(true);
this.fillResult(outputEditor, sentQueryEditor, counter);
this.outputCounter++;
},
readQueryData: function() {
var selectedText = this.aqlEditor.session.getTextRange(this.aqlEditor.getSelectionRange());
var sizeBox = $('#querySize');
var data = {
query: selectedText || this.aqlEditor.getValue(),
id: "currentFrontendQuery"
};
if (sizeBox.val() !== 'all') {
data.batchSize = parseInt(sizeBox.val(), 10);
}
//parse vars
//var bindVars = varsEditor.getValue();
//TODO bind vars table include
var bindVars = "";
if (bindVars.length > 0) {
try {
var params = JSON.parse(bindVars);
if (Object.keys(params).length !== 0) {
data.bindVars = params;
}
}
catch (e) {
arangoHelper.arangoError("Query error", "Could not parse bind parameters.");
return false;
}
}
return JSON.stringify(data);
},
fillResult: function(outputEditor, sentQueryEditor, counter) {
var self = this;
var queryData = this.readQueryData();
if (queryData) {
sentQueryEditor.setValue(self.aqlEditor.getValue());
$.ajax({
type: "POST",
url: "/_api/cursor",
headers: {
'x-arango-async': 'store'
},
data: queryData,
contentType: "application/json",
processData: false,
success: function (data, textStatus, xhr) {
if (xhr.getResponseHeader('x-arango-async-id')) {
self.queryCallbackFunction(xhr.getResponseHeader('x-arango-async-id'), outputEditor, counter);
}
$.noty.clearQueue();
$.noty.closeAll();
},
error: function (data) {
try {
var temp = JSON.parse(data.responseText);
outputEditor.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
}
catch (e) {
outputEditor.setValue('ERROR');
arangoHelper.arangoError("Query error", "ERROR");
}
window.progressView.hide();
}
});
}
},
setEditorAutoHeight: function (editor) {
editor.setOptions({
maxLines: Infinity
});
},
deselect: function (editor) {
var current = editor.getSelection();
var currentRow = current.lead.row;
var currentColumn = current.lead.column;
current.setSelectionRange({
start: {
row: currentRow,
column: currentColumn
},
end: {
row: currentRow,
column: currentColumn
}
});
editor.focus();
},
queryCallbackFunction: function(queryID, outputEditor, counter) {
var self = this;
var cancelRunningQuery = function() {
$.ajax({
url: '/_api/job/'+ encodeURIComponent(queryID) + "/cancel",
type: 'PUT',
success: function() {
window.clearTimeout(self.checkQueryTimer);
arangoHelper.arangoNotification("Query", "Query canceled.");
window.progressView.hide();
}
});
};
window.progressView.show(
"Query is operating...",
cancelRunningQuery,
"Cancel Query"
);
self.timer.start();
this.execPending = false;
var warningsFunc = function(data) {
var warnings = "";
if (data.extra && data.extra.warnings && data.extra.warnings.length > 0) {
warnings += "Warnings:" + "\r\n\r\n";
data.extra.warnings.forEach(function(w) {
warnings += "[" + w.code + "], '" + w.message + "'\r\n";
});
}
if (warnings !== "") {
warnings += "\r\n" + "Result:" + "\r\n\r\n";
}
outputEditor.setValue(warnings + JSON.stringify(data.result, undefined, 2));
};
var fetchQueryResult = function(data) {
warningsFunc(data);
window.progressView.hide();
var time = self.timer.getTimeAndReset()/1000 + " s";
$('#outputEditorWrapper' + counter + ' .queryExecutionTime2').text(time);
self.setEditorAutoHeight(outputEditor);
self.deselect(outputEditor);
};
//check if async query is finished
var checkQueryStatus = function() {
$.ajax({
type: "PUT",
url: "/_api/job/" + encodeURIComponent(queryID),
contentType: "application/json",
processData: false,
success: function (data, textStatus, xhr) {
//query finished, now fetch results
if (xhr.status === 201) {
fetchQueryResult(data);
}
//query not ready yet, retry
else if (xhr.status === 204) {
self.checkQueryTimer = window.setTimeout(function() {
checkQueryStatus();
}, 500);
}
},
error: function (resp) {
try {
var error = JSON.parse(resp.responseText);
if (error.errorMessage) {
arangoHelper.arangoError("Query", error.errorMessage);
$('#outputEditorWrapper' + counter).hide();
}
}
catch (e) {
arangoHelper.arangoError("Query", "Something went wrong.");
}
window.progressView.hide();
}
});
};
checkQueryStatus();
},
refreshAQL: function() {
var self = this;
var callback = function(error) {
if (error) {
arangoHelper.arangoError('Query', 'Could not reload Queries');
}
else {
self.updateLocalQueries();
}
}.bind(self);
var originCallback = function() {
self.getSystemQueries(callback);
}.bind(self);
this.getAQL(originCallback);
},
getSystemQueries: function (callback) {
var self = this;
$.ajax({
type: "GET",
cache: false,
url: "js/arango/aqltemplates.json",
contentType: "application/json",
processData: false,
success: function (data) {
if (callback) {
callback(false);
}
self.queries = data;
},
error: function () {
if (callback) {
callback(true);
}
arangoHelper.arangoNotification("Query", "Error while loading system templates");
}
});
},
updateLocalQueries: function () {
var self = this;
this.customQueries = [];
this.collection.each(function(model) {
self.customQueries.push({
name: model.get("name"),
value: model.get("value"),
parameter: model.get("parameter")
});
});
},
getAQL: function (originCallback) {
var self = this, result;
this.collection.fetch({
success: function() {
//old storage method
var item = localStorage.getItem("customQueries");
if (item) {
var queries = JSON.parse(item);
//save queries in user collections extra attribute
_.each(queries, function(oldQuery) {
self.collection.add({
value: oldQuery.value,
name: oldQuery.name
});
});
var callback = function(error, data) {
if (error) {
arangoHelper.arangoError(
"Custom Queries",
"Could not import old local storage queries"
);
}
else {
localStorage.removeItem("customQueries");
}
}.bind(self);
self.collection.saveCollectionQueries(callback);
}
self.updateLocalQueries();
if (originCallback) {
originCallback();
}
}
});
}
});
}());

View File

@ -16,6 +16,10 @@
&:focus {
outline: none;
}
i {
margin-left: -5px;
}
}
.button-neutral {

View File

@ -324,6 +324,15 @@
opacity: .4;
}
.fade {
opacity: 0;
-moz-transition: opacity .03s linear;
-ms-transition: opacity .03s linear;
-o-transition: opacity .03s linear;
-webkit-transition: opacity .03s linear;
transition: opacity .03s linear;
}
.modal {
border: 0 !important;
border-radius: 3px !important;

View File

@ -0,0 +1,125 @@
.inputEditorWrapper {
border-bottom: 3px solid $c-content-border !important;
border-left: 1px solid $c-content-border;
border-right: 1px solid $c-content-border;
clear: both;
height: 300px;
min-height: 300px;
width: 100%;
.aqlEditorWrapper {
background: #f6f6f6;
border: 0 !important;
border-right: 3px solid $c-content-border !important;
float: left;
height: 100% !important;
max-width: 85%;
min-width: 20%;
width: 70%;
}
.bindParamEditorWrapper {
background: #eee;
overflow: hidden;
table {
border-top: 0;
font: 13px/normal Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace;
tbody {
display: block;
overflow-y: auto;
}
tr {
&.noBgColor {
background-color: rgba(0, 0, 0, 0) !important;
}
}
thead {
display: block;
}
td {
padding: 0 5px;
width: 50%;
input {
@extend %inputs;
clear: both;
float: right;
font: 13px/normal Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace !important;
height: 17px;
margin-bottom: 3px;
margin-top: 3px;
width: auto !important;
}
}
th {
font: 13px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
height: 17px;
padding: 0;
width: 50%;
}
}
}
.aqlEditorWrapper,
.bindParamEditorWrapper {
height: 100%;
div {
height: 100%;
}
}
.ui-resizable-s {
cursor: ns-resize;
}
.ui-resizable-e {
cursor: ew-resize;
}
}
.queryContent {
clear: both;
margin-top: 0;
width: 100%;
}
.outputEditors {
margin-bottom: 60px;
}
.outputEditorWrapper {
clear: both;
height: 100px;
padding-top: 20px;
width: 100%;
.switchAce {
background-color: rgba(0, 0, 0, .6);
border-radius: 3px;
color: $c-white;
cursor: pointer;
position: relative;
right: -27px;
top: 45px;
z-index: 10;
}
.ace_editor {
border-left: 1px solid $c-content-border;
border-right: 1px solid $c-content-border;
height: 280px;
width: 100%;
.ace_active-line {
background: $c-white !important;
}
}
}

Some files were not shown because too many files have changed in this diff Show More