1
0
Fork 0

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

This commit is contained in:
Jan 2019-10-08 20:30:47 +02:00 committed by GitHub
parent d175dfb3b1
commit 032dba152f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -289,8 +289,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(),
@ -343,12 +342,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) {
// disconnecting here will abort arangoimport a few lines below
_httpClient->disconnect();
}
}
if (!_httpClient->isConnected()) {
@ -359,10 +361,12 @@ void ImportFeature::start() {
FATAL_ERROR_EXIT();
}
TRI_ASSERT(client.databaseName() == dbName);
// successfully connected
if (!createdDatabase) {
successfulConnection();
}
// print out connection info
successfulConnection();
_httpClient->disconnect(); // we do not reuse this anymore
SimpleHttpClientParams params = _httpClient->params();