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 ActiveLogs() API to commitlog and use it in the CleanupManager #1090

Merged
merged 39 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0609e34
Add ActiveLogs() API to commitlog
Oct 15, 2018
79a4280
regen mocks
Oct 16, 2018
67b2fbd
Remove unused error
Oct 16, 2018
4e07ea6
wip
Oct 16, 2018
1c82e28
Add commitlog to newMediator
Oct 16, 2018
6fbcd6f
pass commitlog to newFilesystemManager
Oct 16, 2018
904c049
Pass ActiveLogs to cleanupManager
Oct 16, 2018
83d6505
improve commitlog prop test
Oct 16, 2018
5d4735a
Skip active commitlogs in cleanup
Oct 16, 2018
f03461f
Add test for ignoring active commitlogs
Oct 16, 2018
1e85268
Mark prop test as big
Oct 16, 2018
be7b5b3
Fix broken integration tests
Oct 16, 2018
58656ab
Fix flaky test
Oct 17, 2018
1434251
Refactor locking to be more granular and organized
Oct 18, 2018
58a7ccf
Add period to comment
Oct 18, 2018
2f54ec8
use defer for unlock
Oct 18, 2018
0f62824
Add comment about ordering of function calls
Oct 18, 2018
4334c27
Fix typos
Oct 18, 2018
471cd6f
Add sync API
Oct 19, 2018
de40a0e
move pendingFlushesFn out of substruct
Oct 19, 2018
6f156d6
More refactoring
Oct 19, 2018
98f1034
restore flushState
Oct 19, 2018
72f03e7
Add comment and test
Oct 19, 2018
4b31765
make prop test big
Oct 19, 2018
a041794
improve comment
Oct 19, 2018
696e877
Fix docs
Oct 19, 2018
9bdeb29
Dont use so many locks
Oct 22, 2018
1ead851
Fix comment
Oct 22, 2018
81e66ad
remove comment
Oct 22, 2018
db7f1c3
Call wg.Done() ever for errors
Oct 22, 2018
4071b0e
remove lock
Oct 22, 2018
e6e8f19
refactor comment
Oct 22, 2018
d5d1543
Addresss feedback
Oct 22, 2018
e65f16e
reorder ifs
Oct 22, 2018
3d65fce
Remove sync API
Oct 22, 2018
967dde0
skip conc test
Oct 23, 2018
aba86c0
mark conc test as big
Oct 23, 2018
5102e4a
Fix import order
Oct 23, 2018
3af9c80
Fix broken test
Oct 23, 2018
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
2 changes: 1 addition & 1 deletion docs/m3db/architecture/engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ The ticking process runs continously in the background and is responsible for a

#### Merging all encoders

M3TSZ is designed for compressing time series data in which each datapoint has a timestamp that is larger than the last encoded datapoint. For monitoring workloads this works very well because every subsequent datapoint is almost always larger than the previous one. However, real world systems are messy and occassionally out of order writes will be received. When this happens, M3DB will allocate a new encoder for the out of order datapoints. The multiple encoders need to be merged before flushing the data to disk, but to prevent huge memory spikes during the flushing process we continuously merge out of order encoders in the background.
M3TSZ is designed for compressing time series data in which each datapoint has a timestamp that is larger than the last encoded datapoint. For monitoring workloads this works very well because every subsequent datapoint is almost always chronologically after the previous one. However, real world systems are messy and occasionally out of order writes will be received. When this happens, M3DB will allocate a new encoder for the out of order datapoints. The multiple encoders need to be merged before flushing the data to disk, but to prevent huge memory spikes during the flushing process we continuously merge out of order encoders in the background.

#### Removing expired / flushed series and blocks from memory

Expand Down
10 changes: 10 additions & 0 deletions src/dbnode/integration/disk_cleanup_multi_ns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ func TestDiskCleanupMultipleNamespace(t *testing.T) {
// Move now forward by 12 hours, and see if the expected files have been deleted
testSetup.setNowFn(end)

// This isn't great, but right now the commitlog will only ever rotate when writes
// are received, so we need to issue a write after changing the time to force the
// commitlog rotation. This won't be required once we tie commitlog rotation into
// the snapshotting process.
testSetup.writeBatch(testNamespaces[0], generate.Block(generate.BlockConfig{
IDs: []string{"foo"},
NumPoints: 1,
Start: end,
}))

// Check if expected files have been deleted
log.Infof("waiting until data is cleaned up")
waitTimeout := 60 * time.Second
Expand Down
10 changes: 9 additions & 1 deletion src/dbnode/integration/disk_cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestDiskCleanup(t *testing.T) {
}
writeDataFileSetFiles(t, testSetup.storageOpts, md, shard, fileTimes)
for _, clTime := range fileTimes {
// Need to generate valid commit log files otherwise cleanup will fail.
data := map[xtime.UnixNano]generate.SeriesBlock{
xtime.ToUnixNano(clTime): nil,
}
Expand All @@ -89,6 +88,15 @@ func TestDiskCleanup(t *testing.T) {
// and commit logs at now will be deleted
newNow := now.Add(retentionPeriod).Add(2 * blockSize)
testSetup.setNowFn(newNow)
// This isn't great, but right now the commitlog will only ever rotate when writes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to see our tests actually catch this kinda thing

// are received, so we need to issue a write after changing the time to force the
// commitlog rotation. This won't be required once we tie commitlog rotation into
// the snapshotting process.
testSetup.writeBatch(testNamespaces[0], generate.Block(generate.BlockConfig{
IDs: []string{"foo"},
NumPoints: 1,
Start: newNow,
}))

// Check if files have been deleted
waitTimeout := 30 * time.Second
Expand Down
Loading