You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/06/13 04:44:58 UTC
[incubator-doris] branch master updated: [Bug] fix uninitialized
member vars (#3848)
This is an automated email from the ASF dual-hosted git repository.
zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 38b6d29 [Bug] fix uninitialized member vars (#3848)
38b6d29 is described below
commit 38b6d291f1d47731df2787b0be82ffcee61052db
Author: HuangWei <hu...@xiaomi.com>
AuthorDate: Sat Jun 13 12:44:49 2020 +0800
[Bug] fix uninitialized member vars (#3848)
This fix is based on UBSAN unit test. So if we create & use class obj in a different way, may have runtime error: load of value XX, which is not a valid value for type 'YYY' warnings again.
Unit test should build in DEBUG or XXSAN mode(at lease DEBUG). RELEASE mode will add -DNDEBUG, turn off dchecks/asserts/debug.
---
be/src/olap/fs/block_manager.cpp | 2 --
be/src/olap/fs/block_manager.h | 6 +++---
be/src/olap/row_block.h | 2 +-
be/src/olap/tablet_schema.h | 20 +++++++++-----------
run-ut.sh | 2 +-
5 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/be/src/olap/fs/block_manager.cpp b/be/src/olap/fs/block_manager.cpp
index 84e8f6c..e5938ad 100644
--- a/be/src/olap/fs/block_manager.cpp
+++ b/be/src/olap/fs/block_manager.cpp
@@ -48,7 +48,5 @@ namespace fs {
// TODO(lingbin): move it to conf later, to allow adjust dynamicaly.
const std::string BlockManager::block_manager_preflush_control = "finalize";
-BlockManagerOptions::BlockManagerOptions() : read_only(false) {}
-
} // namespace fs
} // namespace doris
diff --git a/be/src/olap/fs/block_manager.h b/be/src/olap/fs/block_manager.h
index 4ca5a25..7e21f46 100644
--- a/be/src/olap/fs/block_manager.h
+++ b/be/src/olap/fs/block_manager.h
@@ -176,17 +176,17 @@ struct CreateBlockOptions {
// Block manager creation options.
struct BlockManagerOptions {
- BlockManagerOptions();
+ BlockManagerOptions() = default;
// The memory tracker under which all new memory trackers will be parented.
// If NULL, new memory trackers will be parented to the root tracker.
std::shared_ptr<MemTracker> parent_mem_tracker;
// If false, metrics will not be produced.
- bool enable_metric;
+ bool enable_metric = false;
// Whether the block manager should only allow reading. Defaults to false.
- bool read_only;
+ bool read_only = false;
};
// Utilities for Block lifecycle management. All methods are thread-safe.
diff --git a/be/src/olap/row_block.h b/be/src/olap/row_block.h
index a6aba7e..cb99128 100644
--- a/be/src/olap/row_block.h
+++ b/be/src/olap/row_block.h
@@ -39,7 +39,7 @@ struct RowBlockInfo {
uint32_t checksum;
uint32_t row_num; // block最大数据行数
- bool null_supported;
+ bool null_supported = false;
std::vector<uint32_t> column_ids;
};
diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index 33cf4e8..cdc826c 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -40,7 +40,7 @@ public:
inline bool is_key() const { return _is_key; }
inline bool is_nullable() const { return _is_nullable; }
inline bool is_bf_column() const { return _is_bf_column; }
- inline bool has_bitmap_index() const {return _has_bitmap_index; }
+ inline bool has_bitmap_index() const { return _has_bitmap_index; }
bool has_default_value() const { return _has_default_value; }
std::string default_value() const { return _default_value; }
bool has_reference_column() const { return _has_referenced_column; }
@@ -65,23 +65,23 @@ private:
int32_t _unique_id;
std::string _col_name;
FieldType _type;
- bool _is_key;
+ bool _is_key = false;
FieldAggregationMethod _aggregation;
- bool _is_nullable;
+ bool _is_nullable = false;
- bool _has_default_value;
+ bool _has_default_value = false;
std::string _default_value;
- bool _is_decimal;
+ bool _is_decimal = false;
int32_t _precision;
int32_t _frac;
int32_t _length;
int32_t _index_length;
- bool _is_bf_column;
+ bool _is_bf_column = false;
- bool _has_referenced_column;
+ bool _has_referenced_column = false;
int32_t _referenced_column_id;
std::string _referenced_column;
@@ -109,10 +109,8 @@ public:
inline CompressKind compress_kind() const { return _compress_kind; }
inline size_t next_column_unique_id() const { return _next_column_unique_id; }
inline double bloom_filter_fpp() const { return _bf_fpp; }
- inline bool is_in_memory() const {return _is_in_memory; }
- inline void set_is_in_memory (bool is_in_memory) {
- _is_in_memory = is_in_memory;
- }
+ inline bool is_in_memory() const { return _is_in_memory; }
+ inline void set_is_in_memory(bool is_in_memory) { _is_in_memory = is_in_memory; }
private:
friend bool operator==(const TabletSchema& a, const TabletSchema& b);
diff --git a/run-ut.sh b/run-ut.sh
index dca8eae..64e6324 100755
--- a/run-ut.sh
+++ b/run-ut.sh
@@ -89,7 +89,7 @@ fi
cd ${DORIS_HOME}/be/ut_build/
-${CMAKE_CMD} ../ -DWITH_MYSQL=OFF -DMAKE_TEST=ON
+${CMAKE_CMD} ../ -DWITH_MYSQL=OFF -DMAKE_TEST=ON -DCMAKE_BUILD_TYPE=DEBUG
make -j${PARALLEL}
if [ ${RUN} -ne 1 ]; then
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org