diff --git a/CHANGELOG b/CHANGELOG index 551b1a332c..a1d0783beb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/arangosh/Import/ImportFeature.cpp b/arangosh/Import/ImportFeature.cpp index 416b54a0e5..2d92412612 100644 --- a/arangosh/Import/ImportFeature.cpp +++ b/arangosh/Import/ImportFeature.cpp @@ -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();