Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
cca825ae
Commit
cca825ae
authored
Jun 28, 2018
by
Georgios Bitzes
Browse files
Make leases usable from standalone mode as well
parent
1219c40b
Pipeline
#429040
passed with stages
in 28 minutes and 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Shard.cc
View file @
cca825ae
...
...
@@ -26,6 +26,7 @@
#include "ShardDirectory.hh"
#include "raft/RaftGroup.hh"
#include "raft/RaftDispatcher.hh"
#include "redis/LeaseFilter.hh"
#include "utils/ScopedAdder.hh"
using
namespace
quarkdb
;
...
...
@@ -116,6 +117,21 @@ LinkStatus Shard::dispatch(Connection *conn, Transaction &transaction) {
return
conn
->
raw
(
Formatter
::
multiply
(
Formatter
::
err
(
"unavailable"
),
transaction
.
expectedResponses
()));
}
// If this is standalone mode, do lease timestamp filtering here.
// Otherwise, RaftDispatcher will take care of it.
if
(
mode
==
Mode
::
standalone
)
{
ClockValue
txTimestamp
=
stateMachine
->
getDynamicClock
();
for
(
size_t
i
=
0
;
i
<
transaction
.
size
();
i
++
)
{
if
(
transaction
[
i
].
getCommand
()
==
RedisCommand
::
LEASE_GET
||
transaction
[
i
].
getCommand
()
==
RedisCommand
::
LEASE_ACQUIRE
)
{
// TODO(gbitzes): This is racy.. we should timestampt after getting a raft
// snapshot, but we need to refactor transactions a bit first.
LeaseFilter
::
transform
(
transaction
[
i
],
txTimestamp
);
}
}
}
return
dispatcher
->
dispatch
(
conn
,
transaction
);
}
...
...
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