mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'aql2' into mmh
This commit is contained in:
commit
7bca4da5dc
|
@ -910,6 +910,8 @@ namespace triagens {
|
||||||
virtual ExecutionNode* clone () const {
|
virtual ExecutionNode* clone () const {
|
||||||
std::vector<std::vector<RangeInfo>> ranges;
|
std::vector<std::vector<RangeInfo>> ranges;
|
||||||
for (size_t i = 0; i < _ranges.size(); i++){
|
for (size_t i = 0; i < _ranges.size(); i++){
|
||||||
|
ranges.push_back(std::vector<RangeInfo>());
|
||||||
|
|
||||||
for (auto x: _ranges.at(i)){
|
for (auto x: _ranges.at(i)){
|
||||||
ranges.at(i).push_back(x);
|
ranges.at(i).push_back(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
||||||
int level;
|
int level;
|
||||||
auto p = _plans.pop_front(level);
|
auto p = _plans.pop_front(level);
|
||||||
|
|
||||||
if (level == maxRuleLevel) {
|
if (level >= maxRuleLevel) {
|
||||||
_newPlans.push_back(p, level); // nothing to do, just keep it
|
_newPlans.push_back(p, level); // nothing to do, just keep it
|
||||||
}
|
}
|
||||||
else { // find next rule
|
else { // find next rule
|
||||||
|
@ -181,7 +181,7 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_ASSERT(_plans.size() >= 1);
|
TRI_ASSERT(_plans.size() >= 1);
|
||||||
|
|
||||||
estimatePlans();
|
estimatePlans();
|
||||||
|
|
|
@ -156,7 +156,7 @@ static inline void* CONST_CAST (void const* ptr) {
|
||||||
/// @brief incrementing a uint64_t modulo a number with wraparound
|
/// @brief incrementing a uint64_t modulo a number with wraparound
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static inline uint64_t TRI_IncModU64(uint64_t i, uint64_t len) {
|
static inline uint64_t TRI_IncModU64 (uint64_t i, uint64_t len) {
|
||||||
// Note that the dummy variable gives the compiler a (good) chance to
|
// Note that the dummy variable gives the compiler a (good) chance to
|
||||||
// use a conditional move instruction instead of a branch. This actually
|
// use a conditional move instruction instead of a branch. This actually
|
||||||
// works on modern gcc.
|
// works on modern gcc.
|
||||||
|
@ -165,7 +165,7 @@ static inline uint64_t TRI_IncModU64(uint64_t i, uint64_t len) {
|
||||||
return i < len ? i : dummy;
|
return i < len ? i : dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t TRI_DecModU64(uint64_t i, uint64_t len) {
|
static inline uint64_t TRI_DecModU64 (uint64_t i, uint64_t len) {
|
||||||
if ((i--) != 0) {
|
if ((i--) != 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -203,12 +203,11 @@ static inline uint64_t TRI_DecModU64(uint64_t i, uint64_t len) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
static inline void _backtrace(void)
|
static inline void _backtrace (void) {
|
||||||
{
|
|
||||||
#if HAVE_BACKTRACE
|
#if HAVE_BACKTRACE
|
||||||
void *stack_frames[50];
|
void* stack_frames[50];
|
||||||
size_t size, i;
|
size_t size, i;
|
||||||
char **strings;
|
char** strings;
|
||||||
|
|
||||||
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
|
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
|
||||||
strings = backtrace_symbols(stack_frames, size);
|
strings = backtrace_symbols(stack_frames, size);
|
||||||
|
@ -234,41 +233,45 @@ static inline void _backtrace(void)
|
||||||
// if the line could be processed, attempt to demangle the symbol
|
// if the line could be processed, attempt to demangle the symbol
|
||||||
if (mangled_name && offset_begin && offset_end &&
|
if (mangled_name && offset_begin && offset_end &&
|
||||||
mangled_name < offset_begin) {
|
mangled_name < offset_begin) {
|
||||||
*mangled_name++ = '\0';
|
*mangled_name++ = '\0';
|
||||||
*offset_begin++ = '\0';
|
*offset_begin++ = '\0';
|
||||||
*offset_end++ = '\0';
|
*offset_end++ = '\0';
|
||||||
int status = 0;
|
int status = 0;
|
||||||
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
|
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
|
||||||
if (status == 0) {
|
if (demangled_name != nullptr) {
|
||||||
fprintf(stderr, "%s() [%p] %s\n", strings[i], stack_frames[i], demangled_name);
|
if (status == 0) {
|
||||||
}
|
fprintf(stderr, "%s() [%p] %s\n", strings[i], stack_frames[i], demangled_name);
|
||||||
else {
|
}
|
||||||
fprintf(stderr, "%s\n", strings[i]);
|
else {
|
||||||
}
|
fprintf(stderr, "%s\n", strings[i]);
|
||||||
free(demangled_name);
|
}
|
||||||
|
TRI_SystemFree(demangled_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", strings[i]);
|
fprintf(stderr, "%s\n", strings[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
fprintf(stderr, "[%p]\n", stack_frames[i]);
|
fprintf(stderr, "[%p]\n", stack_frames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (strings != NULL) {
|
||||||
|
TRI_SystemFree(strings);
|
||||||
}
|
}
|
||||||
free(strings);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
static inline void _getBacktrace(std::string &btstr)
|
static inline void _getBacktrace (std::string& btstr) {
|
||||||
{
|
|
||||||
#if HAVE_BACKTRACE
|
#if HAVE_BACKTRACE
|
||||||
void *stack_frames[50];
|
void* stack_frames[50];
|
||||||
size_t size, i;
|
size_t size, i;
|
||||||
char **strings;
|
char** strings;
|
||||||
|
|
||||||
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
|
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
|
||||||
strings = backtrace_symbols(stack_frames, size);
|
strings = backtrace_symbols(stack_frames, size);
|
||||||
|
@ -300,26 +303,28 @@ static inline void _getBacktrace(std::string &btstr)
|
||||||
*offset_end++ = '\0';
|
*offset_end++ = '\0';
|
||||||
int status = 0;
|
int status = 0;
|
||||||
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
|
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
|
||||||
if (status == 0) {
|
|
||||||
ss << stack_frames[i];
|
if (demangled_name != nullptr) {
|
||||||
btstr += strings[i] +
|
if (status == 0) {
|
||||||
std::string("() [") +
|
ss << stack_frames[i];
|
||||||
ss.str() +
|
btstr += strings[i] +
|
||||||
std::string("] ") +
|
std::string("() [") +
|
||||||
demangled_name +
|
ss.str() +
|
||||||
std::string("\n");
|
std::string("] ") +
|
||||||
|
demangled_name +
|
||||||
|
std::string("\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
btstr += strings[i] +
|
||||||
|
std::string("\n");
|
||||||
|
}
|
||||||
|
TRI_SystemFree(demangled_name);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
btstr += strings[i] +
|
|
||||||
std::string("\n");
|
|
||||||
}
|
|
||||||
free(demangled_name);
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
btstr += strings[i] +
|
||||||
btstr += strings[i] +
|
std::string("\n");
|
||||||
std::string("\n");
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ss << stack_frames[i];
|
ss << stack_frames[i];
|
||||||
|
@ -327,7 +332,9 @@ static inline void _getBacktrace(std::string &btstr)
|
||||||
std::string("\n");
|
std::string("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(strings);
|
if (strings != NULL) {
|
||||||
|
TRI_SystemFree(strings);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue