Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
a3cc3fd2
Commit
a3cc3fd2
authored
Jun 25, 2018
by
Georgios Bitzes
Browse files
Ensure lease deadline stored in key descriptor is correctly updated
parent
81266396
Pipeline
#425378
passed with stages
in 31 minutes and 21 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/StateMachine.cc
View file @
a3cc3fd2
...
...
@@ -930,7 +930,7 @@ void StateMachine::WriteOperation::writeLocalityIndex(const std::string &field,
stagingArea
.
put
(
locator
.
toSlice
(),
hint
);
}
rocksdb
::
Status
StateMachine
::
WriteOperation
::
finalize
(
int64_t
newsize
)
{
rocksdb
::
Status
StateMachine
::
WriteOperation
::
finalize
(
int64_t
newsize
,
bool
forceUpdate
)
{
assertWritable
();
if
(
newsize
<
0
)
qdb_throw
(
"invalid newsize: "
<<
newsize
);
...
...
@@ -938,7 +938,7 @@ rocksdb::Status StateMachine::WriteOperation::finalize(int64_t newsize) {
if
(
newsize
==
0
)
{
stagingArea
.
del
(
dlocator
.
toSlice
());
}
else
if
(
keyinfo
.
getSize
()
!=
newsize
)
{
else
if
(
keyinfo
.
getSize
()
!=
newsize
||
forceUpdate
)
{
keyinfo
.
setSize
(
newsize
);
stagingArea
.
put
(
dlocator
.
toSlice
(),
keyinfo
.
serialize
());
}
...
...
@@ -1139,7 +1139,7 @@ rocksdb::Status StateMachine::lease_acquire(StagingArea &stagingArea, const std:
// Update lease value.
operation
.
write
(
value
);
acquired
=
true
;
return
operation
.
finalize
(
value
.
size
());
return
operation
.
finalize
(
value
.
size
()
,
true
);
}
rocksdb
::
Status
StateMachine
::
lease_release
(
StagingArea
&
stagingArea
,
const
std
::
string
&
key
)
{
...
...
src/StateMachine.hh
View file @
a3cc3fd2
...
...
@@ -245,7 +245,7 @@ private:
bool
deleteLocalityField
(
const
std
::
string
&
hint
,
const
std
::
string
&
field
);
bool
getAndDeleteLocalityIndex
(
const
std
::
string
&
field
,
std
::
string
&
hint
);
rocksdb
::
Status
finalize
(
int64_t
newsize
);
rocksdb
::
Status
finalize
(
int64_t
newsize
,
bool
forceUpdate
=
false
);
KeyDescriptor
&
descriptor
()
{
return
keyinfo
;
...
...
src/storage/StagingArea.hh
View file @
a3cc3fd2
...
...
@@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
************************************************************************/
#ifndef
__
QUARKDB_STAGING_AREA_H
__
#define
__
QUARKDB_STAGING_AREA_H
__
#ifndef QUARKDB_STAGING_AREA_H
#define QUARKDB_STAGING_AREA_H
#include
<mutex>
#include
"KeyDescriptor.hh"
...
...
test/state-machine.cc
View file @
a3cc3fd2
...
...
@@ -769,6 +769,17 @@ TEST_F(State_Machine, Leases) {
ASSERT_OK
(
stateMachine
()
->
exists
(
keys
.
begin
(),
keys
.
end
(),
count
)
);
ASSERT_EQ
(
count
,
0
);
{
StagingArea
stagingArea
(
*
stateMachine
());
DescriptorLocator
locator
(
"my-lease"
);
std
::
string
tmp
;
ASSERT_OK
(
stagingArea
.
get
(
locator
.
toSlice
(),
tmp
));
KeyDescriptor
descr
(
tmp
);
ASSERT_EQ
(
descr
.
getSize
(),
11u
);
ASSERT_EQ
(
descr
.
getStartIndex
(),
9u
);
ASSERT_EQ
(
descr
.
getEndIndex
(),
19u
);
}
{
StagingArea
stagingArea
(
*
stateMachine
());
ExpirationEventIterator
iterator
(
stagingArea
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment