mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
Fix some merge issues
This commit is contained in:
parent
1519f24f77
commit
a32cc5218c
@ -361,9 +361,7 @@ void fdb_cluster_destroy_v609(FDBCluster* c) {
|
||||
// If it does and this is an external client loaded though the multi-version API, then it may inadvertently call
|
||||
// the version of the function in the primary library if it was loaded into the global symbols.
|
||||
fdb_error_t fdb_create_database_impl(const char* cluster_file_path, FDBDatabase** out_database) {
|
||||
CATCH_AND_RETURN(*out_database =
|
||||
(FDBDatabase*)API->createDatabase(ClusterConnectionFile::openOrDefault(cluster_file_path))
|
||||
.extractPtr(););
|
||||
CATCH_AND_RETURN(*out_database = (FDBDatabase*)API->createDatabase(cluster_file_path).extractPtr(););
|
||||
}
|
||||
|
||||
FDBFuture* fdb_cluster_create_database_v609(FDBCluster* c, uint8_t const* db_name, int db_name_length) {
|
||||
|
@ -1095,7 +1095,7 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
||||
if (!opt.exec.present()) {
|
||||
printf("Using cluster file `%s'.\n", ccf->getLocation().c_str());
|
||||
}
|
||||
db = API->createDatabase(ccf);
|
||||
db = API->createDatabase(resolvedClusterFile.first.c_str());
|
||||
} catch (Error& e) {
|
||||
fprintf(stderr, "ERROR: %s (%d)\n", e.what(), e.code());
|
||||
printf("Unable to connect to cluster from `%s'\n", ccf->getLocation().c_str());
|
||||
|
@ -18,6 +18,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fdbclient/ClusterConnectionMemoryRecord.h"
|
||||
#include "fdbclient/DatabaseContext.h"
|
||||
#include "fdbclient/FDBTypes.h"
|
||||
#include "fdbclient/MetaclusterManagement.actor.h"
|
||||
@ -27,14 +28,15 @@
|
||||
namespace MetaclusterAPI {
|
||||
|
||||
ACTOR Future<Reference<IDatabase>> openDatabase(ClusterConnectionString connectionString) {
|
||||
Reference<IClusterConnectionRecord> clusterFile = makeReference<ClusterConnectionMemoryRecord>(connectionString);
|
||||
if (g_network->isSimulated()) {
|
||||
Reference<IClusterConnectionRecord> clusterFile =
|
||||
makeReference<ClusterConnectionMemoryRecord>(connectionString);
|
||||
Database nativeDb = Database::createDatabase(clusterFile, -1);
|
||||
Reference<IDatabase> threadSafeDb =
|
||||
wait(unsafeThreadFutureToFuture(ThreadSafeDatabase::createFromExistingDatabase(nativeDb)));
|
||||
return MultiVersionDatabase::debugCreateFromExistingDatabase(threadSafeDb);
|
||||
} else {
|
||||
return MultiVersionApi::api->createDatabase(clusterFile);
|
||||
return MultiVersionApi::api->createDatabaseFromConnectionString(connectionString.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,35 +859,13 @@ Reference<IDatabase> DLApi::createDatabase609(const char* clusterFilePath) {
|
||||
return makeReference<DLDatabase>(api, dbFuture);
|
||||
}
|
||||
|
||||
Reference<IDatabase> DLApi::createDatabaseFromFile(std::string filename) {
|
||||
Reference<IDatabase> DLApi::createDatabase(const char* clusterFilePath) {
|
||||
if (headerVersion >= 610) {
|
||||
FdbCApi::FDBDatabase* db;
|
||||
throwIfError(api->createDatabase(filename.c_str(), &db));
|
||||
throwIfError(api->createDatabase(clusterFilePath, &db));
|
||||
return Reference<IDatabase>(new DLDatabase(api, db));
|
||||
} else {
|
||||
return DLApi::createDatabase609(filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Reference<IDatabase> DLApi::createDatabaseFromConnectionString(std::string connectionString) {
|
||||
if (api->createDatabaseFromConnectionString == nullptr) {
|
||||
throw unsupported_operation();
|
||||
}
|
||||
|
||||
FdbCApi::FDBDatabase* db;
|
||||
throwIfError(api->createDatabaseFromConnectionString(connectionString.c_str(), &db));
|
||||
return Reference<IDatabase>(new DLDatabase(api, db));
|
||||
}
|
||||
|
||||
Reference<IDatabase> DLApi::createDatabase(Reference<IClusterConnectionRecord> connectionRecord) {
|
||||
if (!connectionRecord->supportedExternally()) {
|
||||
throw unsupported_operation();
|
||||
}
|
||||
Optional<std::string> filename = connectionRecord->getFilename();
|
||||
if (filename.present()) {
|
||||
return createDatabaseFromFile(filename.get());
|
||||
} else {
|
||||
return createDatabaseFromConnectionString(connectionRecord->getConnectionString().toString());
|
||||
return DLApi::createDatabase609(clusterFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include "fdbclient/ClusterConnectionMemoryRecord.h"
|
||||
#include "fdbclient/FDBOptions.g.h"
|
||||
#include "fdbclient/GenericManagementAPI.actor.h"
|
||||
#include "fdbclient/MetaclusterManagement.actor.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include "fdbclient/ClusterConnectionMemoryRecord.h"
|
||||
#include "fdbclient/FDBOptions.g.h"
|
||||
#include "fdbclient/GenericManagementAPI.actor.h"
|
||||
#include "fdbclient/MetaclusterManagement.actor.h"
|
||||
@ -1017,7 +1018,7 @@ struct TenantManagementWorkload : TestWorkload {
|
||||
ASSERT(newTenantEntry.present());
|
||||
|
||||
// Update Internal Tenant Map and check for correctness
|
||||
TenantState tState = self->createdTenants[oldTenantName];
|
||||
TenantData tState = self->createdTenants[oldTenantName];
|
||||
self->createdTenants[newTenantName] = tState;
|
||||
self->createdTenants.erase(oldTenantName);
|
||||
if (!tState.empty) {
|
||||
@ -1032,7 +1033,7 @@ struct TenantManagementWorkload : TestWorkload {
|
||||
}
|
||||
}
|
||||
}
|
||||
wait(self->checkTenant(cx, self, newTenantName, self->createdTenants[newTenantName]));
|
||||
wait(self->checkTenantContents(self, newTenantName, self->createdTenants[newTenantName]));
|
||||
}
|
||||
return Void();
|
||||
} catch (Error& e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user