Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
hust-hhb committed Nov 29, 2024
1 parent 046088e commit ca6b570
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 35 deletions.
10 changes: 5 additions & 5 deletions be/src/http/action/delete_bitmap_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static Status _check_param(HttpRequest* req, uint64_t* tablet_id) {
}

Status DeleteBitmapAction::_handle_show_local_delete_bitmap_count(HttpRequest* req,
std::string* json_result) {
std::string* json_result) {
uint64_t tablet_id = 0;
// check & retrieve tablet_id from req if it contains
RETURN_NOT_OK_STATUS_WITH_WARN(_check_param(req, &tablet_id), "check param failed");
Expand Down Expand Up @@ -119,22 +119,22 @@ Status DeleteBitmapAction::_handle_show_local_delete_bitmap_count(HttpRequest* r
}

Status DeleteBitmapAction::_handle_show_ms_delete_bitmap_count(HttpRequest* req,
std::string* json_result) {
std::string* json_result) {
uint64_t tablet_id = 0;
// check & retrieve tablet_id from req if it contains
RETURN_NOT_OK_STATUS_WITH_WARN(_check_param(req, &tablet_id), "check param failed");
if (tablet_id == 0) {
return Status::InternalError("check param failed: missing tablet_id");
}
TabletMetaSharedPtr tablet_meta;
auto st = _engine.meta_mgr().get_tablet_meta(tablet_id, &tablet_meta);
auto st = _engine.to_cloud().meta_mgr().get_tablet_meta(tablet_id, &tablet_meta);
if (!st.ok()) {
LOG(WARNING) << "failed to get_tablet_meta tablet=" << tablet_id
<< ", st=" << st.to_string();
return st;
}
auto tablet = std::make_shared<CloudTablet>(_engine, std::move(tablet_meta));
st = _engine.meta_mgr().sync_tablet_rowsets(tablet.get(), false, true, true);
auto tablet = std::make_shared<CloudTablet>(_engine.to_cloud(), std::move(tablet_meta));
st = _engine.to_cloud().meta_mgr().sync_tablet_rowsets(tablet.get(), false, true, true);
if (!st.ok()) {
LOG(WARNING) << "failed to sync tablet=" << tablet_id << ", st=" << st;
return st;
Expand Down
2 changes: 1 addition & 1 deletion be/src/service/http_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void HttpService::register_local_handler(StorageEngine& engine) {
run_status_compaction_action);

DeleteBitmapAction* count_delete_bitmap_action =
_pool.add(new DeleteBitmapAction(DeleteBitmapActionType::COUNT_INFO, _env, engine,
_pool.add(new DeleteBitmapAction(DeleteBitmapActionType::COUNT_LOCAL, _env, engine,
TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN));
_ev_http_server->register_handler(HttpMethod::GET, "/api/delete_bitmap/count_local",
count_delete_bitmap_action);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ suite("test_cu_compaction_remove_old_version_delete_bitmap", "nonConcurrent") {
def timeout = 10000
sql """ DROP TABLE IF EXISTS ${testTable}"""
def testTableDDL = """
create table ${testTable}
create table ${testTable}
(
`plan_id` bigint(20) NOT NULL,
`target_id` int(20) NOT NULL,
Expand Down Expand Up @@ -216,18 +216,20 @@ suite("test_cu_compaction_remove_old_version_delete_bitmap", "nonConcurrent") {

// before compaction, delete_bitmap_count is (rowsets num - 1)
local_delete_bitmap_count = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
assertTrue(local_delete_bitmap_count == 7)
assertTrue(local_delete_bitmap_count == ms_delete_bitmap_count)

local_delete_bitmap_cardinality = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("local_delete_bitmap_cardinality:" + local_delete_bitmap_cardinality)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(local_delete_bitmap_count == 7)
assertTrue(local_delete_bitmap_cardinality == 7)
assertTrue(local_delete_bitmap_cardinality == ms_delete_bitmap_cardinality)

if (isCloudMode()) {
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(ms_delete_bitmap_count == 7)
assertTrue(ms_delete_bitmap_cardinality == 7)
}


assertTrue(triggerCompaction(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id],
Expand Down Expand Up @@ -262,18 +264,20 @@ suite("test_cu_compaction_remove_old_version_delete_bitmap", "nonConcurrent") {
// before compaction, local delete_bitmap_count is (total rowsets num - 1), ms delete_bitmap_count is new rowset num
String trigger_backend_id = tablet.BackendId
local_delete_bitmap_count = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
assertTrue(local_delete_bitmap_count == 12)
assertTrue(ms_delete_bitmap_count == 5)

local_delete_bitmap_cardinality = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("local_delete_bitmap_cardinality:" + local_delete_bitmap_cardinality)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(local_delete_bitmap_count == 12)
assertTrue(local_delete_bitmap_cardinality == 17)
assertTrue(ms_delete_bitmap_cardinality == 10)

if (isCloudMode()) {
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(ms_delete_bitmap_count == 5)
assertTrue(ms_delete_bitmap_cardinality == 10)
}

getTabletStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id);
assertTrue(triggerCompaction(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id],
Expand All @@ -282,20 +286,21 @@ suite("test_cu_compaction_remove_old_version_delete_bitmap", "nonConcurrent") {
getTabletStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id);

Thread.sleep(1000)
// after compaction, delete_bitmap_count is 1
// after compaction, delete_bitmap_count is 1, cardinality is 2, check it
local_delete_bitmap_count = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
assertTrue(local_delete_bitmap_count == 1)
assertTrue(local_delete_bitmap_count == ms_delete_bitmap_count)

local_delete_bitmap_cardinality = getLocalDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("local_delete_bitmap_count:" + local_delete_bitmap_count)
logger.info("local_delete_bitmap_cardinality:" + local_delete_bitmap_cardinality)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(local_delete_bitmap_count == 1)
assertTrue(local_delete_bitmap_cardinality == 2)
assertTrue(ms_delete_bitmap_cardinality == 2)
if (isCloudMode()) {
ms_delete_bitmap_count = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).delete_bitmap_count
ms_delete_bitmap_cardinality = getMSDeleteBitmapStatus(backendId_to_backendIP[trigger_backend_id], backendId_to_backendHttpPort[trigger_backend_id], tablet_id).cardinality
logger.info("ms_delete_bitmap_count:" + ms_delete_bitmap_count)
logger.info("ms_delete_bitmap_cardinality:" + ms_delete_bitmap_cardinality)
assertTrue(ms_delete_bitmap_count == 1)
assertTrue(ms_delete_bitmap_cardinality == 2)
}
}

qt_sql "select * from ${testTable} order by plan_id"
Expand Down

0 comments on commit ca6b570

Please sign in to comment.