Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

DBMain and Settings Manager #336

Merged
merged 666 commits into from May 27, 2019
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
666 commits
Select commit Hold shift + click to select a range
6880281
Merge branch 'master' into catalog
yeshengm Apr 4, 2019
bb4952a
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 5, 2019
0e68d18
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 5, 2019
9288bbe
Compilation fixes
pervazea Apr 5, 2019
10129d5
fix doc
yeshengm Apr 5, 2019
b491bff
move validation into settings_manager; implement temporary value comp…
YuzeLiao Apr 6, 2019
4fd6844
Design document
DarkForte Apr 6, 2019
afe722b
Design document title
DarkForte Apr 6, 2019
6d7f399
add simple main_database class
YuzeLiao Apr 6, 2019
ba41413
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
YuzeLiao Apr 6, 2019
d58e98e
Merge branch 'master' into settings_manager
DarkForte Apr 6, 2019
74b7e28
Merge branch 'master' into 15-721-project2-stats
wenxuanqiu Apr 7, 2019
7bfae07
fix jenkins
yeshengm Apr 7, 2019
5f059c2
change from storage::col_id_t to catalog::col_oid_t
wenhaoh2 Apr 7, 2019
46e0388
add thread to map
yangdsh Apr 7, 2019
19c829d
add callback to MainDatabase
wenhaoh2 Apr 7, 2019
428a629
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
yangdsh Apr 7, 2019
5cca31c
remove plan node (irrelevant for this PR))
Apr 7, 2019
6ac5da2
fix compilation
Apr 7, 2019
3e0e50e
add test
Apr 7, 2019
20fcab8
Add design document
qdHe Apr 7, 2019
4bbb61e
Update DesignDocument.md
qdHe Apr 7, 2019
165696f
format
Apr 7, 2019
3bd9f42
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 7, 2019
ac5a537
Add files via upload
qdHe Apr 7, 2019
8a758ca
Add image to DesignDocument.md
qdHe Apr 7, 2019
2a1d438
move design document
qdHe Apr 7, 2019
41671d1
linter fixes
Apr 7, 2019
cbfb528
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 7, 2019
5461d02
style
Apr 7, 2019
8d087f1
fix clang-tidy errors; fix bugs in settings_handle schema
YuzeLiao Apr 8, 2019
0f28dc9
fix most doxygen error; fix settings handle test bug
YuzeLiao Apr 8, 2019
9fa2d0a
fix format errors
YuzeLiao Apr 8, 2019
e87d1a4
fix minor bugs; temporarily shut down catalog_benchmark
YuzeLiao Apr 8, 2019
57708e4
fix some lint bugs
YuzeLiao Apr 8, 2019
fc767d1
fix bug in settings test
YuzeLiao Apr 8, 2019
ce85cf0
add nolint for macro files
YuzeLiao Apr 8, 2019
0c25800
Fixed transaction mem leak by turning off GC
DarkForte Apr 8, 2019
4eaa81e
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
DarkForte Apr 8, 2019
9bd9e6e
test: callback
wenhaoh2 Apr 8, 2019
cd9ff68
debug
wenhaoh2 Apr 8, 2019
aaa6d46
remove deadcode and unintentional changes
Apr 8, 2019
a5b50c9
update design doc
Apr 9, 2019
a9a5d9f
move catalog entries outside catalog handles, prep for later refactoring
yeshengm Apr 9, 2019
64c15cd
refactored entries
yeshengm Apr 9, 2019
3327414
add test commit
yeshengm Apr 9, 2019
31be3fa
fix doxygen warnings
Apr 9, 2019
44f19c1
simple DBMain
YuzeLiao Apr 9, 2019
0cfa515
- modify Attribute handle to be use a table_oid rather than keeping
pervazea Apr 9, 2019
2975be3
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 9, 2019
97a6e5c
Formatting
pervazea Apr 9, 2019
e36037b
fix travis errors
YuzeLiao Apr 10, 2019
1c2b412
fix travis errors
YuzeLiao Apr 10, 2019
c02106c
Fix documentation
pervazea Apr 10, 2019
f16e30e
Initialize loggers first
DarkForte Apr 10, 2019
8963244
Removed try-catch in logger initialization
DarkForte Apr 10, 2019
5df0f3f
Add back try-catch in logger initialization
DarkForte Apr 10, 2019
ad0698d
Doc fix
pervazea Apr 10, 2019
dac0371
Add settings exception type in get_type()
wenhaoh2 Apr 10, 2019
c9a61f6
Partial review fixes
pervazea Apr 11, 2019
4d379c4
Review fixes - remove deprecated code from AttributeHandle
pervazea Apr 11, 2019
c3d787f
Quick fix for issue #339, segfault in catalog due to transaction
pervazea Apr 11, 2019
1848491
Format and tidy fixes
pervazea Apr 11, 2019
ed58855
merge latest catalog
YuzeLiao Apr 11, 2019
8271a01
Merge branch 'master' of https://github.com/cmu-db/terrier into catalog
pervazea Apr 11, 2019
5511259
More review fixes and doc fixes
pervazea Apr 12, 2019
5497842
remove C++11 synchronization headers and refactor thread collector/ag…
Apr 12, 2019
8722afd
rename method parameters to be consistent
Apr 12, 2019
09edf67
migrate to TransientValue
YuzeLiao Apr 12, 2019
697da7e
Add more documentation for TableEntry
Mar 25, 2019
37442d2
Support for deleting catalog entries
pervazea Mar 26, 2019
edb901c
migrate to TransientValue
YuzeLiao Apr 12, 2019
05244c0
fix bugs
YuzeLiao Apr 12, 2019
1d4cb3a
fix bugs
YuzeLiao Apr 12, 2019
883f05b
Merge branch 'master' into settings_manager
YuzeLiao Apr 12, 2019
3046cf7
More review fixes
pervazea Apr 12, 2019
0e1eac4
fix test bugs
YuzeLiao Apr 12, 2019
7ee8279
update test
YuzeLiao Apr 12, 2019
d9ad472
Merge branch 'master' into DBMain
tli2 Apr 12, 2019
a3aa601
fix doc errors
YuzeLiao Apr 12, 2019
a9849da
More review fixes
pervazea Apr 12, 2019
68edb9a
make things neat
YuzeLiao Apr 12, 2019
b8366c8
make things neat
YuzeLiao Apr 12, 2019
a49ac80
make things neat
YuzeLiao Apr 12, 2019
b01ae78
minor fix
YuzeLiao Apr 12, 2019
ffaf37c
add docs for param
YuzeLiao Apr 13, 2019
49e8652
fix typo in src/include/stats/abstract_metric.h
thepulkitagarwal Apr 13, 2019
ebd73d2
fix typo in src/include/stats/abstract_metric.h
thepulkitagarwal Apr 13, 2019
470ec40
fix typo in src/include/stats/abstract_metric.h
thepulkitagarwal Apr 13, 2019
e258e46
fix typo in src/include/stats/abstract_metric.h
huzaifaabbasi Apr 13, 2019
c8de3d8
fix typo in src/include/stats/thread_level_stats_collector.h
thepulkitagarwal Apr 13, 2019
722d1b2
fix typo in src/include/stats/thread_level_stats_collector.h
thepulkitagarwal Apr 13, 2019
7eeb17a
addressing review comments
Apr 13, 2019
05a654a
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 13, 2019
cc0db34
fix typo in test/stats/stats_framework_test.cpp
utkarsh39 Apr 13, 2019
fc71ea2
Merge branch 'master' into catalog
yeshengm Apr 14, 2019
19227f4
Merge branch 'master' into catalog
yeshengm Apr 14, 2019
2ba49ee
Removed unnecessary headers, rearranged methods
DarkForte Apr 14, 2019
4c5fe46
Format code
DarkForte Apr 15, 2019
57e2ea2
Merge branch 'master' into DBMain
DarkForte Apr 15, 2019
53132c9
adding more comments, doxygen found new uncommented sections :(
Apr 15, 2019
5372481
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 15, 2019
920b6e7
Merge branch 'master' into 15-721-project2-stats
wenxuanqiu Apr 15, 2019
ca3a8df
Merge branch 'master' of https://github.com/cmu-db/terrier into catalog
pervazea Apr 19, 2019
71c2d16
move stats/ to storage/metric/
Apr 20, 2019
bcaa01a
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 20, 2019
7bc4937
modify pair to struct
yangdsh Apr 20, 2019
8e1b90d
modify pair to struct
yangdsh Apr 20, 2019
d41920a
change namespace
Apr 20, 2019
a1ddd6c
merge
Apr 20, 2019
310257c
change comment
Apr 20, 2019
e2bdd44
Merge pull request #4 from yangjuns/catalog
yangdsh Apr 20, 2019
22bef09
Run GC in tests, addressed several issues in CR
DarkForte Apr 20, 2019
d239733
add transaction metric
Apr 20, 2019
2d22e3c
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 20, 2019
be6e631
add transaction metric
Apr 20, 2019
24ee371
Merge branch 'upstream_master' into settings_manager
DarkForte Apr 20, 2019
6ede7a2
add getters for transaction metreic
Apr 20, 2019
63d8233
Merge branch 'catalog' into settings_manager
DarkForte Apr 20, 2019
bd8a6e4
register transaction metrics
Apr 20, 2019
3a7c412
add database metric test
Apr 20, 2019
3fc2ade
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 20, 2019
b07f788
format
Apr 20, 2019
86d97e4
update and persist to catalog
yangdsh Apr 20, 2019
75b04f7
resolve confilcts
yangdsh Apr 20, 2019
8d26b95
fix minor bug
yangdsh Apr 20, 2019
a350226
Merge branch 'master' into 15-721-project2-stats
wenxuanqiu Apr 21, 2019
c486a47
fix include errors
Apr 21, 2019
71edb53
add documentation
Apr 21, 2019
55a88e0
fix stats data types for inserting into tables
Apr 21, 2019
b666f5f
fix stats data types for inserting into tables
Apr 21, 2019
b9f3c9a
Use raw pointers for SqlTableRW instances
pervazea Apr 22, 2019
ca7da82
Partial changes for namespace fixes
pervazea Apr 22, 2019
55c8507
populate setting values outside DBMain
YuzeLiao Apr 22, 2019
2e628f2
minor fix
YuzeLiao Apr 22, 2019
d4a243d
Merge branch 'master' into catalog
yeshengm Apr 23, 2019
62c6335
More docs and explicit constructor
DarkForte Apr 23, 2019
021e8ae
WIP - namespace support changes
pervazea Apr 23, 2019
24eaec7
Merge branch 'upstream_master' into DBMain
DarkForte Apr 23, 2019
548152f
Merge branch 'master' into DBMain
DarkForte Apr 23, 2019
a145be0
Ignore settings_defs.h in check_format and check_lint
DarkForte Apr 23, 2019
b8db417
Merge branch 'master' into DBMain
DarkForte Apr 23, 2019
cad63ce
Whitelist settings_defs.h for doxygen and let it ignore one header ex…
DarkForte Apr 23, 2019
580ca27
Merge branch 'DBMain' of https://github.com/DarkForte/terrier into DB…
DarkForte Apr 23, 2019
40e936b
Documentation updates
pervazea Apr 24, 2019
1122ee6
Merge branch 'master' of https://github.com/cmu-db/terrier into catalog
pervazea Apr 24, 2019
b5a7ad6
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 24, 2019
5c27d7b
Doc and format fixes
pervazea Apr 25, 2019
1ded7a4
More review changes
pervazea Apr 25, 2019
1a1d5a8
Add more (unused) columns to pg_database, for compatibility
pervazea Apr 25, 2019
40eb181
Cleanups
pervazea Apr 25, 2019
19d47db
Merge branch 'master' into catalog
yangdsh Apr 25, 2019
dd8a62d
fix compilation error
pervazea Apr 25, 2019
194142f
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 25, 2019
16bcb31
Revert "Merge branch 'master' into catalog"
pervazea Apr 25, 2019
d8d87e0
add update_and_persist for transaction_metric
yangdsh Apr 25, 2019
8cbc96e
fix bug
yangdsh Apr 25, 2019
98f0a81
refactor database metric
Apr 25, 2019
a1c3a9a
refactor database metric
Apr 25, 2019
91b73e3
Merge branch 'master' into 15-721-project2-stats
wenxuanqiu Apr 25, 2019
9cf0bff
add storage test
Apr 25, 2019
131d372
Merge branch '15-721-project2-stats' of github.com:wenxuanqiu/terrier…
Apr 25, 2019
62ef0bb
remove catalog
Apr 25, 2019
2692d23
remove catalog
Apr 25, 2019
4ab4705
Merge branch '15-721-project2-stats' into catalog
wenxuanqiu Apr 25, 2019
456899e
Revert "Merge branch '15-721-project2-stats' into catalog"
Apr 25, 2019
76d0c76
add callbacks for other types in macro
wenhaoh2 Apr 26, 2019
5b702c6
add ActionContext
wenhaoh2 Apr 28, 2019
d2137fb
small fix
wenhaoh2 Apr 28, 2019
2b16a0a
More fixes
pervazea Apr 29, 2019
1459522
Merge branch 'catalog' of https://github.com/yangjuns/terrier into ca…
pervazea Apr 29, 2019
6e1349e
Merge branch 'master' of https://github.com/cmu-db/terrier into catalog
pervazea May 2, 2019
e599b05
Fix merge issue + sort strong typedefs by name
pervazea May 2, 2019
a79143b
Merge branch 'master' of https://github.com/cmu-db/terrier into catalog
pervazea May 2, 2019
0e4f86b
Fix merge error
pervazea May 2, 2019
764c012
refractor main object & adjust everything
YuzeLiao May 4, 2019
adecb4b
Merge branch 'DBMain' into settings_manager
DarkForte May 5, 2019
31fcfae
Merge branch 'upstream_master' into settings_manager
DarkForte May 5, 2019
7569099
Merge branch 'catalog' into settings_manager
DarkForte May 5, 2019
3b89253
update documentation
YuzeLiao May 5, 2019
1c0ce98
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
YuzeLiao May 5, 2019
1cb35b2
Fix merge errors
DarkForte May 5, 2019
332b44c
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
DarkForte May 5, 2019
1940a05
Addressed lint and clang-tidy problems
DarkForte May 5, 2019
bb5f56a
format & add doc
YuzeLiao May 5, 2019
134c8fd
Removed redundant code in invoking callbacks
DarkForte May 5, 2019
5db2f7d
fix bug
YuzeLiao May 5, 2019
07f17df
fix bug
YuzeLiao May 5, 2019
efd18ae
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
YuzeLiao May 5, 2019
7c353a6
Added tests for coverage
DarkForte May 5, 2019
d2f649d
Merge branch 'settings_manager' of https://github.com/DarkForte/terri…
DarkForte May 5, 2019
89b5dbf
Design doc
DarkForte May 5, 2019
81c5c55
Addressed a clang tidy issue
DarkForte May 6, 2019
52d69bc
impl minmax check && debug
wenhaoh2 May 7, 2019
3602f18
move populating param_map in main() into a static function
wenhaoh2 May 7, 2019
c999f12
combine callback_map into param_map
wenhaoh2 May 7, 2019
2df7074
add latch for settingsmanager
wenhaoh2 May 7, 2019
38466f6
Added ConcurrentModifyTest
DarkForte May 9, 2019
0823395
fix bugs
YuzeLiao May 10, 2019
b625df7
fix bugs
YuzeLiao May 10, 2019
cf8f175
fix bugs
YuzeLiao May 10, 2019
3f686bf
Increased coverage for settings_handle and loggers
DarkForte May 10, 2019
04c7dd3
coverage for GetCopy of TransientValue
YuzeLiao May 10, 2019
46485d6
Merge branch 'master' into settings_manager
YuzeLiao May 10, 2019
299c822
adjust for new master
YuzeLiao May 10, 2019
0ba2468
coverage for attribute_handle & tablespace_handle
YuzeLiao May 10, 2019
cc0b96d
fix doxygen
YuzeLiao May 10, 2019
f08512a
Merge clang tidy fix from Wan
DarkForte May 11, 2019
a6248ea
Remove unused functions, bring up coverage for out-of-bound set calls
DarkForte May 11, 2019
efff4b1
resolve conflict
YuzeLiao May 11, 2019
1960f27
Merge branch 'master' into settings_manager
YuzeLiao May 11, 2019
127f1d8
Addressed some code review comments
DarkForte May 12, 2019
b95f806
test concurrent modification to buffer pool size
wenhaoh2 May 13, 2019
7dc71a2
Peloton -> Terrier
wenhaoh2 May 13, 2019
0f29633
ConstructParamMap as a static SettingsManager function
wenhaoh2 May 13, 2019
3fbf3e6
use specified buffer pool size in bootstrap
YuzeLiao May 14, 2019
a24578e
merge master
YuzeLiao May 14, 2019
1d2d2fa
minor fix
YuzeLiao May 14, 2019
16334fc
fix travis for ConstructParamMap
YuzeLiao May 14, 2019
ed94615
address comments
YuzeLiao May 15, 2019
02a916d
return string copy in GetString()
YuzeLiao May 15, 2019
e903923
update document for DBMain
YuzeLiao May 15, 2019
991c9fe
minor fix
YuzeLiao May 15, 2019
44c9424
Merge branch 'master' into settings_manager
mbutrovich May 15, 2019
15773e6
Cleanup.
mbutrovich May 16, 2019
170ac87
Merge remote-tracking branch 'upstream/master' into settings_manager
mbutrovich May 20, 2019
3f7b3c6
Minor cleanups.
mbutrovich May 20, 2019
9a0365c
Merge remote-tracking branch 'upstream/master' into settings_manager
mbutrovich May 22, 2019
2990670
Fix GCC link order.
mbutrovich May 22, 2019
8a8a1e1
Enum cleanup. Remove settings brought over from Peloton that have no …
mbutrovich May 22, 2019
c9f5206
Consolidate logger initialization in one place.
mbutrovich May 22, 2019
b6d7792
Remove catalog interaction since the implementation is changing anyway.
mbutrovich May 22, 2019
16c3d18
Define an empty callback in transaction_util for internal transaction…
mbutrovich May 22, 2019
c249fce
Clean up memory leaks in DBMain.
mbutrovich May 22, 2019
5700953
Set debug logging interval in tests and main.
mbutrovich May 23, 2019
f2a1799
Fix double-free in settings_test after adding DBMain destructor.
mbutrovich May 23, 2019
5bc9e6a
More logic for reasoning about state of system during shut down.
mbutrovich May 23, 2019
a4a2504
Fix leak of buffer segment pool in DBMain.
mbutrovich May 23, 2019
a4cc5c8
Modify settings_test to use DBMain.
mbutrovich May 23, 2019
3829871
lint.
mbutrovich May 23, 2019
ce2af5a
Break SettingsManager callbacks out from DBMain.
mbutrovich May 24, 2019
447c4c0
Add settings_callbacks.h/.cpp.
mbutrovich May 24, 2019
5af2d5a
Define settings for buffer segment pool args and garbage collector th…
mbutrovich May 24, 2019
8e8e926
Remove buffer segment pool size stuff from Transaction Manager.
mbutrovich May 24, 2019
94bc483
Fix settings_test.
mbutrovich May 24, 2019
e0310ce
Merge remote-tracking branch 'upstream/master' into settings_manager
mbutrovich May 24, 2019
a2d957d
Initialize worker pool in DBMain, add setting for num worker threads …
mbutrovich May 24, 2019
3322310
Remove macro around test settings so Release unit tests work. Need to…
mbutrovich May 24, 2019
ce6f72b
Getters for SettingsManager changed to shared latch.
mbutrovich May 24, 2019
b9a6089
Remove test-only settings.
mbutrovich May 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -356,6 +356,7 @@ endif()
set(TERRIER_LINK_LIBS
${TERRIER_LINK_LIBS}
${PTHREAD_LIBRARY}
gflags
pg_query)

set(TERRIER_TEST_LINK_LIBS
Expand Down
3 changes: 2 additions & 1 deletion apidoc/Doxyfile.in
Expand Up @@ -831,7 +831,8 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = ../src/include/parser/parsenodes.h
EXCLUDE = ../src/include/parser/parsenodes.h \
../src/include/settings/settings_defs.h

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
1 change: 1 addition & 0 deletions build-support/clang_format_exclusions.txt
@@ -1 +1,2 @@
*third_party*
*/include/settings/settings_defs.h
1 change: 0 additions & 1 deletion src/catalog/settings_handle.cpp
Expand Up @@ -59,7 +59,6 @@ SqlTableHelper *SettingsCatalogTable::Create(transaction::TransactionContext *tx

// now actually create, with the provided schema
pg_settings->Create();
// catalog->AddToMaps(db_oid, pg_settings_oid, name, pg_settings);
return pg_settings;
}

Expand Down
9 changes: 9 additions & 0 deletions src/include/catalog/catalog_entry.h
Expand Up @@ -134,6 +134,15 @@ class CatalogEntry {
return (type::TransientValuePeeker::PeekVarChar(entry_[index]));
}

/**
* Set the value for a given column
* @param col_num the column index
* @param value the value of the column
*/
void SetColumn(int32_t col_num, const type::TransientValue &value) {
entry_[col_num] = type::TransientValueFactory::GetCopy(value);
}

/**
* Get oid, e.g. tablespace_oid_t, table_oid_t.
*/
Expand Down
21 changes: 21 additions & 0 deletions src/include/catalog/settings_handle.h
Expand Up @@ -102,4 +102,25 @@ class SettingsCatalogTable {
catalog::SqlTableHelper *pg_settings_;
};

enum class SettingsTableColumn {
mbutrovich marked this conversation as resolved.
Show resolved Hide resolved
OID = 0,
NAME = 1,
SETTING = 2,
UNIT = 3,
CATEGORY = 4,
SHORT_DESC = 5,
EXTRA_DESC = 6,
CONTEXT = 7,
VARTYPE = 8,
SOURCE = 9,
MIN_VAL = 10,
MAX_VAL = 11,
ENUMVALS = 12,
BOOT_VAL = 13,
RESET_VAL = 14,
SOURCEFILE = 15,
SOURCELINE = 16,
PENDING_RESTART = 17
};

} // namespace terrier::catalog
53 changes: 53 additions & 0 deletions src/include/common/action_context.h
@@ -0,0 +1,53 @@
#pragma once
#include <atomic>

namespace terrier::common {

/**
* All possible states of action.
*/
enum class ActionState {
INITIATED = 0,
IN_PROGRESS = 1,
SUCCESS = 2,
FAILURE = 3,
DEFERRED = 4,
};

/**
* ActionContext is used to keep track of action state and system behavior.
*/
class ActionContext {
DarkForte marked this conversation as resolved.
Show resolved Hide resolved
public:
ActionContext(const ActionContext &) = delete;

/**
* Constructor of ActionContext.
* @param action_id id of this action.
*/
explicit ActionContext(int32_t action_id) : action_id_(action_id), state_(ActionState ::INITIATED) {}

/**
* Get the state of this action.
* @return action state.
*/
ActionState GetState() { return state_.load(); }

/**
* Set the state of this action.
* @param state action state.
*/
void SetState(ActionState state) { state_.store(state); }

/**
* Get action id.
* @return action id.
*/
int32_t GetActionId() { return action_id_; }

private:
int32_t action_id_;
mbutrovich marked this conversation as resolved.
Show resolved Hide resolved
std::atomic<ActionState> state_;
};

} // namespace terrier::common
6 changes: 5 additions & 1 deletion src/include/common/exception.h
Expand Up @@ -16,11 +16,12 @@ namespace terrier {
#define CATALOG_EXCEPTION(msg) CatalogException(msg, __FILE__, __LINE__)
#define PARSER_EXCEPTION(msg) ParserException(msg, __FILE__, __LINE__)
#define NETWORK_PROCESS_EXCEPTION(msg) NetworkProcessException(msg, __FILE__, __LINE__)
#define SETTINGS_EXCEPTION(msg) SettingsException(msg, __FILE__, __LINE__)

/**
* Exception types
*/
enum class ExceptionType { RESERVED = 0, NOT_IMPLEMENTED = 1, CATALOG = 2, NETWORK = 3, PARSER = 4 };
enum class ExceptionType { RESERVED = 0, NOT_IMPLEMENTED = 1, CATALOG = 2, NETWORK = 3, PARSER = 4, SETTINGS = 5 };

/**
* Exception base class.
Expand Down Expand Up @@ -61,6 +62,8 @@ class Exception : public std::runtime_error {
return "Parser";
case ExceptionType::NETWORK:
return "Network";
case ExceptionType::SETTINGS:
return "Settings";
default:
return "Unknown exception type";
}
Expand Down Expand Up @@ -107,5 +110,6 @@ DEFINE_EXCEPTION(NotImplementedException, ExceptionType::NOT_IMPLEMENTED);
DEFINE_EXCEPTION(CatalogException, ExceptionType::CATALOG);
DEFINE_EXCEPTION(ParserException, ExceptionType::PARSER);
DEFINE_EXCEPTION(NetworkProcessException, ExceptionType::NETWORK);
DEFINE_EXCEPTION(SettingsException, ExceptionType::SETTINGS);

} // namespace terrier
6 changes: 6 additions & 0 deletions src/include/common/object_pool.h
Expand Up @@ -177,6 +177,12 @@ class ObjectPool {
}
}

/**
* Get the size limit of the object pool
* @return the size limit
*/
int64_t GetSizeLimit() const { return size_limit_; }

private:
Allocator alloc_;
SpinLatch latch_;
Expand Down
21 changes: 21 additions & 0 deletions src/include/loggers/settings_logger.h
@@ -0,0 +1,21 @@
#pragma once

#include <memory>
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/spdlog.h"

namespace terrier::settings {
extern std::shared_ptr<spdlog::logger> settings_logger;
YuzeLiao marked this conversation as resolved.
Show resolved Hide resolved

void init_settings_logger();
} // namespace terrier::settings

#define SETTINGS_LOG_TRACE(...) ::terrier::settings::settings_logger->trace(__VA_ARGS__);

#define SETTINGS_LOG_DEBUG(...) ::terrier::settings::settings_logger->debug(__VA_ARGS__);

#define SETTINGS_LOG_INFO(...) ::terrier::settings::settings_logger->info(__VA_ARGS__);

#define SETTINGS_LOG_WARN(...) ::terrier::settings::settings_logger->warn(__VA_ARGS__);

#define SETTINGS_LOG_ERROR(...) ::terrier::settings::settings_logger->error(__VA_ARGS__);
21 changes: 0 additions & 21 deletions src/include/loggers/type_logger.h

This file was deleted.

102 changes: 102 additions & 0 deletions src/include/main/db_main.h
@@ -0,0 +1,102 @@
#pragma once

#include <memory>
#include <unordered_map>
#include <utility>
#include "catalog/catalog.h"
#include "common/action_context.h"
#include "common/stat_registry.h"
#include "network/terrier_server.h"
#include "settings/settings_param.h"
#include "transaction/transaction_manager.h"

namespace terrier {

namespace settings {
class SettingsManager;
class SettingsTests;
} // namespace settings

/**
* The DBMain Class holds all the singleton pointers. It has the full knowledge
* of the whole database systems and serves as a global context of the system.
* *Only the settings manager should be able to access the DBMain object.*
*/
class DBMain {
DarkForte marked this conversation as resolved.
Show resolved Hide resolved
public:
DBMain() = default;

/**
* The constructor of DBMain
* @param param_map a map stores setting values
*/
explicit DBMain(std::unordered_map<settings::Param, settings::ParamInfo> &&param_map)
: param_map_(std::move(param_map)) {}

/**
* This function boots the backend components.
* It initializes the following components in the following order:
* SettingsManager
* Garbage Collector
* Catalog
* Worker Pool
* Logging
* Stats
*/
void Init();

/**
* Boots the traffic cop and networking layer, starts the server loop.
* It will block until server shuts down.
*/
void Run();

/**
* Shuts down the server.
* It is worth noting that in normal cases, terrier will shut down and return from Run().
* So, use this function only when you want to shutdown the server from code.
* For example, in the end of unit tests when you want to shut down your test server.
*/
void ForceShutdown();

// TODO(Weichen): Use unique ptr is enough.
/**
* Basic empty callbacks used by settings manager
* @param old_value the old value of corresponding setting
* @param new_value the new value of corresponding setting
* @param action_context action context for empty callback
*/
void EmptyCallback(void *old_value, void *new_value, const std::shared_ptr<common::ActionContext> &action_context);
YuzeLiao marked this conversation as resolved.
Show resolved Hide resolved

/**
* Buffer pool size callback used by settings manager
* @param old_value old value of buffer pool size
* @param new_value new value of buffer pool size
* @param action_context action context for changing buffer pool size
*/
void BufferPoolSizeCallback(void *old_value, void *new_value,
mbutrovich marked this conversation as resolved.
Show resolved Hide resolved
const std::shared_ptr<common::ActionContext> &action_context);

private:
friend class settings::SettingsManager;
friend class settings::SettingsTests;
DarkForte marked this conversation as resolved.
Show resolved Hide resolved
std::shared_ptr<common::StatisticsRegistry> main_stat_reg_;
std::unordered_map<settings::Param, settings::ParamInfo> param_map_;
YuzeLiao marked this conversation as resolved.
Show resolved Hide resolved
YuzeLiao marked this conversation as resolved.
Show resolved Hide resolved
transaction::TransactionManager *txn_manager_;
catalog::Catalog *catalog_;
settings::SettingsManager *settings_manager_;
network::TerrierServer server_;

/**
* Initializes all loggers.
* If you have a new logger to initialize, put it here.
*/
void InitLoggers();

/**
* Cleans up and exit.
*/
void CleanUp();
};

} // namespace terrier
1 change: 1 addition & 0 deletions src/include/settings/CPPLINT.cfg
@@ -0,0 +1 @@
exclude_files=settings_defs.h