Skip to content

Commit

Permalink
add some comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu committed Aug 11, 2022
1 parent adc7b4c commit b2680db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dbms/src/Storages/Page/V3/BlobStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ void BlobStore::registerPaths()

void BlobStore::reloadConfig(const BlobStore::Config & rhs)
{
config.file_limit_size = rhs.file_limit_size;
/// Don't reload config.file_limit_size here. Because there may be a potential race between write thread and gc thread.
/// For write thread, it will ignore all BlobFile which capacity is larger than config.file_limit_size.
/// For gc thread, if the contents of a BlobFile with capacity larger than config.file_limit_size is all removed, it will remove the BlobFile.
/// So if you reload config.file_limit_size will a larger value,
/// the write thread may see the change and select a BlobFile which capacity is larger than old config.file_limit_size but smaller than new value for write,
/// but the gc thread may not see the change and still think the BlobFile's capacity is larger than config.file_limit_size and remove it if all its contents has been removed.
/// And this may cause data lose.
// config.file_limit_size = rhs.file_limit_size;
config.spacemap_type = rhs.spacemap_type;
config.cached_fd_size = rhs.cached_fd_size;
config.block_alignment_bytes = rhs.block_alignment_bytes;
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/Page/V3/BlobStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ class BlobStore : private Allocator<false>
const WriteLimiterPtr & write_limiter = nullptr,
const ReadLimiterPtr & read_limiter = nullptr);

PageEntriesEdit handleLargeWrite(DB::WriteBatch & wb, const WriteLimiterPtr & write_limiter = nullptr);

PageEntriesEdit write(DB::WriteBatch & wb, const WriteLimiterPtr & write_limiter = nullptr);

void remove(const PageEntriesV3 & del_entries);
Expand Down Expand Up @@ -307,6 +305,8 @@ class BlobStore : private Allocator<false>
private:
#endif

PageEntriesEdit handleLargeWrite(DB::WriteBatch & wb, const WriteLimiterPtr & write_limiter = nullptr);

PSDiskDelegatorPtr delegator;

FileProviderPtr file_provider;
Expand Down

0 comments on commit b2680db

Please sign in to comment.