Fix warnings about ACTORs not having waits. Fix shadowing of future variable in KVFileIntegrityCheck.

This commit is contained in:
A.J. Beamon 2018-09-10 10:51:41 -07:00
parent d8718388a2
commit b727f0475c
5 changed files with 20 additions and 13 deletions

View File

@ -428,7 +428,6 @@ Key getApplyKey( Version version, Key backupUid );
std::pair<uint64_t, uint32_t> decodeBKMutationLogKey(Key key);
Standalone<VectorRef<MutationRef>> decodeBackupLogValue(StringRef value);
void decodeBackupLogValue(Arena& arena, VectorRef<MutationRef>& result, int64_t& mutationSize, StringRef value, StringRef addPrefix = StringRef(), StringRef removePrefix = StringRef());
Future<Void> logErrorWorker(Reference<ReadYourWritesTransaction> const& tr, Key const& keyErrors, std::string const& message);
Future<Void> logError(Database cx, Key keyErrors, const std::string& message);
Future<Void> logError(Reference<ReadYourWritesTransaction> tr, Key keyErrors, const std::string& message);
Future<Void> checkVersion(Reference<ReadYourWritesTransaction> const& tr);

View File

@ -308,7 +308,7 @@ void decodeBackupLogValue(Arena& arena, VectorRef<MutationRef>& result, int& mut
}
}
static double lastErrorTime = 0;
ACTOR Future<Void> logErrorWorker(Reference<ReadYourWritesTransaction> tr, Key keyErrors, std::string message) {
void logErrorWorker(Reference<ReadYourWritesTransaction> tr, Key keyErrors, std::string message) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
if(now() - lastErrorTime > CLIENT_KNOBS->BACKUP_ERROR_DELAY) {
@ -316,12 +316,13 @@ ACTOR Future<Void> logErrorWorker(Reference<ReadYourWritesTransaction> tr, Key k
lastErrorTime = now();
}
tr->set(keyErrors, message);
return Void();
}
Future<Void> logError(Database cx, Key keyErrors, const std::string& message) {
return runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr){return logErrorWorker(tr, keyErrors, message); });
return runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) {
logErrorWorker(tr, keyErrors, message);
return Future<Void>(Void());
});
}
Future<Void> logError(Reference<ReadYourWritesTransaction> tr, Key keyErrors, const std::string& message) {

View File

@ -94,7 +94,7 @@ inline IKeyValueStore* openKVStore( KeyValueStoreType storeType, std::string con
UNREACHABLE(); // FIXME: is this right?
}
Future<Void> GenerateIOLogChecksumFile(std::string const & filename);
void GenerateIOLogChecksumFile(std::string filename);
Future<Void> KVFileCheck(std::string const & filename, bool const &integrity);
#endif

View File

@ -1973,9 +1973,10 @@ void createTemplateDatabase() {
db2.createFromScratch();
}
ACTOR Future<Void> GenerateIOLogChecksumFile(std::string filename) {
if(!fileExists(filename))
void GenerateIOLogChecksumFile(std::string filename) {
if(!fileExists(filename)) {
throw file_not_found();
}
FILE *f = fopen(filename.c_str(), "r");
FILE *fout = fopen((filename + ".checksums").c_str(), "w");
@ -1985,8 +1986,6 @@ ACTOR Future<Void> GenerateIOLogChecksumFile(std::string filename) {
fprintf(fout, "%u %u\n", c++, hashlittle(buf, 4096, 0xab12fd93));
fclose(f);
fclose(fout);
return Void();
}
// If integrity is true, a full btree integrity check is done.

View File

@ -1642,11 +1642,19 @@ int main(int argc, char* argv[]) {
f = stopAfter( networkTestServer() );
g_network->run();
} else if (role == KVFileIntegrityCheck) {
auto f = stopAfter( KVFileCheck(kvFile, true) );
f = stopAfter( KVFileCheck(kvFile, true) );
g_network->run();
} else if (role == KVFileGenerateIOLogChecksums) {
auto f = stopAfter( GenerateIOLogChecksumFile(kvFile) );
g_network->run();
Optional<Void> result;
try {
GenerateIOLogChecksumFile(kvFile);
result = Void();
}
catch(Error &e) {
fprintf(stderr, "Fatal Error: %s\n", e.what());
}
f = result;
}
int rc = FDB_EXIT_SUCCESS;