Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
e3d0853
Extend persist manager to support persisting index snapshots.
notbdu Aug 18, 2020
16b8d34
Add test for prepare index snapshot and fixes.
notbdu Aug 20, 2020
e94636c
Implement index snapshotting and add test.
notbdu Aug 21, 2020
9100b0e
Fix test.
notbdu Aug 21, 2020
9cfbb1c
Add test for subtracing index snapshot shard time ranges from fs boot…
notbdu Aug 24, 2020
276cf33
Bootstrap snapshots in commitlog.
notbdu Aug 26, 2020
887f8a6
save
notbdu Sep 8, 2020
d7a4975
Use index info files to determine index volume type written to disk.
notbdu Sep 9, 2020
1a5802b
Implement adding snapshotted segments to an index block.
notbdu Sep 9, 2020
7678b6e
Add segment compactable/frozen state.
notbdu Sep 11, 2020
0812550
Record index snapshot state.
notbdu Sep 11, 2020
6878ff4
Add TODOs and initialize index snapshot state.
notbdu Sep 11, 2020
dc9f319
Cleanup index snapshots based on cached index snapshot state.
notbdu Sep 15, 2020
7f35b6f
Cleanup and update mocks
notbdu Sep 16, 2020
2835848
Fix tests and add unit tests for cleaning up index snapshots.
notbdu Sep 17, 2020
d45934d
Write empty snapshot files after index flush completes.
notbdu Sep 17, 2020
400ba02
Test writing empty snapshots after successful warm flush.
notbdu Sep 17, 2020
cfc84b7
Fix unit tests
notbdu Sep 17, 2020
86c6a98
Fix comments.
notbdu Sep 17, 2020
7a2a2fa
Extend comment
notbdu Sep 17, 2020
7b23931
Update mocks
notbdu Sep 17, 2020
0b08d3e
Remove bootstrapping from snapshots in fs bootstrapper.
notbdu Sep 22, 2020
8107f3b
Check if reverse index exists.
notbdu Sep 22, 2020
9391401
Flush type.
notbdu Sep 22, 2020
82a2113
Do no work if index block does not exist.
notbdu Sep 23, 2020
4022b63
Only perform cleanup if enabled.
notbdu Sep 23, 2020
132061e
Only cleanup index snapshots when index enabled and fix tests.
notbdu Sep 24, 2020
02bb1ac
Remove index bootstrapping from fs bootstrapper.
notbdu Sep 29, 2020
ba81251
Remove unneeded test.
notbdu Sep 29, 2020
db42e5b
Fix fs bootstrapper unit tests.
notbdu Sep 30, 2020
9e71a88
Fix unit test.
notbdu Sep 30, 2020
8a3d99a
Add integration test for bootstrapping from index snapshots.
notbdu Sep 30, 2020
034bdd3
Update read only index proxy.
notbdu Oct 1, 2020
d5d7389
Add snapshot ID to index snapshot info files and handle checksum vali…
notbdu Oct 2, 2020
73820de
Refactor calculating fulfilled time ranges for index block.
notbdu Oct 2, 2020
57c7645
Write both index and data snapshots to disk and bootstrap. Verify works.
notbdu Oct 2, 2020
93cb9ef
Fix more integration tests.
notbdu Oct 5, 2020
95c8c3a
Fix unit test and codegen.
notbdu Oct 5, 2020
08307f4
Can have more than one snapshot per block start since cleanup is async.
notbdu Oct 5, 2020
c092f5a
Use the same snapshot ID across all snapshots.
notbdu Oct 6, 2020
687eca8
Cleanup.
notbdu Oct 6, 2020
9b14c28
Make all segment fileset writers implement segment state and update m…
notbdu Oct 6, 2020
6e62064
Add/modify unit tests for bootstrapping index data in fs bootstrapper.
notbdu Oct 7, 2020
4774a45
Re-use snapshot segments array when snapshotting.
notbdu Oct 8, 2020
c1f160e
Make read through segments implement fst.Segment and amortize allocs …
notbdu Oct 9, 2020
e393a8c
Handle closed mutable segments.
notbdu Oct 9, 2020
951f3b8
Short circuit if no work to do.
notbdu Oct 9, 2020
2c2f0ce
Calling memory segments data when closed is not an error case.
notbdu Oct 11, 2020
cd8d8db
Return nil.
notbdu Oct 12, 2020
2014869
Fix unit tests.
notbdu Oct 12, 2020
b5c865c
No data if closed.
notbdu Oct 12, 2020
2a81e35
Remove up to latest index snapshot or loaded.
notbdu Oct 16, 2020
ad6308e
Add test for flushing index snapshots and removal of old index snapsh…
notbdu Oct 16, 2020
0a1bb00
Add snapshot documentation.
notbdu Oct 16, 2020
0e82fd6
Remove snapshot version flushed and modify unit tests to test for del…
notbdu Oct 16, 2020
1506dec
Cleanup logic fix
notbdu Oct 16, 2020
4f6e0af
Fix read thru seg and cleanup tests.
notbdu Oct 20, 2020
6aa8098
Fix rebase conflicts and tests.
notbdu Oct 21, 2020
eba2dc0
Fix cleanup test.
notbdu Oct 21, 2020
5ccdf71
Fix integration tests.
notbdu Oct 21, 2020
171f6af
Update mocks.
notbdu Oct 21, 2020
9b8c4e3
Address PR feedback.
notbdu Oct 22, 2020
b965b2a
Remove delete warm snapshot block for now.
notbdu Oct 22, 2020
a0b04b5
Use an actual index instead of the ns hash.
notbdu Oct 23, 2020
f676a96
Address PR comments and move around docs.
notbdu Oct 28, 2020
ab5c7f0
Fix unit tests.
notbdu Oct 28, 2020
0bca1dc
Fix integration test fn call.
notbdu Oct 28, 2020
0afd3e2
Split invariant violation logic.
notbdu Oct 28, 2020
e72d6cf
Can have no snapshots for certain blocks.
notbdu Oct 28, 2020
2b293cb
Wait for warm flush to succeed.
notbdu Oct 28, 2020
c894b71
Move digest notes to docs folder.
notbdu Oct 28, 2020
1351650
Only emit invariant violation if error.
notbdu Oct 29, 2020
912e0ba
Don't mmap index snapshots after persisting.
notbdu Oct 30, 2020
657bd82
Fix method calls and tests.
notbdu Oct 30, 2020
7f9a395
Fix flaky docker integration test reads.
notbdu Oct 30, 2020
b4e912a
Return errors when buffer size too small.
notbdu Nov 1, 2020
4b9029a
Remove write empty index snapshots logic, update docs, and use ns ID …
notbdu Nov 2, 2020
14efab4
Address PR comments.
notbdu Nov 3, 2020
f284bac
Fn name change.
notbdu Nov 3, 2020
60b4ef0
Address PR feedback.
notbdu Nov 3, 2020
dd5edea
Update commitlog bootstrap integration test to cover the full relianc…
notbdu Nov 3, 2020
ed594f5
Update license header.
notbdu Nov 3, 2020
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
36 changes: 18 additions & 18 deletions scripts/docker-integration-tests/simple/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,25 @@ curl -vvvsS -X POST 0.0.0.0:9003/writetagged -d '{
}
}'

function test_query_result {
queryResult=$(curl -sSf -X POST 0.0.0.0:9003/query -d '{
"namespace": "unagg",
"query": {
"regexp": {
"field": "city",
"regexp": ".*"
}
},
"rangeStart": 0,
"rangeEnd":'"$(date +"%s")"'
}' | jq '.results | length')
test "$queryResult" -eq "1"
return $?
}

echo "Read data"
queryResult=$(curl -sSf -X POST 0.0.0.0:9003/query -d '{
"namespace": "unagg",
"query": {
"regexp": {
"field": "city",
"regexp": ".*"
}
},
"rangeStart": 0,
"rangeEnd":'"$(date +"%s")"'
}' | jq '.results | length')

if [ "$queryResult" -lt 1 ]; then
echo "Result not found"
exit 1
else
echo "Result found"
fi
ATTEMPTS=10 MAX_TIMEOUT=1 TIMEOUT=.1 retry_with_backoff \
test_query_result

echo "Deleting placement"
curl -vvvsSf -X DELETE 0.0.0.0:7201/api/v1/services/m3db/placement
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/read_index_segments/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func readNamespaceSegments(
) {
var (
infoFiles = fs.ReadIndexInfoFiles(fsOpts.FilePathPrefix(), nsID,
fsOpts.InfoReaderBufferSize())
fsOpts.InfoReaderBufferSize(), persist.FileSetFlushType)
wg sync.WaitGroup
)

Expand Down
11 changes: 9 additions & 2 deletions src/dbnode/digest/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package digest

import (
"encoding/binary"
"errors"
"os"
)

Expand All @@ -33,6 +34,9 @@ const (
var (
// Endianness is little endian
endianness = binary.LittleEndian
// errBufferSizeTooSmall is for when the buffer passed in to be
// converted to a digest buffer is of insufficient size.
errBufferSizeTooSmall = errors.New("buffer size too small")
)

// Buffer is a byte slice that facilitates digest reading and writing.
Expand Down Expand Up @@ -70,6 +74,9 @@ func (b Buffer) ReadDigestFromFile(fd *os.File) (uint32, error) {
}

// ToBuffer converts a byte slice to a digest buffer.
func ToBuffer(buf []byte) Buffer {
return Buffer(buf[:DigestLenBytes])
func ToBuffer(buf []byte) (Buffer, error) {
if len(buf) < DigestLenBytes {
return nil, errBufferSizeTooSmall
}
return Buffer(buf[:DigestLenBytes]), nil
}
8 changes: 7 additions & 1 deletion src/dbnode/digest/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ func TestWriteDigestToFile(t *testing.T) {
}

func TestReadDigest(t *testing.T) {
buf := ToBuffer([]byte{0x0, 0x1, 0x0, 0x1, 0x0, 0x1})
buf, err := ToBuffer([]byte{0x0, 0x1, 0x0, 0x1, 0x0, 0x1})
require.NoError(t, err)
require.Equal(t, uint32(0x1000100), buf.ReadDigest())
}

func TestReadDigestInsufficientBytes(t *testing.T) {
_, err := ToBuffer([]byte{0x0})
require.Equal(t, err, errBufferSizeTooSmall)
}

func TestReadDigestFromFile(t *testing.T) {
fd := createTempFile(t)
defer func() {
Expand Down
175 changes: 143 additions & 32 deletions src/dbnode/generated/proto/index/index.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/dbnode/generated/proto/index/index.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ message IndexVolumeInfo {
int64 snapshotTime = 6;
repeated SegmentInfo segments = 7;
google.protobuf.StringValue indexVolumeType = 8;
bytes snapshotID = 9;
}

enum SegmentState {
COMPACTABLE_SEGMENT_STATE = 0;
FROZEN_SEGMENT_STATE = 1;
}

message SegmentInfo {
Expand All @@ -21,6 +27,7 @@ message SegmentInfo {
int64 minorVersion = 3;
bytes metadata = 4;
repeated SegmentFileInfo files = 5;
SegmentState segmentState = 6;
}

message SegmentFileInfo {
Expand Down
Loading