Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
titan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
titan
Commits
d9761046
Unverified
Commit
d9761046
authored
Jul 16, 2019
by
Wu Jiayu
Committed by
GitHub
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix blob file iterator (#45)
* fix iterator * fix * fmt
parent
cff9f517
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
blob_file_iterator.cc
src/blob_file_iterator.cc
+8
-4
blob_file_iterator_test.cc
src/blob_file_iterator_test.cc
+3
-1
No files found.
src/blob_file_iterator.cc
View file @
d9761046
...
...
@@ -96,7 +96,7 @@ void BlobFileIterator::GetBlobRecord() {
Slice
record_slice
;
auto
record_size
=
decoder_
.
GetRecordSize
();
buffer_
.
res
erv
e
(
record_size
);
buffer_
.
res
iz
e
(
record_size
);
status_
=
file_
->
Read
(
iterate_offset_
+
kBlobHeaderSize
,
record_size
,
&
record_slice
,
buffer_
.
data
());
if
(
status_
.
ok
())
{
...
...
@@ -167,11 +167,15 @@ void BlobFileMergeIterator::SeekToFirst() {
}
void
BlobFileMergeIterator
::
Next
()
{
assert
(
current_
!=
nullptr
);
assert
(
Valid
()
);
current_
->
Next
();
if
(
current_
->
status
().
ok
()
&&
current_
->
Valid
())
min_heap_
.
push
(
current_
);
current_
=
min_heap_
.
top
();
min_heap_
.
pop
();
if
(
!
min_heap_
.
empty
())
{
current_
=
min_heap_
.
top
();
min_heap_
.
pop
();
}
else
{
current_
=
nullptr
;
}
}
Slice
BlobFileMergeIterator
::
key
()
const
{
...
...
src/blob_file_iterator_test.cc
View file @
d9761046
...
...
@@ -209,13 +209,15 @@ TEST_F(BlobFileIteratorTest, MergeIterator) {
BlobFileMergeIterator
iter
(
std
::
move
(
iters
));
iter
.
SeekToFirst
();
for
(
int
i
=
1
;
i
<
kMaxKeyNum
;
i
++
,
iter
.
Next
())
{
int
i
=
1
;
for
(;
iter
.
Valid
();
i
++
,
iter
.
Next
())
{
ASSERT_OK
(
iter
.
status
());
ASSERT_TRUE
(
iter
.
Valid
());
ASSERT_EQ
(
iter
.
key
(),
GenKey
(
i
));
ASSERT_EQ
(
iter
.
value
(),
GenValue
(
i
));
ASSERT_EQ
(
iter
.
GetBlobIndex
().
blob_handle
,
handles
[
i
]);
}
ASSERT_EQ
(
i
,
kMaxKeyNum
);
}
}
// namespace titandb
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment