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
43bf564f
Commit
43bf564f
authored
Mar 27, 2019
by
Georgios Bitzes
Browse files
Restore ability to create bulkload nodes
parent
9ee5a7cb
Pipeline
#778010
passed with stages
in 40 minutes
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
43bf564f
# Changelog
All notable changes to this project will be documented in this file.
## Unreleased
-
Fixed regression introduced in 0.3.6, which made it impossible to create new
bulkload nodes. (Note: to workaround, delete directory
``/path/to/bulkload/current/state-machine``
right after running
``quarkdb-create``
)
## 0.3.6 (2019-03-21)
-
Improved memory management and recycling, putting less pressure on the global
memory allocator.
...
...
src/ShardDirectory.cc
View file @
43bf564f
...
...
@@ -130,31 +130,71 @@ std::string ShardDirectory::raftJournalPath() {
return
pathJoin
(
currentPath
(),
"raft-journal"
);
}
//------------------------------------------------------------------------------
// Wipe out StateMachine contents.
//------------------------------------------------------------------------------
void
ShardDirectory
::
wipeoutStateMachineContents
()
{
if
(
smptr
)
{
//--------------------------------------------------------------------------
// We have the state machine open already.. wipe contents through reset
//--------------------------------------------------------------------------
getStateMachine
()
->
reset
();
}
else
{
//--------------------------------------------------------------------------
// Not open, simply delete the entire folder
//--------------------------------------------------------------------------
qdb_assert
(
system
(
SSTR
(
"rm -rf '"
<<
stateMachinePath
()
<<
"'"
).
c_str
())
==
0
);
}
}
//------------------------------------------------------------------------------
// Initialize our StateMachine with the given source, if any.
// If no source is given, create a brand new one.
//------------------------------------------------------------------------------
void
ShardDirectory
::
initializeStateMachine
(
std
::
unique_ptr
<
StateMachine
>
sm
,
LogIndex
initialLastApplied
)
{
if
(
!
sm
&&
initialLastApplied
==
0
)
{
//--------------------------------------------------------------------------
// Simplest case: No seed machine, and starting from 0.
// Just ensure SM is wiped out.
//--------------------------------------------------------------------------
wipeoutStateMachineContents
();
return
;
}
if
(
!
sm
)
{
// Easy case, no existing contents. Wipe out any existing contents, if any.
getStateMachine
()
->
reset
();
//--------------------------------------------------------------------------
// No seed machine, but starting from non-zero.
//--------------------------------------------------------------------------
wipeoutStateMachineContents
();
getStateMachine
()
->
forceResetLastApplied
(
initialLastApplied
);
}
else
{
// We reset the contents of this ShardDirectory using a pre-existing
// StateMachine. First, get the target filename..
std
::
string
sourceStateMahchine
=
sm
->
getPhysicalLocation
();
// Shut it down - we don't want to be moving files of a live SM..
sm
.
reset
();
//----------------------------------------------------------------------------
// We have to reset any old contents with those of the pre-existing seed
// StateMachine. First, get the target filename..
//----------------------------------------------------------------------------
std
::
string
sourceStateMahchine
=
sm
->
getPhysicalLocation
();
// Shut down any existing, to-be-deleted SMs we own
detach
();
//----------------------------------------------------------------------------
// Shut it down - we don't want to be moving files of a live SM..
//----------------------------------------------------------------------------
sm
.
reset
();
// Do the actual move
qdb_assert
(
system
(
SSTR
(
"mv "
<<
quotes
(
sourceStateMahchine
)
<<
" "
<<
quotes
(
stateMachinePath
())
).
c_str
())
==
0
);
}
//----------------------------------------------------------------------------
// Shut down and wipe out any existing, to-be-deleted SMs we own
//----------------------------------------------------------------------------
detach
();
wipeoutStateMachineContents
();
//----------------------------------------------------------------------------
// Do the actual move
//----------------------------------------------------------------------------
qdb_assert
(
system
(
SSTR
(
"mv "
<<
quotes
(
sourceStateMahchine
)
<<
" "
<<
quotes
(
stateMachinePath
())
).
c_str
())
==
0
);
//----------------------------------------------------------------------------
// Force reset lastApplied.
//----------------------------------------------------------------------------
getStateMachine
()
->
forceResetLastApplied
(
initialLastApplied
);
}
...
...
src/ShardDirectory.hh
View file @
43bf564f
...
...
@@ -89,6 +89,11 @@ public:
//----------------------------------------------------------------------------
void
initializeStateMachine
(
std
::
unique_ptr
<
StateMachine
>
sm
,
LogIndex
initialLastApplied
);
//----------------------------------------------------------------------------
// Wipe out StateMachine contents.
//----------------------------------------------------------------------------
void
wipeoutStateMachineContents
();
private:
void
parseResilveringHistory
();
void
storeResilveringHistory
();
...
...
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