Skip to content

Commit

Permalink
Add a fail point named force_change_all_blobs_to_read_only (#4920)
Browse files Browse the repository at this point in the history
ref #3594
  • Loading branch information
jiaqizho authored May 20, 2022
1 parent 71613fd commit 1dfaced
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbms/src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ std::unordered_map<String, std::shared_ptr<FailPointChannel>> FailPointHelper::f
M(force_no_local_region_for_mpp_task) \
M(force_remote_read_for_batch_cop) \
M(force_context_path) \
M(force_slow_page_storage_snapshot_release)
M(force_slow_page_storage_snapshot_release) \
M(force_change_all_blobs_to_read_only)

#define APPLY_FOR_FAILPOINTS_ONCE_WITH_CHANNEL(M) \
M(pause_with_alter_locks_acquired) \
Expand Down
19 changes: 19 additions & 0 deletions dbms/src/Storages/Page/V3/BlobStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <Common/Checksum.h>
#include <Common/CurrentMetrics.h>
#include <Common/FailPoint.h>
#include <Common/Logger.h>
#include <Common/ProfileEvents.h>
#include <Common/StringUtils/StringUtils.h>
Expand Down Expand Up @@ -48,6 +49,11 @@ extern const int LOGICAL_ERROR;
extern const int CHECKSUM_DOESNT_MATCH;
} // namespace ErrorCodes

namespace FailPoints
{
extern const char force_change_all_blobs_to_read_only[];
} // namespace FailPoints

namespace PS::V3
{
static constexpr bool BLOBSTORE_CHECKSUM_ON_READ = true;
Expand Down Expand Up @@ -870,6 +876,19 @@ std::vector<BlobFileId> BlobStore::getGCStats()
std::vector<BlobFileId> blob_need_gc;
BlobStoreGCInfo blobstore_gc_info;

fiu_do_on(FailPoints::force_change_all_blobs_to_read_only,
{
for (const auto & [path, stats] : stats_list)
{
(void)path;
for (const auto & stat : stats)
{
stat->changeToReadOnly();
}
}
LOG_FMT_WARNING(log, "enabled force_change_all_blobs_to_read_only. All of BlobStat turn to READ-ONLY");
});

for (const auto & [path, stats] : stats_list)
{
(void)path;
Expand Down

0 comments on commit 1dfaced

Please sign in to comment.