Add overwrite flag to mg_import_csv
Reviewers: teon.banek, buda Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1442
This commit is contained in:
parent
0badfa88f3
commit
7924a94e77
@ -94,7 +94,7 @@ will load the new dataset.
|
||||
Use the following command:
|
||||
|
||||
```bash
|
||||
mg_import_csv --nodes=comment_nodes.csv --nodes=forum_nodes.csv --relationships=relationships.csv
|
||||
mg_import_csv --overwrite --nodes=comment_nodes.csv --nodes=forum_nodes.csv --relationships=relationships.csv
|
||||
```
|
||||
|
||||
If using Docker, things are a bit more complicated. First you need to move the
|
||||
@ -110,6 +110,7 @@ Then, run the importer with the following:
|
||||
```bash
|
||||
docker run -v mg_lib:/var/lib/memgraph -v mg_etc:/etc/memgraph -v mg_import:/import-data \
|
||||
--entrypoint=mg_import_csv memgraph \
|
||||
--overwrite \
|
||||
--nodes=/import-data/comment_nodes.csv --nodes=/import-data/forum_nodes.csv \
|
||||
--relationships=/import-data/relationships.csv
|
||||
```
|
||||
|
@ -470,6 +470,26 @@ std::string GetOutputPath() {
|
||||
} catch (const std::experimental::filesystem::filesystem_error &error) {
|
||||
LOG(FATAL) << error.what();
|
||||
}
|
||||
// TODO: Remove this stupid hack which deletes WAL files just to make snapshot
|
||||
// recovery work. Newest snapshot without accompanying WAL files should be
|
||||
// detected in memgraph and correctly recovered (or error reported).
|
||||
try {
|
||||
auto wal_dir = durability_dir + "/wal";
|
||||
if (std::experimental::filesystem::exists(wal_dir)) {
|
||||
for (const auto &wal_file :
|
||||
std::experimental::filesystem::directory_iterator(wal_dir)) {
|
||||
if (!FLAGS_overwrite) {
|
||||
LOG(FATAL) << "Durability directory isn't empty. Pass --overwrite to "
|
||||
"remove the old recovery data";
|
||||
}
|
||||
break;
|
||||
}
|
||||
LOG(WARNING) << "Removing old recovery data!";
|
||||
std::experimental::filesystem::remove_all(wal_dir);
|
||||
}
|
||||
} catch (const std::experimental::filesystem::filesystem_error &error) {
|
||||
LOG(FATAL) << error.what();
|
||||
}
|
||||
int worker_id = 0;
|
||||
// TODO(dgleich): Remove this transaction id hack
|
||||
return std::string(
|
||||
|
Loading…
Reference in New Issue
Block a user