Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
da1501b8
Commit
da1501b8
authored
2 years ago
by
Yaroslav Dynnikov
Browse files
Options
Downloads
Patches
Plain Diff
chore: satisfy clippy
parent
c7e94ac3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!491
feat: raft log compaction
Pipeline
#17081
failed
2 years ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/traft/raft_storage.rs
+8
-7
8 additions, 7 deletions
src/traft/raft_storage.rs
with
8 additions
and
7 deletions
src/traft/raft_storage.rs
+
8
−
7
View file @
da1501b8
...
...
@@ -4,6 +4,7 @@ use ::raft::StorageError;
use
::
tarantool
::
index
::
IteratorType
;
use
::
tarantool
::
space
::
Space
;
use
::
tarantool
::
tuple
::
Tuple
;
use
std
::
cmp
::
Ordering
;
use
std
::
convert
::
TryFrom
as
_
;
use
crate
::
tlog
;
...
...
@@ -291,7 +292,7 @@ impl RaftSpaceAccess {
let
index
=
tuple
.field
::
<
RaftIndex
>
(
Self
::
FIELD_ENTRY_INDEX
)
?
.expect
(
"index is non-nullable"
);
if
let
Some
(
_
)
=
self
.space_raft_log
.delete
(
&
(
index
,))
?
{
if
self
.space_raft_log
.delete
(
&
(
index
,))
?
.is_some
()
{
n_deleted
+=
1
;
}
}
...
...
@@ -369,10 +370,10 @@ impl raft::Storage for RaftSpaceAccess {
let
compacted_index
=
self
.compacted_index
()
.cvt_err
()
?
.unwrap_or
(
0
);
let
compacted_term
=
self
.compacted_term
()
.cvt_err
()
?
.unwrap_or
(
0
);
if
idx
==
compacted_index
{
return
Ok
(
c
ompacted
_term
);
}
else
if
idx
<
compacted_
index
{
return
Err
(
RaftError
::
Store
(
StorageError
::
Compacted
));
match
idx
.cmp
(
&
compacted_index
)
{
Ordering
::
Less
=>
return
Err
(
RaftError
::
Store
(
StorageError
::
C
ompacted
)),
Ordering
::
Equal
=>
return
Ok
(
compacted_
term
),
Ordering
::
Greater
=>
{}
// go on
}
let
tuple
=
self
.space_raft_log
.get
(
&
(
idx
,))
.cvt_err
()
?
;
...
...
@@ -534,7 +535,7 @@ mod tests {
//
assert_eq!
(
S
::
entries
(
&
storage
,
first
,
last
+
1
,
u64
::
MAX
),
Ok
(
test_entries
.clone
()
)
Ok
(
test_entries
)
);
}
...
...
@@ -603,7 +604,7 @@ mod tests {
let
(
first
,
last
)
=
(
1
,
10
);
for
i
in
first
..=
last
{
storage
.persist_entries
(
&
vec!
[
dummy_entry
(
i
,
i
)])
.unwrap
();
storage
.persist_entries
(
&
[
dummy_entry
(
i
,
i
)])
.unwrap
();
}
let
entries
=
|
lo
,
hi
|
S
::
entries
(
&
storage
,
lo
,
hi
,
u64
::
MAX
);
let
compact_log
=
|
up_to
|
start_transaction
(||
storage
.compact_log
(
up_to
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment