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

[FLASH-318/319/343/344] PageStorage: RefPages, MVCC && Snapshot read #97

Merged
merged 65 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
123a5fe
Page storage bug fix (#87)
JaySon-Huang Jun 24, 2019
1b3c96e
add RefPage && ref counting
JaySon-Huang Jun 24, 2019
dd13fe7
1. move PageCacheMap into isolated file
JaySon-Huang Jun 24, 2019
47bede1
accept non-exist Page reference/del while being used by WriteBatch or Gc
JaySon-Huang Jun 25, 2019
7ade6e7
adjust gc on RefPages
JaySon-Huang Jun 25, 2019
5b318bd
add more test on gc RefPages
JaySon-Huang Jun 26, 2019
6d736b2
add memory usage comparing between vec/hashmap/treemap
JaySon-Huang Jun 27, 2019
453f7c3
fix tests code format
JaySon-Huang Jul 16, 2019
3c87bd0
Bug fix: Add RefPage to non exist Page
JaySon-Huang Jul 16, 2019
6f07641
Add unit test for PageStorage
JaySon-Huang Jul 16, 2019
1e5cc1d
fix bug
JaySon-Huang Jul 16, 2019
c57f51f
stress test for benchmark
JaySon-Huang Jul 16, 2019
424a4d2
fix bug of PageEntryMap updating RefPage
JaySon-Huang Jul 24, 2019
d49b79c
Keep RefPage entry ref-count if it has been gc and move to another place
JaySon-Huang Jul 25, 2019
62197f1
MVCC on PageMap, All previse tests passed. TODO: refactor on read_mut…
JaySon-Huang Jun 27, 2019
79235e7
PageStorage gc: only delete file that are not used by any version
JaySon-Huang Jun 28, 2019
7bcea70
fix bug under multi-threads;
JaySon-Huang Jul 3, 2019
547a82e
1. support snapshot read
JaySon-Huang Jul 8, 2019
5294020
add test for PageStorage snapshot read
JaySon-Huang Jul 10, 2019
ddbece0
use typed test
JaySon-Huang Jul 10, 2019
2a8b6a9
Bug fix: Add RefPage to non exist Page
JaySon-Huang Jul 11, 2019
5d8fa24
fix bug
JaySon-Huang Jul 16, 2019
b342dcb
1. Apply merge delta if no read ref
JaySon-Huang Jul 10, 2019
1d8bf59
Delta merged when view is finished
JaySon-Huang Jul 17, 2019
af3b020
1. VersionDeltaSet: add snapshots for snapshot linked-list, so that g…
JaySon-Huang Jul 18, 2019
385a781
do compact on delta -> base
JaySon-Huang Jul 19, 2019
4c62515
rebase after do compact on delta
JaySon-Huang Jul 19, 2019
2e87e20
fix bugs
JaySon-Huang Jul 22, 2019
852534f
avoid duplicted codes
JaySon-Huang Jul 22, 2019
5445a0a
1. new find API
JaySon-Huang Jul 23, 2019
2ca8954
1. remove legacy API
JaySon-Huang Jul 23, 2019
4b0de77
reformat
JaySon-Huang Jul 23, 2019
63334e2
apply inplace if there are no readers
JaySon-Huang Jul 23, 2019
8c7c682
fix bug of applying edits
JaySon-Huang Jul 24, 2019
330c687
fix bug of gc apply
JaySon-Huang Jul 24, 2019
ae34921
fix bug of merging PageEntryMap
JaySon-Huang Jul 24, 2019
2dca931
fix bug of invalid ref page
JaySon-Huang Jul 24, 2019
3c771c0
fix bug:
JaySon-Huang Jul 24, 2019
a54342a
fixbug
JaySon-Huang Jul 24, 2019
0df4438
tmp
JaySon-Huang Jul 24, 2019
f09ec26
split PageEntryMapView to single cpp file
JaySon-Huang Jul 24, 2019
92d0aef
minor fix
JaySon-Huang Jul 25, 2019
7ac88d7
1. Avoid visit same version multiple time in PageEntryMapDeltaVersion…
JaySon-Huang Jul 25, 2019
2d13ba5
todo mark
JaySon-Huang Jul 25, 2019
e062f94
fix bug: RefPage -> RefPage record may become invalid record when Pag…
JaySon-Huang Jul 25, 2019
03c8ddf
Merge branch 'jayson/PS_RefPages' into jayson/PS_delta_version
JaySon-Huang Jul 25, 2019
f09e977
remove unused function
JaySon-Huang Jul 25, 2019
4950136
simple fix on unittest
JaySon-Huang Jul 25, 2019
56d45d2
fix bug: PageEntryMapView::isRefId
JaySon-Huang Jul 26, 2019
a809888
fix bug: PageEntryMapDeltaBuilder::applyPut
JaySon-Huang Jul 26, 2019
e491382
fix
JaySon-Huang Jul 26, 2019
cf1646a
Merge branch 'jayson/PS_RefPages' into jayson/PS_delta_version
JaySon-Huang Jul 29, 2019
fd0ecdb
fix bug: PageEntryView::validNormalPageIds filter out tombstone of Pa…
JaySon-Huang Jul 29, 2019
cd9705e
iterator over PageEntryMap
JaySon-Huang Jul 30, 2019
6e6dfc1
remove unused tests
JaySon-Huang Jul 30, 2019
ce560c4
Refactor on PageEntryMapDeltaVersionSet
JaySon-Huang Jul 31, 2019
b5ed764
Reduce lock range when PageStorage Snapshot is release
JaySon-Huang Jul 31, 2019
d7fd1f4
Add metrics for PageStorage MVCC
JaySon-Huang Aug 1, 2019
960a702
rename some classes
JaySon-Huang Aug 1, 2019
1dae3e9
reformat.
JaySon-Huang Aug 1, 2019
9e3664f
use exception instead
JaySon-Huang Aug 2, 2019
904633c
adress comment
JaySon-Huang Aug 2, 2019
b8fd2a5
adress comment
JaySon-Huang Aug 2, 2019
94037fc
fix compiler error under gcc
JaySon-Huang Aug 2, 2019
4d5cce9
fix compiler error under gcc
JaySon-Huang Aug 2, 2019
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
1 change: 1 addition & 0 deletions dbms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ add_headers_and_sources(dbms src/Storages/Distributed)
add_headers_and_sources(dbms src/Storages/MergeTree)
add_headers_and_sources(dbms src/Storages/Transaction)
add_headers_and_sources(dbms src/Storages/Page)
add_headers_and_sources(dbms src/Storages/Page/VersionSet)
add_headers_and_sources(dbms src/Raft)
add_headers_and_sources(dbms src/TiDB)
add_headers_and_sources(dbms src/Client)
Expand Down
7 changes: 7 additions & 0 deletions dbms/src/Common/ProfileEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
M(PSMWriteFailed) \
M(PSMReadFailed) \
\
M(PSMVCCApplyOnCurrentBase) \
M(PSMVCCApplyOnCurrentDelta) \
M(PSMVCCApplyOnNewDelta) \
M(PSMVCCCompactOnDelta) \
M(PSMVCCCompactOnDeltaRebaseRejected) \
M(PSMVCCCompactOnBase) \
\
M(DMWriteBlock) \
M(DMWriteBlockNS) \
M(DMAppendDelta) \
Expand Down
8 changes: 8 additions & 0 deletions dbms/src/IO/WriteHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,4 +816,12 @@ toString(const T & x, int precision)
return ss.str();
}

/// Pointer to a string
inline String ptrToString(const void * const p)
{
std::stringstream ss;
ss << p;
return ss.str();
}

}
19 changes: 10 additions & 9 deletions dbms/src/Storages/Page/Page.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <map>
#include <unordered_map>

#include <IO/BufferBase.h>
Expand Down Expand Up @@ -27,8 +28,8 @@ using Pages = std::vector<Page>;
using PageMap = std::map<PageId, Page>;
using PageHandler = std::function<void(PageId page_id, const Page &)>;

// Indicate the page size && offset in PageFile. TODO: rename to `PageEntry`?
struct PageCache
// Indicate the page size && offset in PageFile.
struct PageEntry
{
// if file_id == 0, means it is invalid
PageFileId file_id = 0;
Expand All @@ -37,15 +38,15 @@ struct PageCache
UInt64 offset = 0;
UInt64 tag = 0;
UInt64 checksum = 0;
UInt32 ref = 1; // for ref counting

bool isValid() const { return file_id != 0; }
PageFileIdAndLevel fileIdLevel() const { return std::make_pair(file_id, level); }
inline bool isValid() const { return file_id != 0; }
inline bool isTombstone() const { return ref == 0; }
inline PageFileIdAndLevel fileIdLevel() const { return std::make_pair(file_id, level); }
};
static_assert(std::is_trivially_copyable_v<PageCache>);
static_assert(std::is_trivially_copyable_v<PageEntry>);

using PageCacheMap = std::unordered_map<PageId, PageCache>;
using PageCaches = std::vector<PageCache>;
using PageIdAndCache = std::pair<PageId, PageCache>;
using PageIdAndCaches = std::vector<PageIdAndCache>;
using PageIdAndEntry = std::pair<PageId, PageEntry>;
using PageIdAndEntries = std::vector<PageIdAndEntry>;

} // namespace DB
1 change: 1 addition & 0 deletions dbms/src/Storages/Page/PageDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <unordered_set>
#include <vector>

#include <Core/Defines.h>
#include <Core/Types.h>

namespace DB
Expand Down
Loading