Skip to content

Commit

Permalink
fix testcase2
Browse files Browse the repository at this point in the history
  • Loading branch information
justfortaste committed Dec 5, 2024
1 parent e2e27a9 commit e034f1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions be/src/olap/snapshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ Status SnapshotManager::make_snapshot(const TSnapshotRequest& request, string* s
return Status::Error<INVALID_ARGUMENT>("output parameter cannot be null");
}

TabletSharedPtr target_tablet = _engine.tablet_manager()->get_tablet(request.tablet_id);

DBUG_EXECUTE_IF("SnapshotManager::make_snapshot.inject_failure", { target_tablet = nullptr; })

DBUG_EXECUTE_IF("SnapshotManager::make_snapshot.wait", {
auto tablet_id = dp->param<int64>("tablet_id", -1);
if (tablet_id != -1 && tablet_id == request.tablet_id) {
LOG(INFO) << "Debug: SnapshotManager::make_snapshot.wait";
LOG(INFO) << "Debug: SnapshotManager::make_snapshot.wait table_id:" << tablet_id;
for (int i = 0; i < 1000; i++) {
if (_engine.tablet_manager()->get_tablet(request.tablet_id) == nullptr) {
TabletSharedPtr tablet = _engine.tablet_manager()->get_tablet(request.tablet_id);
if (tablet == nullptr || tablet->num_rows() == 0) {
target_tablet = nullptr;
sleep(3);
break;
}
Expand All @@ -96,10 +102,6 @@ Status SnapshotManager::make_snapshot(const TSnapshotRequest& request, string* s
}
});

TabletSharedPtr target_tablet = _engine.tablet_manager()->get_tablet(request.tablet_id);

DBUG_EXECUTE_IF("SnapshotManager::make_snapshot.inject_failure", { target_tablet = nullptr; })

if (target_tablet == nullptr) {
return Status::Error<TABLE_NOT_FOUND>("failed to get tablet. tablet={}", request.tablet_id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ suite("test_backup_with_ddl") {
def tableName = "test_backup_with_ddl"
String dbName = "test_backup_with_ddl_db"

sql """
ADMIN SET FRONTEND CONFIG ("catalog_trash_expire_second" = "10");
"""

def insert_num = 5

sql "DROP DATABASE IF EXISTS ${dbName}"
Expand Down Expand Up @@ -101,7 +105,7 @@ suite("test_backup_with_ddl") {
assertEquals(res.size(), 0)

// wait backup canceled, failed to get tablet
count = 100 // 200s
count = 1000 // 2000s
def found = 0
for (int i = 0; i < count; ++i) {
def records = sql_return_maparray "SHOW BACKUP FROM ${dbName}"
Expand Down

0 comments on commit e034f1d

Please sign in to comment.