mirror of https://gitee.com/bigwinds/arangodb
report a path, make it restartable
This commit is contained in:
parent
8206afa0b1
commit
949985dff1
|
@ -92,7 +92,15 @@ void RocksDBEngine::validateOptions(std::shared_ptr<options::ProgramOptions>) {}
|
|||
|
||||
// preparation phase for storage engine. can be used for internal setup.
|
||||
// the storage engine must not start any threads here or write any files
|
||||
void RocksDBEngine::prepare() {}
|
||||
void RocksDBEngine::prepare() {
|
||||
// get base path from DatabaseServerFeature
|
||||
auto databasePathFeature =
|
||||
application_features::ApplicationServer::getFeature<DatabasePathFeature>(
|
||||
"DatabasePath");
|
||||
_basePath = databasePathFeature->directory();
|
||||
|
||||
TRI_ASSERT(!_basePath.empty());
|
||||
}
|
||||
|
||||
void RocksDBEngine::start() {
|
||||
// it is already decided that rocksdb is used
|
||||
|
@ -342,7 +350,7 @@ int RocksDBEngine::getViews(TRI_vocbase_t* vocbase,
|
|||
}
|
||||
|
||||
std::string RocksDBEngine::databasePath(TRI_vocbase_t const* vocbase) const {
|
||||
return std::string(); // no path to be returned here!
|
||||
return _basePath;
|
||||
}
|
||||
|
||||
std::string RocksDBEngine::collectionPath(TRI_vocbase_t const* vocbase,
|
||||
|
|
|
@ -260,6 +260,7 @@ class RocksDBEngine final : public StorageEngine {
|
|||
rocksdb::Options _options;
|
||||
std::unique_ptr<RocksDBComparator> _cmp;
|
||||
std::string _path;
|
||||
std::string _basePath;
|
||||
|
||||
std::unique_ptr<RocksDBCounterManager> _counterManager;
|
||||
};
|
||||
|
|
|
@ -94,10 +94,7 @@
|
|||
constant2name[DATABASE_EXISTING] = 'existing';
|
||||
|
||||
// path to version file
|
||||
let versionFile;
|
||||
if (internal.db._path()) {
|
||||
versionFile = internal.db._path() + '/VERSION';
|
||||
}
|
||||
let versionFile = internal.db._path() + '/VERSION';
|
||||
|
||||
// all defined tasks
|
||||
const allTasks = [];
|
||||
|
@ -287,7 +284,7 @@
|
|||
lastTasks[task.name] = true;
|
||||
|
||||
// save/update version info
|
||||
if (isLocal && versionFile) {
|
||||
if (isLocal) {
|
||||
fs.write(
|
||||
versionFile,
|
||||
JSON.stringify({
|
||||
|
@ -303,7 +300,7 @@
|
|||
}
|
||||
|
||||
// save file so version gets saved even if there are no tasks
|
||||
if (isLocal && versionFile) {
|
||||
if (isLocal) {
|
||||
fs.write(
|
||||
versionFile,
|
||||
JSON.stringify({
|
||||
|
@ -350,7 +347,7 @@
|
|||
}
|
||||
|
||||
// VERSION file exists, read its contents
|
||||
if (versionFile && fs.exists(versionFile)) {
|
||||
if (fs.exists(versionFile)) {
|
||||
var versionInfo = fs.read(versionFile);
|
||||
|
||||
if (versionInfo === '') {
|
||||
|
@ -490,7 +487,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (db._engine().name != "rocksdb") {
|
||||
if (db._engine().name !== "rocksdb") {
|
||||
users.ensureIndex({
|
||||
type: 'hash',
|
||||
fields: ['user'],
|
||||
|
|
Loading…
Reference in New Issue