Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a fail point named force_change_all_blobs_to_read_only #4920

Merged
merged 4 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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