From e9c83664721944cbe49409833397f2c04b68ea19 Mon Sep 17 00:00:00 2001 From: Calvin Neo Date: Tue, 3 Sep 2024 11:15:06 +0800 Subject: [PATCH] Disagg: Add nullptr check on `S3LockLocalManager` (#9387) (#282) Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> --- dbms/src/Flash/Disaggregated/S3LockClient.cpp | 1 + dbms/src/Storages/Page/V3/Universal/S3LockLocalManager.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/dbms/src/Flash/Disaggregated/S3LockClient.cpp b/dbms/src/Flash/Disaggregated/S3LockClient.cpp index 541f225875a..0bab6faffc1 100644 --- a/dbms/src/Flash/Disaggregated/S3LockClient.cpp +++ b/dbms/src/Flash/Disaggregated/S3LockClient.cpp @@ -177,6 +177,7 @@ String S3LockClient::updateOwnerAddr(const Timepoint & deadline, const LoggerPtr using namespace std::chrono_literals; while (true) { + RUNTIME_CHECK(s3gc_owner != nullptr); auto owner_info = s3gc_owner->getOwnerID(); switch (owner_info.status) { diff --git a/dbms/src/Storages/Page/V3/Universal/S3LockLocalManager.cpp b/dbms/src/Storages/Page/V3/Universal/S3LockLocalManager.cpp index 400e75f59cf..153cbe2c955 100644 --- a/dbms/src/Storages/Page/V3/Universal/S3LockLocalManager.cpp +++ b/dbms/src/Storages/Page/V3/Universal/S3LockLocalManager.cpp @@ -96,6 +96,11 @@ std::optional S3LockLocalManager::initStore } s3lock_client = std::move(s3lock_client_); + if unlikely (s3lock_client == nullptr) + { + LOG_INFO(log, "S3 lock manager has null s3lock client"); + } + store_id = actual_store_id; LOG_INFO( @@ -223,6 +228,7 @@ String S3LockLocalManager::createS3Lock( } else { + RUNTIME_CHECK_MSG(s3lock_client, "S3 Lock Client is not initialized"); // Try to create a lock file for the data file created by another store. // e.g. Ingest some pages from CheckpointDataFile or DTFile when doing FAP, // send rpc to S3LockService