1
0
Fork 0

fixed issue #10183: Arangoimport imports on _system when you try to create a new database. (#10187)

This commit is contained in:
Jan 2019-10-09 13:54:46 +02:00 committed by KVS85
parent 68ff8d4366
commit c1a0274ad0
2 changed files with 20 additions and 9 deletions

View File

@ -1,6 +1,13 @@
v3.5.2 (XXXX-XX-XX)
-------------------
* Fixed issue #10183: Arangoimport imports on _system when you try to
create a new database.
This bugfix fixes the output of arangoimport, which could display a
wrong target database for the import if the option `--create-database`
was used.
* Fixed issue #10158: Invalid Query Crashes ArangoDB.
This fixes traversal queries that are run on a static empty start vertex

View File

@ -288,8 +288,7 @@ void ImportFeature::start() {
int err = TRI_ERROR_NO_ERROR;
auto versionString = _httpClient->getServerVersion(&err);
auto dbName = client->databaseName();
bool createdDatabase = false;
auto const dbName = client->databaseName();
auto successfulConnection = [&]() {
std::cout << ClientFeature::buildConnectedMessage(_httpClient->getEndpointSpecification(), versionString, /*role*/ "", /*mode*/ "", client->databaseName(), client->username()) << std::endl;
@ -338,12 +337,15 @@ void ImportFeature::start() {
FATAL_ERROR_EXIT();
}
successfulConnection();
// restore old database name
client->setDatabaseName(dbName);
versionString = _httpClient->getServerVersion(nullptr);
createdDatabase = true;
err = TRI_ERROR_NO_ERROR;
versionString = _httpClient->getServerVersion(&err);
if (err != TRI_ERROR_NO_ERROR) {
// disconnect, as this will make the import abort
_httpClient->disconnect();
}
}
if (!_httpClient->isConnected()) {
@ -353,11 +355,13 @@ void ImportFeature::start() {
LOG_TOPIC("034c9", FATAL, arangodb::Logger::FIXME) << _httpClient->getErrorMessage() << "'";
FATAL_ERROR_EXIT();
}
TRI_ASSERT(client->databaseName() == dbName);
// successfully connected
if (!createdDatabase) {
successfulConnection();
}
// now print connection info
successfulConnection();
_httpClient->disconnect(); // we do not reuse this anymore
SimpleHttpClientParams params = _httpClient->params();