Skip to content

Commit

Permalink
[Refactor] improve be ut & fix warn compile (StarRocks#39610)
Browse files Browse the repository at this point in the history
Why I'm doing:

improve two be ut that will cost too much time.
fix compile warn:
[ 99%] Built target Exprs
/root/starrocks/be/src/storage/primary_key_dump.cpp:183:21: warning: private field '_dump' is not used [-Wunused-private-field]
    PrimaryKeyDump* _dump;
                    ^
1 warning generated.

Signed-off-by: luohaha <18810541851@163.com>
  • Loading branch information
luohaha authored Jan 19, 2024
1 parent a0e766f commit 2f8697a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions be/src/storage/primary_key_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ Status PrimaryKeyDump::_dump_dcg() {

class PrimaryKeyChunkDumper {
public:
PrimaryKeyChunkDumper(PrimaryKeyDump* dump, PrimaryKeyColumnPB* pk_column_pb)
: _dump(dump), _pk_column_pb(pk_column_pb) {}
PrimaryKeyChunkDumper(PrimaryKeyColumnPB* pk_column_pb) : _pk_column_pb(pk_column_pb) {}
~PrimaryKeyChunkDumper() { (void)fs::delete_file(_tmp_file); }
Status init(const TabletSchemaCSPtr& tablet_schema, const std::string& tablet_path) {
_tmp_file = tablet_path + "/PrimaryKeyChunkDumper_" + std::to_string(static_cast<int64_t>(pthread_self()));
Expand Down Expand Up @@ -180,7 +179,6 @@ class PrimaryKeyChunkDumper {
}

private:
PrimaryKeyDump* _dump;
PrimaryKeyColumnPB* _pk_column_pb;
std::unique_ptr<SegmentWriter> _writer;
PagePointerPB _page;
Expand Down Expand Up @@ -258,7 +256,7 @@ Status PrimaryKeyDump::_dump_segment_keys() {
}
PrimaryKeyColumnPB pk_column_pb;
pk_column_pb.set_segment_id(rowset.second->rowset_meta()->get_rowset_seg_id() + i);
PrimaryKeyChunkDumper dumper(this, &pk_column_pb);
PrimaryKeyChunkDumper dumper(&pk_column_pb);
RETURN_IF_ERROR(dumper.init(pkey_tschema, _tablet->schema_hash_path()));
while (true) {
chunk->reset();
Expand Down
12 changes: 6 additions & 6 deletions be/test/storage/persistent_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,7 @@ TEST_P(PersistentIndexTest, test_bloom_filter_for_pindex) {
}

TEST_P(PersistentIndexTest, test_multi_l2_tmp_l1) {
config::l0_max_mem_usage = 1024;
config::l0_max_mem_usage = 50;
config::max_tmp_l1_num = 10;
FileSystem* fs = FileSystem::Default();
const std::string kPersistentIndexDir = "./PersistentIndexTest_test_multi_l2_tmp_l1";
Expand All @@ -1946,8 +1946,8 @@ TEST_P(PersistentIndexTest, test_multi_l2_tmp_l1) {

using Key = std::string;
PersistentIndexMetaPB index_meta;
const int N = 1000000;
const int wal_n = 200000;
const int N = 1000;
const int wal_n = 200;
int64_t cur_version = 0;
// insert
vector<Key> keys(N);
Expand Down Expand Up @@ -2266,7 +2266,7 @@ TEST_P(PersistentIndexTest, test_multi_l2_not_tmp_l1_fixlen) {
}

TEST_P(PersistentIndexTest, test_multi_l2_delete) {
config::l0_max_mem_usage = 1024;
config::l0_max_mem_usage = 50;
config::max_tmp_l1_num = 10;
FileSystem* fs = FileSystem::Default();
const std::string kPersistentIndexDir = "./PersistentIndexTest_test_multi_l2_delete";
Expand All @@ -2276,8 +2276,8 @@ TEST_P(PersistentIndexTest, test_multi_l2_delete) {

using Key = std::string;
PersistentIndexMetaPB index_meta;
const int N = 1000000;
const int DEL_N = 900000;
const int N = 1000;
const int DEL_N = 900;
int64_t cur_version = 0;
// insert
vector<Key> keys(N);
Expand Down

0 comments on commit 2f8697a

Please sign in to comment.