diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp index 1e23a0a19dd195..979a2ac1e9dc14 100644 --- a/be/src/olap/storage_engine.cpp +++ b/be/src/olap/storage_engine.cpp @@ -568,7 +568,8 @@ void StorageEngine::perform_base_compaction() { OLAPStatus res = base_compaction.init(best_tablet); if (res != OLAP_SUCCESS) { LOG(WARNING) << "failed to init base compaction." - << "tablet=" << best_tablet->full_name(); + << " tablet=" << best_tablet->full_name() + << " res=" << res; return; } diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp index 792454eb9a5c94..526c6400f58b2c 100755 --- a/be/src/olap/tablet_manager.cpp +++ b/be/src/olap/tablet_manager.cpp @@ -987,7 +987,8 @@ OLAPStatus TabletManager::start_trash_sweep() { OLAPStatus check_st = TabletMetaManager::get_header((*it)->data_dir(), (*it)->tablet_id(), (*it)->schema_hash(), new_tablet_meta); if (check_st == OLAP_SUCCESS) { - if (new_tablet_meta->tablet_state() != TABLET_SHUTDOWN) { + if (new_tablet_meta->tablet_state() != TABLET_SHUTDOWN + || new_tablet_meta->tablet_uid() != (*it)->tablet_uid()) { LOG(WARNING) << "tablet's state changed to normal, skip remove dirs" << " tablet id = " << new_tablet_meta->tablet_id() << " schema hash = " << new_tablet_meta->schema_hash() diff --git a/be/src/olap/txn_manager.cpp b/be/src/olap/txn_manager.cpp index 835ab6e2bc950c..b0a757a082effb 100755 --- a/be/src/olap/txn_manager.cpp +++ b/be/src/olap/txn_manager.cpp @@ -159,7 +159,8 @@ OLAPStatus TxnManager::commit_txn( LOG(INFO) << "find transaction exists when add to engine." << "partition_id: " << key.first << ", transaction_id: " << key.second - << ", tablet: " << tablet_info.to_string(); + << ", tablet: " << tablet_info.to_string() + << ", rowset_id: " << load_info.rowset->rowset_id(); return OLAP_SUCCESS; } else if (load_info.load_id.hi() == load_id.hi() && load_info.load_id.lo() == load_id.lo() @@ -169,7 +170,9 @@ OLAPStatus TxnManager::commit_txn( LOG(WARNING) << "find transaction exists when add to engine." << "partition_id: " << key.first << ", transaction_id: " << key.second - << ", tablet: " << tablet_info.to_string(); + << ", tablet: " << tablet_info.to_string() + << ", exist rowset_id: " << load_info.rowset->rowset_id() + << ", new rowset_id: " << rowset_ptr->rowset_id(); return OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST; } } diff --git a/be/src/util/uid_util.h b/be/src/util/uid_util.h index 67a5503ffb664d..6de5dd68af5c0e 100644 --- a/be/src/util/uid_util.h +++ b/be/src/util/uid_util.h @@ -104,6 +104,10 @@ struct UniqueId { return hi == rhs.hi && lo == rhs.lo; } + bool operator!=(const UniqueId& rhs) const { + return hi != rhs.hi || lo != rhs.lo; + } + TUniqueId to_thrift() const { TUniqueId tid; tid.__set_hi(hi); diff --git a/be/test/util/uid_util_test.cpp b/be/test/util/uid_util_test.cpp index e5c0e6977229dc..1b4b6dd3c89e6f 100644 --- a/be/test/util/uid_util_test.cpp +++ b/be/test/util/uid_util_test.cpp @@ -72,6 +72,22 @@ TEST_F(UidUtilTest, UniqueId) { UniqueId id2("002bdc546291f4b1", "015ee2a321ce7d15"); ASSERT_TRUE(id == id2); } + + { + TUniqueId tuid; + tuid.__set_hi(12345678987654321); + tuid.__set_lo(98765432123456789); + UniqueId id(tuid); + std::stringstream ss; + ss << id; + ASSERT_STREQ("002bdc546291f4b1:015ee2a321ce7d15", ss.str().c_str()); + UniqueId id2("002bdc546291f4b1", "015ee2a321ce7d15"); + ASSERT_TRUE(id == id2); + ASSERT_FALSE(id != id2); + UniqueId id3("002bdc546291f4b1", "015ee2a321ce7d16"); + ASSERT_TRUE(id != id3); + ASSERT_FALSE(id == id3); + } } TEST_F(UidUtilTest, Hash) {