Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tianmu): fix stonedb5.7 warnings. (#11) #945

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storage/tianmu/async_tests/task_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TaskExecutor {
auto task = std::make_unique<FuncTask<Func>>(std::move(func));
auto ret = task->get_future();
AddTask(std::move(task));
return std::move(ret);
return ret;
}

void Exit();
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/base/core/iostream_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline future<temporary_buffer<char>> data_source_impl::skip(uint64_t n) {
return get().then([&](temporary_buffer<char> buffer) -> std::experimental::optional<temporary_buffer<char>> {
if (buffer.size() >= n) {
buffer.trim_front(n);
return std::move(buffer);
return buffer;
}
n -= buffer.size();
return {};
Expand Down
1 change: 1 addition & 0 deletions storage/tianmu/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class TianmuError {
TianmuError(ErrorCode tianmu_error_code = ErrorCode::SUCCESS) : ec_(tianmu_error_code) {}
TianmuError(ErrorCode tianmu_error_code, std::string message) : ec_(tianmu_error_code), message_(message) {}
TianmuError(const TianmuError &tianmu_e) : ec_(tianmu_e.ec_), message_(tianmu_e.message_) {}
TianmuError &operator=(const TianmuError &) = default;
operator ErrorCode() { return ec_; }
ErrorCode GetErrorCode() { return ec_; }
bool operator==(ErrorCode tianmu_ec) { return tianmu_ec == ec_; }
Expand Down
8 changes: 5 additions & 3 deletions storage/tianmu/compress/part_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ void PartDict<T>::Create(DataSet<T> *dataset) {

template <class T>
int PartDict<T>::compare(const void *p1, const void *p2) {
using AK = struct PartDict<T>::HashTab::AKey;
if (((*(AK **)p1)->count) < ((*(AK **)p2)->count))
using AK = typename PartDict<T>::HashTab::AKey;
if ((*reinterpret_cast<AK **>(const_cast<void *>(p1)))->count <
(*reinterpret_cast<AK **>(const_cast<void *>(p2)))->count)
return 1;
else if (((*(AK **)p1)->count) > ((*(AK **)p2)->count))
else if ((*reinterpret_cast<AK **>(const_cast<void *>(p1)))->count >
(*reinterpret_cast<AK **>(const_cast<void *>(p2)))->count)
return -1;
else
return 0;
Expand Down
6 changes: 3 additions & 3 deletions storage/tianmu/compress/text_compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ CprsErr TextCompressor::CompressVer4(char *dest, int &dlen, char **index, const
}
pos += 4; // store size of encoded data

const int cmpBytes = LZ4_compress(srcdata.get(), dest + pos, length);
const int cmpBytes = LZ4_compress_default(srcdata.get(), dest + pos, length, dlen - pos);

if (cmpBytes <= 0 || cmpBytes > dlen - pos) {
TIANMU_LOG(LogCtl_Level::ERROR, "CompressVer4 error,cmpBytes: %d dlen - pos = %d", cmpBytes, dlen - pos);
Expand Down Expand Up @@ -451,7 +451,7 @@ CprsErr TextCompressor::CompressZlib(char *dest, int &dlen, char **index, const
uint64_t destlen = dlen - pos;
int ret = compress2(reinterpret_cast<Bytef *>(dest + pos), &destlen, srcdata.get(), srclen, Z_DEFAULT_COMPRESSION);
if (ret != Z_OK) {
TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %d, srclen %d, packlen %u", ret, destlen, srclen,
TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %lu, srclen %lu, packlen %u", ret, destlen, srclen,
packlen);
return CprsErr::CPRS_ERR_OTH;
}
Expand All @@ -470,7 +470,7 @@ CprsErr TextCompressor::DecompressZlib(char *dest, int dlen, char *src, int slen
const int ret =
uncompress(reinterpret_cast<Bytef *>(dest), &destlen, reinterpret_cast<const Bytef *>(src + spos), srclen);
if (ret != Z_OK) {
TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %d destlen = %d", ret, srclen, dlen);
TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %lu destlen = %d", ret, srclen, dlen);
return CprsErr::CPRS_ERR_OTH;
}
size_t sumlen = 0;
Expand Down
7 changes: 3 additions & 4 deletions storage/tianmu/core/aggregation_algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,9 +855,9 @@ void AggregationAlgorithm::TaskFillOutput(GroupByWrapper *gbw, Transaction *ci,
}
}

void AggregationWorkerEnt::TaskAggrePacks(MIIterator *taskIterator, [[maybe_unused]] DimensionVector *dims,
[[maybe_unused]] MIIterator *mit, [[maybe_unused]] CTask *task,
GroupByWrapper *gbw, Transaction *ci) {
void AggregationWorkerEnt::TaskAggrePacks(MIIterator *taskIterator, DimensionVector *dims [[maybe_unused]],
MIIterator *mit [[maybe_unused]], CTask *task [[maybe_unused]],
GroupByWrapper *gbw, Transaction *ci [[maybe_unused]]) {
taskIterator->Rewind();
int task_pack_num = 0;
while (taskIterator->IsValid()) {
Expand Down Expand Up @@ -918,7 +918,6 @@ void AggregationWorkerEnt::DistributeAggreTaskAverage(MIIterator &mit) {
pack2cur.emplace(std::pair<int, int>(packnum, curtuple_index));

int loopcnt = (packnum < m_threads) ? packnum : m_threads;
int mod = packnum % loopcnt;
int num = packnum / loopcnt;

utils::result_set<void> res;
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Column {
if (this != &c)
*this = c;
}

constexpr Column &operator=(const Column &) = default;
inline const ColumnType &Type() const { return ct; }
inline common::CT TypeName() const { return ct.GetTypeName(); }
inline void SetTypeName(common::CT type) { ct.SetTypeName(type); }
Expand Down
1 change: 0 additions & 1 deletion storage/tianmu/core/item_tianmu_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ bool Item_tianmufield::get_timeval(struct timeval *tm, int *warnings) {
bool Item_tianmufield::operator==(Item_tianmufield const &o) const { return (varID == o.varID); }

type_conversion_status Item_tianmufield::save_in_field_inner(Field *to, bool no_conversions) {
type_conversion_status res;
if ((null_value = buf->null)) {
null_value = 1;
return set_field_to_null_with_conversions(to, no_conversions);
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/joiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TwoDimensionalJoiner::~TwoDimensionalJoiner() {
}

JoinAlgType TwoDimensionalJoiner::ChooseJoinAlgorithm([[maybe_unused]] MultiIndex &mind, Condition &cond) {
auto choose_map_or_hash = ([&tianmu_sysvar_force_hashjoin, &cond] {
auto choose_map_or_hash = ([&cond] {
{
// do not use multithreaded hash join in case sp field
JoinAlgType join_type = JoinAlgType::JTYPE_NONE;
Expand Down
14 changes: 6 additions & 8 deletions storage/tianmu/core/joiner_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ void JoinerGeneral::ExecuteJoinConditions(Condition &cond) {
new_mind.Init(approx_size); // an initial size of IndexTable

int64_t tuples_in_output = 0;
bool loc_result;
bool stop_execution = false; // early stop for LIMIT

// The main loop for checking conditions

Expand Down Expand Up @@ -99,8 +97,9 @@ void JoinerGeneral::ExecuteJoinConditions(Condition &cond) {
// Handles each row in the Pack that the current iterator points to
// TODO: Keep in mind that internal Pack reads will have cache invalidation during multithread switching,
// leaving the second phase to continue processing the split of the house storage layer
void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task, Condition *cond, MINewContents *new_mind,
DimensionVector *all_dims, std::vector<bool> *_pack_desc_locked,
void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task [[maybe_unused]], Condition *cond,
MINewContents *new_mind, DimensionVector *all_dims,
std::vector<bool> *_pack_desc_locked [[maybe_unused]],
int64_t *tuples_in_output, int64_t limit, bool count_only,
bool *stop_execution, int64_t *rows_passed, int64_t *rows_omitted) {
std::scoped_lock guard(mtx);
Expand Down Expand Up @@ -173,7 +172,8 @@ void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task, Condit

// The purpose of this function is to process the split task in a separate thread
void JoinerGeneral::TaskInnerJoinPacks(MIIterator *taskIterator, CTask *task, Condition *cond, MINewContents *new_mind,
DimensionVector *all_dims, std::vector<bool> *pack_desc_locked_p,
DimensionVector *all_dims,
std::vector<bool> *pack_desc_locked_p [[maybe_unused]],
int64_t *tuples_in_output, int64_t limit, bool count_only, bool *stop_execution,
int64_t *rows_passed, int64_t *rows_omitted) {
int no_desc = (*cond).Size();
Expand Down Expand Up @@ -279,7 +279,7 @@ void JoinerGeneral::ExecuteInnerJoinLoopMultiThread(MIIterator &mit, Condition &

int packnum = 0;
while (mit.IsValid()) {
int64_t packrow_length = mit.GetPackSizeLeft();
int64_t packrow_length [[maybe_unused]] = mit.GetPackSizeLeft();
packnum++;
mit.NextPackrow();
}
Expand Down Expand Up @@ -333,9 +333,7 @@ void JoinerGeneral::ExecuteInnerJoinLoopMultiThread(MIIterator &mit, Condition &

int64_t rows_passed = 0;
int64_t rows_omitted = 0;
int no_desc = cond.Size();
bool stop_execution = false;
int index = 0;

mit.Rewind();

Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/joiner_mapped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ std::unique_ptr<JoinerMapFunction> JoinerMapped::GenerateFunction(vcolumn::Virtu

rc_control_.lock(m_conn->GetThreadID())
<< "Join mapping (multimaps) created on " << mit.NumOfTuples() << " rows." << system::unlock;
return std::move(map_function);
return map_function;
}

int64_t JoinerParallelMapped::ExecuteMatchLoop(std::shared_ptr<MultiIndexBuilder::BuildItem> *indextable,
Expand Down
1 change: 1 addition & 0 deletions storage/tianmu/core/mi_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ class MIInpackIterator : public MIIterator {
public:
MIInpackIterator(const MIIterator &sec) : MIIterator(sec) {}
MIInpackIterator() : MIIterator() {}
MIInpackIterator(const MIInpackIterator &) = default;
void swap(MIInpackIterator &i);
MIInpackIterator &operator=(const MIInpackIterator &m) {
MIInpackIterator tmp(m);
Expand Down
8 changes: 4 additions & 4 deletions storage/tianmu/core/parameterized_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,12 +1018,12 @@ void ParameterizedFilter::UpdateMultiIndex(bool count_only, int64_t limit) {
It needs to be increased according to the number of executions.
*/
int no_dims = 0;
for (int tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) {
for (uint tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) {
auto rcTable = rcTables[tableIndex];
if (rcTable->TableType() == TType::TEMP_TABLE)
continue;
bool isVald = false;
for (int i = 0; i < descriptors.Size(); i++) {
for (uint i = 0; i < descriptors.Size(); i++) {
Descriptor &desc = descriptors[i];
/*The number of values in the (var_map) corresponding to the entity column is always 1,
so only the first element in the (var_map) is judged here.*/
Expand Down Expand Up @@ -1516,7 +1516,7 @@ void ParameterizedFilter::TaskProcessPacks(MIUpdatingIterator *taskIterator, Tra
taskIterator->Commit(false);
}

void ParameterizedFilter::FilterDeletedByTable(JustATable *rcTable, int &no_dims, int &tableIndex) {
void ParameterizedFilter::FilterDeletedByTable(JustATable *rcTable, int &no_dims, int tableIndex) {
Descriptor desc(table, no_dims);
desc.op = common::Operator::O_EQ_ALL;
desc.encoded = true;
Expand Down Expand Up @@ -1550,7 +1550,7 @@ void ParameterizedFilter::FilterDeletedForSelectAll() {
if (table) {
auto &rcTables = table->GetTables();
int no_dims = 0;
for (int tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) {
for (uint tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) {
auto rcTable = rcTables[tableIndex];
if (rcTable->TableType() == TType::TEMP_TABLE)
continue;
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/parameterized_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ParameterizedFilter final {
void TaskProcessPacks(MIUpdatingIterator *taskIterator, Transaction *ci, common::RSValue *rf, DimensionVector *dims,
int desc_number, int64_t limit, int one_dim);

void FilterDeletedByTable(JustATable *rcTable, int &no_dims, int &tableIndex);
void FilterDeletedByTable(JustATable *rcTable, int &no_dims, int tableIndex);
void FilterDeletedForSelectAll();

MultiIndex *mind;
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/proxy_hash_joiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class MIIteratorPoller {
no_more_ = true;
}

return std::move(pack_iter);
return pack_iter;
}

private:
Expand Down
7 changes: 3 additions & 4 deletions storage/tianmu/core/query_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,7 @@ QueryRouteTo Query::Compile(CompiledQuery *compiled_query, SELECT_LEX *selects_l
SetLimit(sl, sl == selects_list ? 0 : sl->join->unit->global_parameters(), offset_value, limit_value);
List<Item> *fields = &sl->fields_list;

Item *conds =
(ifNewJoinForTianmu || !sl->join->where_cond) ? conds = sl->where_cond() : conds = sl->join->where_cond;
Item *conds = (ifNewJoinForTianmu || !sl->join->where_cond) ? sl->where_cond() : sl->join->where_cond;

ORDER *order = sl->order_list.first;

Expand Down Expand Up @@ -1199,9 +1198,9 @@ JoinType Query::GetJoinTypeAndCheckExpr(uint outer_join, Item *on_expr) {
}

bool Query::IsLOJ(List<TABLE_LIST> *join) {
TABLE_LIST *join_ptr;
TABLE_LIST *join_ptr{nullptr};
List_iterator<TABLE_LIST> li(*join);
while (join_ptr = li++) {
while ((join_ptr = li++)) {
JoinType join_type = GetJoinTypeAndCheckExpr(join_ptr->outer_join, join_ptr->join_cond());
if (join_ptr->join_cond() && (join_type == JoinType::JO_LEFT || join_type == JoinType::JO_RIGHT))
return true;
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/task_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TaskExecutor {
auto task = std::make_unique<FuncTask<Func>>(std::move(func));
auto ret = task->get_future();
AddTask(std::move(task));
return std::move(ret);
return ret;
}

void Exit();
Expand Down
2 changes: 2 additions & 0 deletions storage/tianmu/core/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ class TOCoordinate {
co.rcattr = _t.co.rcattr;
}

TOCoordinate &operator=(const TOCoordinate &) = default;

bool operator==(TOCoordinate const &oid) const {
if (oid.ID != ID)
return false;
Expand Down
5 changes: 4 additions & 1 deletion storage/tianmu/core/value_matching_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class ValueMatchingTable { // abstract class: interface for value matching
// already exists, false if put as a new row
virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new = true) = 0;

virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new, int match_width) {
virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new,
int match_width [[maybe_unused]]) {
return FindCurrentRow(input_buffer, row, add_if_new);
};

Expand Down Expand Up @@ -103,6 +104,7 @@ class ValueMatchingTable { // abstract class: interface for value matching

class ValueMatching_OnePosition : public ValueMatchingTable {
public:
using ValueMatchingTable::FindCurrentRow;
ValueMatching_OnePosition();
ValueMatching_OnePosition(ValueMatching_OnePosition &sec);
virtual ~ValueMatching_OnePosition();
Expand Down Expand Up @@ -136,6 +138,7 @@ class ValueMatching_OnePosition : public ValueMatchingTable {

class ValueMatching_LookupTable : public mm::TraceableObject, public ValueMatchingTable {
public:
using ValueMatchingTable::FindCurrentRow;
ValueMatching_LookupTable();
ValueMatching_LookupTable(ValueMatching_LookupTable &sec);
virtual ~ValueMatching_LookupTable();
Expand Down
3 changes: 2 additions & 1 deletion storage/tianmu/index/rc_table_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ common::ErrorCode RCTableIndex::UpdateIndex(core::Transaction *tx, std::string_v
return rc;
}

common::ErrorCode RCTableIndex::DeleteIndex(core::Transaction *tx, std::string_view &currentRowKey, uint64_t row) {
common::ErrorCode RCTableIndex::DeleteIndex(core::Transaction *tx, std::string_view &currentRowKey,
uint64_t row [[maybe_unused]]) {
StringWriter value, packkey;
std::vector<std::string_view> fields;

Expand Down
4 changes: 2 additions & 2 deletions storage/tianmu/index/rdb_meta_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
namespace Tianmu {
namespace index {

RdbKey::RdbKey(uint pos, uint keyno, rocksdb::ColumnFamilyHandle *cf_handle, uint16_t index_ver, uchar index_type,
bool is_reverse_cf, const char *_name, std::vector<ColAttr> &cols)
RdbKey::RdbKey(uint pos, uint keyno [[maybe_unused]], rocksdb::ColumnFamilyHandle *cf_handle, uint16_t index_ver,
uchar index_type, bool is_reverse_cf, const char *_name, std::vector<ColAttr> &cols)
: index_pos_(pos),
cf_handle_(cf_handle),
index_ver_(index_ver),
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/mm/tcm/tccommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void SizeMap::Init() {
// Initialize the mapping arrays
int next_size = 0;
for (size_t c = 1; c < kNumClasses; c++) {
const int max_size_in_class = (const int)class_to_size_[c];
int max_size_in_class = static_cast<int>(class_to_size_[c]);
for (int s = next_size; s <= max_size_in_class; s += kAlignment) {
class_array_[ClassIndex(s)] = c;
}
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/system/cacheable_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ CacheableItem::CacheableItem(char const *owner_name, char const *object_id, int
filename_offset = temp_filename.length();

// fill the file name
int i = 0, j = 0;
size_t i = 0, j = 0;

while (owner_name[j] != 0 && i < kOwnerAndObjectLen) file_name_[filename_offset + (i++)] = owner_name[j++];
while (i < kMinOwnerNameLen) file_name_[filename_offset + (i++)] = '_';
Expand Down
Loading