mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-01 18:56:00 +08:00
update var names
This commit is contained in:
parent
b4c91e65fe
commit
116f034933
bindings
c
flow
java/src/main/com/apple/foundationdb
fdbclient
@ -183,7 +183,7 @@ extern "C" {
|
||||
int address_length, fdb_bool_t check, int duration);
|
||||
|
||||
DLLEXPORT WARN_UNUSED_RESULT FDBFuture*
|
||||
fdb_database_force_recovery_with_data_loss( FDBDatabase* db, uint8_t const* dcid, int dcit_length);
|
||||
fdb_database_force_recovery_with_data_loss( FDBDatabase* db, uint8_t const* dcid, int dcid_length);
|
||||
|
||||
DLLEXPORT void fdb_transaction_destroy( FDBTransaction* tr);
|
||||
|
||||
|
@ -98,8 +98,8 @@ Int64Future Database::reboot_worker(FDBDatabase* db, const uint8_t* address, int
|
||||
return Int64Future(fdb_database_reboot_worker(db, address, address_length, check, duration));
|
||||
}
|
||||
|
||||
EmptyFuture Database::force_recovery_with_data_loss(FDBDatabase *db, const uint8_t *dcId, int dcId_length) {
|
||||
return EmptyFuture(fdb_database_force_recovery_with_data_loss(db, dcId, dcId_length));
|
||||
EmptyFuture Database::force_recovery_with_data_loss(FDBDatabase *db, const uint8_t *dcid, int dcid_length) {
|
||||
return EmptyFuture(fdb_database_force_recovery_with_data_loss(db, dcid, dcid_length));
|
||||
}
|
||||
|
||||
// Transaction
|
||||
|
@ -153,7 +153,7 @@ class Database final {
|
||||
public:
|
||||
static Int64Future reboot_worker(FDBDatabase* db, const uint8_t* address, int address_length, fdb_bool_t check,
|
||||
int duration);
|
||||
static EmptyFuture force_recovery_with_data_loss(FDBDatabase* db, const uint8_t* dcId, int dcId_length);
|
||||
static EmptyFuture force_recovery_with_data_loss(FDBDatabase* db, const uint8_t* dcid, int dcid_length);
|
||||
};
|
||||
|
||||
// Wrapper around FDBTransaction, providing the same set of calls as the C API.
|
||||
|
@ -2037,10 +2037,10 @@ TEST_CASE("fdb_database_force_recovery_with_data_loss") {
|
||||
// can let those storage servers catch up However, if all the tlogs are dead and you still want to be able to
|
||||
// recover your database even if that means losing recently committed mutation, that's the time this function works
|
||||
|
||||
std::string dcId = "test_id";
|
||||
std::string dcid = "test_id";
|
||||
while (1) {
|
||||
fdb::EmptyFuture f =
|
||||
fdb::Database::force_recovery_with_data_loss(db, (const uint8_t*)dcId.c_str(), dcId.size());
|
||||
fdb::Database::force_recovery_with_data_loss(db, (const uint8_t*)dcid.c_str(), dcid.size());
|
||||
fdb_check(wait_future(f));
|
||||
break;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace FDB {
|
||||
Reference<Transaction> createTransaction() override;
|
||||
void setDatabaseOption(FDBDatabaseOption option, Optional<StringRef> value = Optional<StringRef>()) override;
|
||||
Future<int64_t> rebootWorker(const StringRef& address, bool check = false, int duration = 0) override;
|
||||
Future<Void> forceRecoveryWithDataLoss(const StringRef& dcId) override;
|
||||
Future<Void> forceRecoveryWithDataLoss(const StringRef& dcid) override;
|
||||
|
||||
private:
|
||||
FDBDatabase* db;
|
||||
@ -297,8 +297,8 @@ namespace FDB {
|
||||
} );
|
||||
}
|
||||
|
||||
Future<Void> DatabaseImpl::forceRecoveryWithDataLoss(const StringRef &dcId) {
|
||||
return backToFuture< Void > ( fdb_database_force_recovery_with_data_loss(db, dcId.begin(), dcId.size()), [](Reference<CFuture> f){
|
||||
Future<Void> DatabaseImpl::forceRecoveryWithDataLoss(const StringRef &dcid) {
|
||||
return backToFuture< Void > ( fdb_database_force_recovery_with_data_loss(db, dcid.begin(), dcid.size()), [](Reference<CFuture> f){
|
||||
throw_on_error( fdb_future_get_error( f->f ) );
|
||||
return Void();
|
||||
});
|
||||
|
@ -125,7 +125,7 @@ namespace FDB {
|
||||
virtual Reference<Transaction> createTransaction() = 0;
|
||||
virtual void setDatabaseOption(FDBDatabaseOption option, Optional<StringRef> value = Optional<StringRef>()) = 0;
|
||||
virtual Future<int64_t> rebootWorker(const StringRef& address, bool check = false, int duration = 0) = 0;
|
||||
virtual Future<Void> forceRecoveryWithDataLoss(const StringRef& dcId) = 0;
|
||||
virtual Future<Void> forceRecoveryWithDataLoss(const StringRef& dcid) = 0;
|
||||
};
|
||||
|
||||
class API {
|
||||
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* FutureBoolean.java
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
* Copyright 2013-2020 Apple Inc. and the FoundationDB project authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class FutureBoolean extends NativeFuture<Boolean> {
|
||||
FutureBoolean(long cPtr, Executor executor) {
|
||||
super(cPtr);
|
||||
registerMarshalCallback(executor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean getIfDone_internal(long cPtr) throws FDBException {
|
||||
return FutureBoolean_get(cPtr);
|
||||
}
|
||||
|
||||
private native boolean FutureBoolean_get(long cPtr) throws FDBException;
|
||||
}
|
@ -89,7 +89,7 @@ public:
|
||||
// Management API, attempt to kill or suspend a process, return 1 for request sent out, 0 for failure
|
||||
virtual ThreadFuture<int64_t> rebootWorker(const StringRef& address, bool check, int duration) = 0;
|
||||
// Management API, force the database to recover into DCID, causing the database to lose the most recently committed mutations
|
||||
virtual ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcId) = 0;
|
||||
virtual ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcid) = 0;
|
||||
};
|
||||
|
||||
class IClientApi {
|
||||
|
@ -299,12 +299,12 @@ ThreadFuture<int64_t> DLDatabase::rebootWorker(const StringRef& address, bool ch
|
||||
});
|
||||
}
|
||||
|
||||
ThreadFuture<Void> DLDatabase::forceRecoveryWithDataLoss(const StringRef &dcId) {
|
||||
ThreadFuture<Void> DLDatabase::forceRecoveryWithDataLoss(const StringRef &dcid) {
|
||||
if(!api->databaseForceRecoveryWithDataLoss) {
|
||||
return unsupported_operation();
|
||||
}
|
||||
|
||||
FdbCApi::FDBFuture *f = api->databaseForceRecoveryWithDataLoss(db, dcId.begin(), dcId.size());
|
||||
FdbCApi::FDBFuture *f = api->databaseForceRecoveryWithDataLoss(db, dcid.begin(), dcid.size());
|
||||
return toThreadFuture<Void>(api, f, [](FdbCApi::FDBFuture *f, FdbCApi *api) {
|
||||
return Void();
|
||||
});
|
||||
@ -815,9 +815,9 @@ ThreadFuture<int64_t> MultiVersionDatabase::rebootWorker(const StringRef& addres
|
||||
return false;
|
||||
}
|
||||
|
||||
ThreadFuture<Void> MultiVersionDatabase::forceRecoveryWithDataLoss(const StringRef &dcId) {
|
||||
ThreadFuture<Void> MultiVersionDatabase::forceRecoveryWithDataLoss(const StringRef &dcid) {
|
||||
if (dbState->db) {
|
||||
return dbState->db->forceRecoveryWithDataLoss(dcId);
|
||||
return dbState->db->forceRecoveryWithDataLoss(dcid);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ struct FdbCApi : public ThreadSafeReferenceCounted<FdbCApi> {
|
||||
fdb_error_t (*databaseSetOption)(FDBDatabase *database, FDBDatabaseOptions::Option option, uint8_t const *value, int valueLength);
|
||||
void (*databaseDestroy)(FDBDatabase *database);
|
||||
FDBFuture* (*databaseRebootWorker)(FDBDatabase *database, uint8_t const *address, int addressLength, fdb_bool_t check, int duration);
|
||||
FDBFuture* (*databaseForceRecoveryWithDataLoss)(FDBDatabase *database, uint8_t const *dcId, int dcIdLength);
|
||||
FDBFuture* (*databaseForceRecoveryWithDataLoss)(FDBDatabase *database, uint8_t const *dcid, int dcidLength);
|
||||
|
||||
//Transaction
|
||||
fdb_error_t (*transactionSetOption)(FDBTransaction *tr, FDBTransactionOptions::Option option, uint8_t const *value, int valueLength);
|
||||
@ -198,7 +198,7 @@ public:
|
||||
void delref() override { ThreadSafeReferenceCounted<DLDatabase>::delref(); }
|
||||
|
||||
ThreadFuture<int64_t> rebootWorker(const StringRef& address, bool check, int duration) override;
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcId) override;
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcid) override;
|
||||
|
||||
private:
|
||||
const Reference<FdbCApi> api;
|
||||
@ -332,7 +332,7 @@ public:
|
||||
static Reference<IDatabase> debugCreateFromExistingDatabase(Reference<IDatabase> db);
|
||||
|
||||
ThreadFuture<int64_t> rebootWorker(const StringRef& address, bool check, int duration) override;
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcId) override;
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcid) override;
|
||||
|
||||
private:
|
||||
struct DatabaseState;
|
||||
|
@ -77,11 +77,11 @@ ThreadFuture<int64_t> ThreadSafeDatabase::rebootWorker(const StringRef& address,
|
||||
} );
|
||||
}
|
||||
|
||||
ThreadFuture<Void> ThreadSafeDatabase::forceRecoveryWithDataLoss(const StringRef &dcId) {
|
||||
ThreadFuture<Void> ThreadSafeDatabase::forceRecoveryWithDataLoss(const StringRef &dcid) {
|
||||
DatabaseContext *db = this->db;
|
||||
Key dcIdKey = dcId;
|
||||
return onMainThread( [db, dcIdKey]() -> Future<Void> {
|
||||
return db->forceRecoveryWithDataLoss(dcIdKey);
|
||||
Key dcidKey = dcid;
|
||||
return onMainThread( [db, dcidKey]() -> Future<Void> {
|
||||
return db->forceRecoveryWithDataLoss(dcidKey);
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void delref() { ThreadSafeReferenceCounted<ThreadSafeDatabase>::delref(); }
|
||||
|
||||
ThreadFuture<int64_t> rebootWorker(const StringRef& address, bool check, int duration);
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcId);
|
||||
ThreadFuture<Void> forceRecoveryWithDataLoss(const StringRef& dcid);
|
||||
|
||||
private:
|
||||
friend class ThreadSafeTransaction;
|
||||
|
Loading…
x
Reference in New Issue
Block a user