Skip to content

Commit 6ca3668

Browse files
authored
Merge branch 'master' into fedora-llvm
2 parents 37400e3 + 5805e8d commit 6ca3668

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4512
-525
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,20 @@ endif()
9797
# ---[ Warnings
9898
peloton_warnings_disable(CMAKE_CXX_FLAGS -Wno-strict-aliasing -Wno-implicit-fallthrough)
9999

100-
# Turn on sanitizers if necessary.
100+
# ---[ Check if we should use the GNU Gold linker
101+
set(USE_GOLD true CACHE BOOL "Use the GNU Gold linker if available")
102+
if (USE_GOLD)
103+
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
104+
if ("${LD_VERSION}" MATCHES "GNU gold")
105+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
106+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
107+
else ()
108+
message(WARNING "GNU gold linker isn't available, using the default system linker.")
109+
set(USE_LD_GOLD OFF)
110+
endif ()
111+
endif()
112+
113+
# ---[ Turn on sanitizers if necessary.
101114
if(USE_SANITIZER)
102115
if (USE_SANITIZER STREQUAL "Address")
103116
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
@@ -117,9 +130,6 @@ if(USE_SANITIZER)
117130
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-address-use-after-scope")
118131
endif()
119132
endif()
120-
if (CMAKE_COMPILER_IS_GNUCC)
121-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
122-
endif()
123133
endif()
124134

125135
# -- [ Coverage

cmake/Targets.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function(peloton_pickup_peloton_sources root)
8888
# jsoncpp
8989
file(GLOB_RECURSE jsoncpp_srcs ${root}/third_party/jsoncpp/*.cpp)
9090

91+
# ART
92+
file(GLOB_RECURSE art_srcs ${root}/third_party/adaptive_radix_tree/*.cpp)
93+
9194
# date
9295
file(GLOB_RECURSE jsoncpp_srcs ${root}/third_party/date/*.cpp)
9396
set(date_hdrs ${root}/third_party/date/)
@@ -99,7 +102,7 @@ function(peloton_pickup_peloton_sources root)
99102

100103
# add proto to make them editable in IDEs too
101104
file(GLOB_RECURSE proto_files ${root}/src/peloton/*.proto)
102-
list(APPEND srcs ${proto_files} ${murmur_srcs} ${libcount_srcs} ${libcds_srcs} ${jsoncpp_srcs})
105+
list(APPEND srcs ${proto_files} ${murmur_srcs} ${libcount_srcs} ${art_srcs} ${jsoncpp_srcs})
103106

104107
# propogate to parent scope
105108
set(srcs ${srcs} PARENT_SCOPE)

src/common/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "common/thread_pool.h"
2323
#include "concurrency/transaction_manager_factory.h"
2424
#include "gc/gc_manager_factory.h"
25+
#include "index/index.h"
2526
#include "settings/settings_manager.h"
2627
#include "threadpool/mono_queue_pool.h"
2728

src/common/internal_types.cpp

Lines changed: 128 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// Identification: src/common/internal_types.cpp
88
//
9-
// Copyright (c) 2015-2017, Carnegie Mellon University Database Group
9+
// Copyright (c) 2015-2018, Carnegie Mellon University Database Group
1010
//
1111
//===----------------------------------------------------------------------===//
1212

@@ -18,7 +18,6 @@
1818
#include "common/internal_types.h"
1919
#include "common/logger.h"
2020
#include "common/macros.h"
21-
#include "type/value_factory.h"
2221
#include "parser/sql_statement.h"
2322
#include "parser/statements.h"
2423
#include "util/string_util.h"
@@ -529,101 +528,152 @@ std::ostream &operator<<(std::ostream &os, const StatementType &type) {
529528
// QueryType - String Utilities
530529
//===--------------------------------------------------------------------===//
531530
std::string QueryTypeToString(QueryType query_type) {
532-
switch(query_type) {
533-
case QueryType::QUERY_BEGIN:return "BEGIN";
534-
case QueryType::QUERY_COMMIT:return "COMMIT";
535-
case QueryType::QUERY_ROLLBACK:return "ROLLBACK";
536-
case QueryType::QUERY_CREATE_DB:return "CREATE DATABASE";
537-
case QueryType::QUERY_CREATE_INDEX: return "CREATE INDEX";
538-
case QueryType::QUERY_CREATE_TABLE: return "CREATE TABLE";
539-
case QueryType::QUERY_CREATE_TRIGGER: return "CREATE TRIGGER";
540-
case QueryType::QUERY_CREATE_SCHEMA: return "CREATE SCHEMA";
541-
case QueryType::QUERY_CREATE_VIEW: return "CREATE VIEW";
542-
case QueryType::QUERY_DROP:return "DROP";
543-
case QueryType::QUERY_INSERT:return "INSERT";
544-
case QueryType::QUERY_SET: return "SET";
545-
case QueryType::QUERY_SHOW: return "SHOW";
546-
case QueryType::QUERY_UPDATE: return "UPDATE";
547-
case QueryType::QUERY_ALTER: return "ALTER";
548-
case QueryType::QUERY_DELETE: return "DELETE";
549-
case QueryType::QUERY_COPY: return "COPY";
550-
case QueryType::QUERY_ANALYZE: return "ANALYZE";
551-
case QueryType::QUERY_RENAME: return "RENAME";
552-
case QueryType::QUERY_PREPARE: return "PREPARE";
553-
case QueryType::QUERY_EXECUTE: return "EXECUTE";
554-
case QueryType::QUERY_SELECT: return "SELECT";
555-
case QueryType::QUERY_OTHER: default: return "OTHER";
531+
switch (query_type) {
532+
case QueryType::QUERY_BEGIN:
533+
return "BEGIN";
534+
case QueryType::QUERY_COMMIT:
535+
return "COMMIT";
536+
case QueryType::QUERY_ROLLBACK:
537+
return "ROLLBACK";
538+
case QueryType::QUERY_CREATE_DB:
539+
return "CREATE DATABASE";
540+
case QueryType::QUERY_CREATE_INDEX:
541+
return "CREATE INDEX";
542+
case QueryType::QUERY_CREATE_TABLE:
543+
return "CREATE TABLE";
544+
case QueryType::QUERY_CREATE_TRIGGER:
545+
return "CREATE TRIGGER";
546+
case QueryType::QUERY_CREATE_SCHEMA:
547+
return "CREATE SCHEMA";
548+
case QueryType::QUERY_CREATE_VIEW:
549+
return "CREATE VIEW";
550+
case QueryType::QUERY_DROP:
551+
return "DROP";
552+
case QueryType::QUERY_INSERT:
553+
return "INSERT";
554+
case QueryType::QUERY_SET:
555+
return "SET";
556+
case QueryType::QUERY_SHOW:
557+
return "SHOW";
558+
case QueryType::QUERY_UPDATE:
559+
return "UPDATE";
560+
case QueryType::QUERY_ALTER:
561+
return "ALTER";
562+
case QueryType::QUERY_DELETE:
563+
return "DELETE";
564+
case QueryType::QUERY_COPY:
565+
return "COPY";
566+
case QueryType::QUERY_ANALYZE:
567+
return "ANALYZE";
568+
case QueryType::QUERY_RENAME:
569+
return "RENAME";
570+
case QueryType::QUERY_PREPARE:
571+
return "PREPARE";
572+
case QueryType::QUERY_EXECUTE:
573+
return "EXECUTE";
574+
case QueryType::QUERY_SELECT:
575+
return "SELECT";
576+
case QueryType::QUERY_OTHER:
577+
default:
578+
return "OTHER";
556579
}
557580
}
558581

559582
QueryType StringToQueryType(const std::string &str) {
560-
static std::unordered_map<std::string, QueryType> querytype_string_map {
561-
{"BEGIN", QueryType::QUERY_BEGIN}, {"COMMIT", QueryType::QUERY_COMMIT},
562-
{"ROLLBACK", QueryType::QUERY_ROLLBACK}, {"CREATE DATABASE", QueryType::QUERY_CREATE_DB},
563-
{"CREATE INDEX", QueryType::QUERY_CREATE_INDEX}, {"CREATE TABLE", QueryType::QUERY_CREATE_TABLE},
564-
{"DROP", QueryType::QUERY_DROP}, {"INSERT", QueryType::QUERY_INSERT},
565-
{"SET", QueryType::QUERY_SET}, {"SHOW", QueryType::QUERY_SHOW},
566-
{"SHOW", QueryType::QUERY_SHOW}, {"UPDATE", QueryType::QUERY_UPDATE},
567-
{"ALTER", QueryType::QUERY_ALTER}, {"DELETE", QueryType::QUERY_DELETE},
568-
{"COPY", QueryType::QUERY_COPY}, {"ANALYZE", QueryType::QUERY_ANALYZE},
569-
{"RENAME", QueryType::QUERY_RENAME}, {"PREPARE", QueryType::QUERY_PREPARE},
570-
{"EXECUTE", QueryType::QUERY_EXECUTE}, {"SELECT", QueryType::QUERY_SELECT},
571-
{"CREATE TRIGGER", QueryType::QUERY_CREATE_TRIGGER}, {"CREATE SCHEMA", QueryType::QUERY_CREATE_SCHEMA},
572-
{"CREATE VIEW", QueryType::QUERY_CREATE_VIEW}, {"OTHER", QueryType::QUERY_OTHER},
583+
static std::unordered_map<std::string, QueryType> querytype_string_map{
584+
{"BEGIN", QueryType::QUERY_BEGIN},
585+
{"COMMIT", QueryType::QUERY_COMMIT},
586+
{"ROLLBACK", QueryType::QUERY_ROLLBACK},
587+
{"CREATE DATABASE", QueryType::QUERY_CREATE_DB},
588+
{"CREATE INDEX", QueryType::QUERY_CREATE_INDEX},
589+
{"CREATE TABLE", QueryType::QUERY_CREATE_TABLE},
590+
{"DROP", QueryType::QUERY_DROP},
591+
{"INSERT", QueryType::QUERY_INSERT},
592+
{"SET", QueryType::QUERY_SET},
593+
{"SHOW", QueryType::QUERY_SHOW},
594+
{"SHOW", QueryType::QUERY_SHOW},
595+
{"UPDATE", QueryType::QUERY_UPDATE},
596+
{"ALTER", QueryType::QUERY_ALTER},
597+
{"DELETE", QueryType::QUERY_DELETE},
598+
{"COPY", QueryType::QUERY_COPY},
599+
{"ANALYZE", QueryType::QUERY_ANALYZE},
600+
{"RENAME", QueryType::QUERY_RENAME},
601+
{"PREPARE", QueryType::QUERY_PREPARE},
602+
{"EXECUTE", QueryType::QUERY_EXECUTE},
603+
{"SELECT", QueryType::QUERY_SELECT},
604+
{"CREATE TRIGGER", QueryType::QUERY_CREATE_TRIGGER},
605+
{"CREATE SCHEMA", QueryType::QUERY_CREATE_SCHEMA},
606+
{"CREATE VIEW", QueryType::QUERY_CREATE_VIEW},
607+
{"OTHER", QueryType::QUERY_OTHER},
573608
};
574-
std::unordered_map<std::string, QueryType>::iterator it = querytype_string_map.find(str);
609+
std::unordered_map<std::string, QueryType>::iterator it =
610+
querytype_string_map.find(str);
575611
if (it != querytype_string_map.end()) {
576-
return it -> second;
612+
return it->second;
577613
} else {
578614
return QueryType::QUERY_INVALID;
579615
}
580616
}
581617

582-
QueryType StatementTypeToQueryType(StatementType stmt_type, const parser::SQLStatement* sql_stmt) {
618+
QueryType StatementTypeToQueryType(StatementType stmt_type,
619+
const parser::SQLStatement *sql_stmt) {
583620
LOG_TRACE("%s", StatementTypeToString(stmt_type).c_str());
584-
static std::unordered_map<StatementType, QueryType, EnumHash<StatementType>> type_map {
585-
{StatementType::EXECUTE, QueryType::QUERY_EXECUTE},
586-
{StatementType::PREPARE, QueryType::QUERY_PREPARE},
587-
{StatementType::INSERT, QueryType::QUERY_INSERT},
588-
{StatementType::UPDATE, QueryType::QUERY_UPDATE},
589-
{StatementType::DELETE, QueryType::QUERY_DELETE},
590-
{StatementType::COPY, QueryType::QUERY_COPY},
591-
{StatementType::ANALYZE, QueryType::QUERY_ANALYZE},
592-
{StatementType::ALTER, QueryType::QUERY_ALTER},
593-
{StatementType::DROP, QueryType::QUERY_DROP},
594-
{StatementType::SELECT, QueryType::QUERY_SELECT},
595-
{StatementType::VARIABLE_SET, QueryType::QUERY_SET},
596-
};
621+
static std::unordered_map<StatementType, QueryType, EnumHash<StatementType>>
622+
type_map{
623+
{StatementType::EXECUTE, QueryType::QUERY_EXECUTE},
624+
{StatementType::PREPARE, QueryType::QUERY_PREPARE},
625+
{StatementType::INSERT, QueryType::QUERY_INSERT},
626+
{StatementType::UPDATE, QueryType::QUERY_UPDATE},
627+
{StatementType::DELETE, QueryType::QUERY_DELETE},
628+
{StatementType::COPY, QueryType::QUERY_COPY},
629+
{StatementType::ANALYZE, QueryType::QUERY_ANALYZE},
630+
{StatementType::ALTER, QueryType::QUERY_ALTER},
631+
{StatementType::DROP, QueryType::QUERY_DROP},
632+
{StatementType::SELECT, QueryType::QUERY_SELECT},
633+
{StatementType::VARIABLE_SET, QueryType::QUERY_SET},
634+
};
597635
QueryType query_type = QueryType::QUERY_OTHER;
598-
std::unordered_map<StatementType, QueryType, EnumHash<StatementType>>::iterator it = type_map.find(stmt_type);
636+
std::unordered_map<StatementType, QueryType,
637+
EnumHash<StatementType>>::iterator it =
638+
type_map.find(stmt_type);
599639
if (it != type_map.end()) {
600-
query_type = it -> second;
640+
query_type = it->second;
601641
} else {
602-
switch(stmt_type) {
642+
switch (stmt_type) {
603643
case StatementType::TRANSACTION: {
604-
switch (static_cast<const parser::TransactionStatement*>(sql_stmt) ->type) {
605-
case parser::TransactionStatement::CommandType::kBegin:query_type = QueryType::QUERY_BEGIN;
644+
switch (
645+
static_cast<const parser::TransactionStatement *>(sql_stmt)->type) {
646+
case parser::TransactionStatement::CommandType::kBegin:
647+
query_type = QueryType::QUERY_BEGIN;
606648
break;
607-
case parser::TransactionStatement::CommandType::kCommit:query_type = QueryType::QUERY_COMMIT;
649+
case parser::TransactionStatement::CommandType::kCommit:
650+
query_type = QueryType::QUERY_COMMIT;
608651
break;
609-
case parser::TransactionStatement::CommandType::kRollback:query_type = QueryType::QUERY_ROLLBACK;
652+
case parser::TransactionStatement::CommandType::kRollback:
653+
query_type = QueryType::QUERY_ROLLBACK;
610654
break;
611655
}
612656
break;
613657
}
614658
case StatementType::CREATE: {
615-
switch (static_cast<const parser::CreateStatement*>(sql_stmt) ->type) {
616-
case parser::CreateStatement::CreateType::kDatabase:query_type = QueryType::QUERY_CREATE_DB;
659+
switch (static_cast<const parser::CreateStatement *>(sql_stmt)->type) {
660+
case parser::CreateStatement::CreateType::kDatabase:
661+
query_type = QueryType::QUERY_CREATE_DB;
617662
break;
618-
case parser::CreateStatement::CreateType::kIndex:query_type = QueryType::QUERY_CREATE_INDEX;
663+
case parser::CreateStatement::CreateType::kIndex:
664+
query_type = QueryType::QUERY_CREATE_INDEX;
619665
break;
620-
case parser::CreateStatement::CreateType::kTable:query_type = QueryType::QUERY_CREATE_TABLE;
666+
case parser::CreateStatement::CreateType::kTable:
667+
query_type = QueryType::QUERY_CREATE_TABLE;
621668
break;
622-
case parser::CreateStatement::CreateType::kTrigger:query_type = QueryType::QUERY_CREATE_TRIGGER;
669+
case parser::CreateStatement::CreateType::kTrigger:
670+
query_type = QueryType::QUERY_CREATE_TRIGGER;
623671
break;
624-
case parser::CreateStatement::CreateType::kSchema:query_type = QueryType::QUERY_CREATE_SCHEMA;
672+
case parser::CreateStatement::CreateType::kSchema:
673+
query_type = QueryType::QUERY_CREATE_SCHEMA;
625674
break;
626-
case parser::CreateStatement::CreateType::kView:query_type = QueryType::QUERY_CREATE_VIEW;
675+
case parser::CreateStatement::CreateType::kView:
676+
query_type = QueryType::QUERY_CREATE_VIEW;
627677
break;
628678
}
629679
break;
@@ -708,9 +758,9 @@ std::string PostgresValueTypeToString(PostgresValueType type) {
708758
return "DECIMAL";
709759
}
710760
default: {
711-
throw ConversionException(
712-
StringUtil::Format("No string conversion for PostgresValueType value '%d'",
713-
static_cast<int>(type)));
761+
throw ConversionException(StringUtil::Format(
762+
"No string conversion for PostgresValueType value '%d'",
763+
static_cast<int>(type)));
714764
}
715765
}
716766
return "INVALID";
@@ -766,7 +816,7 @@ PostgresValueType StringToPostgresValueType(const std::string &str) {
766816
return PostgresValueType::DECIMAL;
767817
} else {
768818
throw ConversionException(StringUtil::Format(
769-
"No PostgresValueType conversion from string '%s'", upper_str.c_str()));
819+
"No PostgresValueType conversion from string '%s'", upper_str.c_str()));
770820
}
771821
return PostgresValueType::INVALID;
772822
}
@@ -1087,13 +1137,15 @@ std::string IndexTypeToString(IndexType type) {
10871137
case IndexType::SKIPLIST: {
10881138
return "SKIPLIST";
10891139
}
1140+
case IndexType::ART: {
1141+
return "ART";
1142+
}
10901143
default: {
10911144
throw ConversionException(
10921145
StringUtil::Format("No string conversion for IndexType value '%d'",
10931146
static_cast<int>(type)));
10941147
}
10951148
}
1096-
return "INVALID";
10971149
}
10981150

10991151
IndexType StringToIndexType(const std::string &str) {
@@ -1108,6 +1160,8 @@ IndexType StringToIndexType(const std::string &str) {
11081160
return IndexType::HASH;
11091161
} else if (upper_str == "SKIPLIST") {
11101162
return IndexType::SKIPLIST;
1163+
} else if (upper_str == "ART") {
1164+
return IndexType::ART;
11111165
} else {
11121166
throw ConversionException(StringUtil::Format(
11131167
"No IndexType conversion from string '%s'", upper_str.c_str()));

src/gc/transaction_level_gc_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "concurrency/epoch_manager_factory.h"
1919
#include "concurrency/transaction_manager_factory.h"
2020
#include "settings/settings_manager.h"
21+
#include "index/index.h"
2122
#include "storage/database.h"
2223
#include "storage/tile_group.h"
2324
#include "storage/tuple.h"

src/include/common/abstract_tuple.h

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,30 @@
1818

1919
namespace peloton {
2020

21-
namespace catalog {
22-
class Schema;
23-
}
24-
25-
//===--------------------------------------------------------------------===//
26-
// Tuple Interface
27-
//===--------------------------------------------------------------------===//
28-
21+
//===----------------------------------------------------------------------===//
22+
// Generic tuple interface
23+
//===----------------------------------------------------------------------===//
2924
class AbstractTuple : public Printable {
3025
public:
31-
virtual ~AbstractTuple(){};
26+
virtual ~AbstractTuple() = default;
3227

33-
/** @brief Get the value at the given column id. */
28+
/**
29+
* @brief Get the value at the given column id
30+
*
31+
* @param column_id The ID/offset of the column whose value to return
32+
*/
3433
virtual type::Value GetValue(oid_t column_id) const = 0;
3534

36-
/** @brief Set the value at the given column id. */
35+
/**
36+
* @brief Set the value at the given column id
37+
*
38+
* @param column_id The ID/offset of the column in the tuple to set
39+
* @param value The value to set the column to
40+
**/
3741
virtual void SetValue(oid_t column_id, const type::Value &value) = 0;
3842

39-
/** @brief Get the raw location of the tuple's contents i.e. tuple.value_data.
43+
/**
44+
* @brief Get the raw location of the tuple's contents i.e. tuple.value_data.
4045
*/
4146
virtual char *GetData() const = 0;
4247
};

0 commit comments

Comments
 (0)