Commit 541eb94f authored by Philipp Götze's avatar Philipp Götze
Browse files

🛠 little fixes and additions

parent 46483791
...@@ -331,7 +331,7 @@ class PTable { ...@@ -331,7 +331,7 @@ class PTable {
if (needsSplit) { if (needsSplit) {
PLOG("Need to split for tuple: " << rec); PLOG("Need to split for tuple: " << rec);
try { try {
auto pop = pool_by_vptr(this); auto pop = pool_by_pptr(root);
std::pair < DataNodePtr, DataNodePtr > newNodes; std::pair < DataNodePtr, DataNodePtr > newNodes;
if (pmemobj_tx_stage() == TX_STAGE_NONE) if (pmemobj_tx_stage() == TX_STAGE_NONE)
transaction::exec_tx(pop, [&] { newNodes = splitBlock(targetNode); }); transaction::exec_tx(pop, [&] { newNodes = splitBlock(targetNode); });
...@@ -1128,7 +1128,7 @@ class PTable { ...@@ -1128,7 +1128,7 @@ class PTable {
auto splitNode = node; auto splitNode = node;
/* Loop for special case where multiple nodes share the same bdcc value */ /* Loop for special case where multiple nodes share the same bdcc value */
while (bdcc_min == bdcc_max && !enoughSpace) { while (bdcc_min == bdcc_max && !enoughSpace && splitNode->next != nullptr) {
splitNode = splitNode->next; splitNode = splitNode->next;
bdcc_min = reinterpret_cast<const uint32_t &>(splitNode->block.get_ro()[gBDCCRangePos1]); bdcc_min = reinterpret_cast<const uint32_t &>(splitNode->block.get_ro()[gBDCCRangePos1]);
bdcc_max = reinterpret_cast<const uint32_t &>(splitNode->block.get_ro()[gBDCCRangePos2]); bdcc_max = reinterpret_cast<const uint32_t &>(splitNode->block.get_ro()[gBDCCRangePos2]);
......
...@@ -30,12 +30,16 @@ enum ColumnType { Void_Type, Int_Type, Double_Type, String_Type }; ...@@ -30,12 +30,16 @@ enum ColumnType { Void_Type, Int_Type, Double_Type, String_Type };
using Column = std::pair<std::string, ColumnType>; using Column = std::pair<std::string, ColumnType>;
using ColumnInitList = std::initializer_list<Column>; using ColumnInitList = std::initializer_list<Column>;
using ColumnIterator = std::vector<Column>::const_iterator; using ColumnVector = std::vector<Column>;
using ColumnIterator = ColumnVector::const_iterator;
struct VTableInfo { struct VTableInfo {
VTableInfo() {} VTableInfo() {}
VTableInfo(const std::string &_name, ColumnVector _columns, ColumnType _keyType = Void_Type) :
name(_name), columns(_columns), keyType(_keyType) {}
VTableInfo(const std::string &_name, ColumnInitList _columns, ColumnType _keyType = Void_Type) : VTableInfo(const std::string &_name, ColumnInitList _columns, ColumnType _keyType = Void_Type) :
name(_name), columns(_columns), keyType(_keyType) {} name(_name), columns(_columns), keyType(_keyType) {}
...@@ -43,7 +47,7 @@ struct VTableInfo { ...@@ -43,7 +47,7 @@ struct VTableInfo {
ColumnIterator end() const { return columns.end(); } ColumnIterator end() const { return columns.end(); }
std::string name; std::string name;
std::vector<Column> columns; ColumnVector columns;
ColumnType keyType; ColumnType keyType;
}; };
......
...@@ -66,12 +66,12 @@ void print(std::ostream &os, const std::tuple<Args...> &t) { ...@@ -66,12 +66,12 @@ void print(std::ostream &os, const std::tuple<Args...> &t) {
os << ")\n"; os << ")\n";
} }
} /* namespace ptable */
template<typename... Types> template<typename... Types>
std::ostream &operator<<(std::ostream &os, std::tuple<Types...> tp) { std::ostream &operator<<(std::ostream &os, std::tuple<Types...> tp) {
ptable::print(os, tp); ptable::print(os, tp);
return os; return os;
} }
#endif /* utils_hpp_ */ } /* namespace ptable */
\ No newline at end of file
#endif /* utils_hpp_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment