mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 10:22:20 +08:00
fix macOS build
This commit is contained in:
parent
f9254849b4
commit
8f6b048e22
@ -1056,12 +1056,12 @@ void* worker_thread(void* thread_args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(debugme,
|
fprintf(debugme,
|
||||||
"DEBUG: worker_id:%d (%d) thread_id:%d (%d) (tid:%d)\n",
|
"DEBUG: worker_id:%d (%d) thread_id:%d (%d) (tid:%ld)\n",
|
||||||
worker_id,
|
worker_id,
|
||||||
args->num_processes,
|
args->num_processes,
|
||||||
thread_id,
|
thread_id,
|
||||||
args->num_threads,
|
args->num_threads,
|
||||||
(unsigned int)pthread_self());
|
(uint64_t)pthread_self());
|
||||||
|
|
||||||
if (args->tpsmax) {
|
if (args->tpsmax) {
|
||||||
thread_tps = compute_thread_tps(args->tpsmax, worker_id, thread_id, args->num_processes, args->num_threads);
|
thread_tps = compute_thread_tps(args->tpsmax, worker_id, thread_id, args->num_processes, args->num_threads);
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fdbclient/BackupContainerAzureBlobStore.h"
|
#include "fdbclient/BackupContainerAzureBlobStore.h"
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
#include "fdbrpc/AsyncFileEncrypted.h"
|
#include "fdbrpc/AsyncFileEncrypted.h"
|
||||||
|
#emdif
|
||||||
|
|
||||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||||
|
|
||||||
@ -244,7 +246,9 @@ BackupContainerAzureBlobStore::BackupContainerAzureBlobStore(const NetworkAddres
|
|||||||
const std::string& containerName,
|
const std::string& containerName,
|
||||||
const Optional<std::string>& encryptionKeyFileName)
|
const Optional<std::string>& encryptionKeyFileName)
|
||||||
: containerName(containerName) {
|
: containerName(containerName) {
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
setEncryptionKey(encryptionKeyFileName);
|
setEncryptionKey(encryptionKeyFileName);
|
||||||
|
#endif
|
||||||
std::string accountKey = std::getenv("AZURE_KEY");
|
std::string accountKey = std::getenv("AZURE_KEY");
|
||||||
auto credential = std::make_shared<azure::storage_lite::shared_key_credential>(accountName, accountKey);
|
auto credential = std::make_shared<azure::storage_lite::shared_key_credential>(accountName, accountKey);
|
||||||
auto storageAccount = std::make_shared<azure::storage_lite::storage_account>(
|
auto storageAccount = std::make_shared<azure::storage_lite::storage_account>(
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#include "fdbclient/BackupContainerFileSystem.h"
|
#include "fdbclient/BackupContainerFileSystem.h"
|
||||||
#include "fdbclient/BackupContainerLocalDirectory.h"
|
#include "fdbclient/BackupContainerLocalDirectory.h"
|
||||||
#include "fdbclient/JsonBuilder.h"
|
#include "fdbclient/JsonBuilder.h"
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
#include "flow/StreamCipher.h"
|
#include "flow/StreamCipher.h"
|
||||||
|
#endif
|
||||||
#include "flow/UnitTest.h"
|
#include "flow/UnitTest.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -1127,6 +1129,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
|
|
||||||
ACTOR static Future<Void> createTestEncryptionKeyFile(std::string filename) {
|
ACTOR static Future<Void> createTestEncryptionKeyFile(std::string filename) {
|
||||||
state Reference<IAsyncFile> keyFile = wait(IAsyncFileSystem::filesystem()->open(
|
state Reference<IAsyncFile> keyFile = wait(IAsyncFileSystem::filesystem()->open(
|
||||||
filename,
|
filename,
|
||||||
@ -1163,6 +1167,7 @@ public:
|
|||||||
StreamCipher::Key::initializeKey(std::move(key));
|
StreamCipher::Key::initializeKey(std::move(key));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}; // class BackupContainerFileSystemImpl
|
}; // class BackupContainerFileSystemImpl
|
||||||
|
|
||||||
Future<Reference<IBackupFile>> BackupContainerFileSystem::writeLogFile(Version beginVersion,
|
Future<Reference<IBackupFile>> BackupContainerFileSystem::writeLogFile(Version beginVersion,
|
||||||
@ -1475,6 +1480,8 @@ bool BackupContainerFileSystem::usesEncryption() const {
|
|||||||
Future<Void> BackupContainerFileSystem::encryptionSetupComplete() const {
|
Future<Void> BackupContainerFileSystem::encryptionSetupComplete() const {
|
||||||
return encryptionSetupFuture;
|
return encryptionSetupFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> const& encryptionKeyFileName) {
|
void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> const& encryptionKeyFileName) {
|
||||||
if (encryptionKeyFileName.present()) {
|
if (encryptionKeyFileName.present()) {
|
||||||
encryptionSetupFuture = BackupContainerFileSystemImpl::readEncryptionKey(encryptionKeyFileName.get());
|
encryptionSetupFuture = BackupContainerFileSystemImpl::readEncryptionKey(encryptionKeyFileName.get());
|
||||||
@ -1483,6 +1490,11 @@ void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> const& en
|
|||||||
Future<Void> BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const &filename) {
|
Future<Void> BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const &filename) {
|
||||||
return BackupContainerFileSystemImpl::createTestEncryptionKeyFile(filename);
|
return BackupContainerFileSystemImpl::createTestEncryptionKeyFile(filename);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Future<Void> BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const& filename) {
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace backup_test {
|
namespace backup_test {
|
||||||
|
|
||||||
|
@ -152,12 +152,13 @@ public:
|
|||||||
VectorRef<KeyRangeRef> keyRangesFilter,
|
VectorRef<KeyRangeRef> keyRangesFilter,
|
||||||
bool logsOnly,
|
bool logsOnly,
|
||||||
Version beginVersion) final;
|
Version beginVersion) final;
|
||||||
|
|
||||||
static Future<Void> createTestEncryptionKeyFile(std::string const& filename);
|
static Future<Void> createTestEncryptionKeyFile(std::string const& filename);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool usesEncryption() const;
|
bool usesEncryption() const;
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
void setEncryptionKey(Optional<std::string> const& encryptionKeyFileName);
|
void setEncryptionKey(Optional<std::string> const& encryptionKeyFileName);
|
||||||
|
#endif
|
||||||
Future<Void> encryptionSetupComplete() const;
|
Future<Void> encryptionSetupComplete() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -133,7 +133,9 @@ std::string BackupContainerLocalDirectory::getURLFormat() {
|
|||||||
|
|
||||||
BackupContainerLocalDirectory::BackupContainerLocalDirectory(const std::string& url,
|
BackupContainerLocalDirectory::BackupContainerLocalDirectory(const std::string& url,
|
||||||
const Optional<std::string>& encryptionKeyFileName) {
|
const Optional<std::string>& encryptionKeyFileName) {
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
setEncryptionKey(encryptionKeyFileName);
|
setEncryptionKey(encryptionKeyFileName);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string path;
|
std::string path;
|
||||||
if (url.find("file://") != 0) {
|
if (url.find("file://") != 0) {
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include "fdbclient/AsyncFileS3BlobStore.actor.h"
|
#include "fdbclient/AsyncFileS3BlobStore.actor.h"
|
||||||
#include "fdbclient/BackupContainerS3BlobStore.h"
|
#include "fdbclient/BackupContainerS3BlobStore.h"
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
#include "fdbrpc/AsyncFileEncrypted.h"
|
#include "fdbrpc/AsyncFileEncrypted.h"
|
||||||
|
#endif
|
||||||
#include "fdbrpc/AsyncFileReadAhead.actor.h"
|
#include "fdbrpc/AsyncFileReadAhead.actor.h"
|
||||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||||
|
|
||||||
@ -145,7 +147,9 @@ BackupContainerS3BlobStore::BackupContainerS3BlobStore(Reference<S3BlobStoreEndp
|
|||||||
const S3BlobStoreEndpoint::ParametersT& params,
|
const S3BlobStoreEndpoint::ParametersT& params,
|
||||||
const Optional<std::string>& encryptionKeyFileName)
|
const Optional<std::string>& encryptionKeyFileName)
|
||||||
: m_bstore(bstore), m_name(name), m_bucket("FDB_BACKUPS_V2") {
|
: m_bstore(bstore), m_name(name), m_bucket("FDB_BACKUPS_V2") {
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
setEncryptionKey(encryptionKeyFileName);
|
setEncryptionKey(encryptionKeyFileName);
|
||||||
|
#endif
|
||||||
// Currently only one parameter is supported, "bucket"
|
// Currently only one parameter is supported, "bucket"
|
||||||
for (const auto& [name, value] : params) {
|
for (const auto& [name, value] : params) {
|
||||||
if (name == "bucket") {
|
if (name == "bucket") {
|
||||||
@ -171,9 +175,11 @@ std::string BackupContainerS3BlobStore::getURLFormat() {
|
|||||||
|
|
||||||
Future<Reference<IAsyncFile>> BackupContainerS3BlobStore::readFile(const std::string& path) {
|
Future<Reference<IAsyncFile>> BackupContainerS3BlobStore::readFile(const std::string& path) {
|
||||||
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreRead>(m_bstore, m_bucket, dataPath(path));
|
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreRead>(m_bstore, m_bucket, dataPath(path));
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
if (usesEncryption()) {
|
if (usesEncryption()) {
|
||||||
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::READ_ONLY);
|
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::READ_ONLY);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
f = makeReference<AsyncFileReadAheadCache>(f,
|
f = makeReference<AsyncFileReadAheadCache>(f,
|
||||||
m_bstore->knobs.read_block_size,
|
m_bstore->knobs.read_block_size,
|
||||||
m_bstore->knobs.read_ahead_blocks,
|
m_bstore->knobs.read_ahead_blocks,
|
||||||
@ -189,9 +195,11 @@ Future<std::vector<std::string>> BackupContainerS3BlobStore::listURLs(Reference<
|
|||||||
|
|
||||||
Future<Reference<IBackupFile>> BackupContainerS3BlobStore::writeFile(const std::string& path) {
|
Future<Reference<IBackupFile>> BackupContainerS3BlobStore::writeFile(const std::string& path) {
|
||||||
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreWrite>(m_bstore, m_bucket, dataPath(path));
|
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreWrite>(m_bstore, m_bucket, dataPath(path));
|
||||||
|
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||||
if (usesEncryption()) {
|
if (usesEncryption()) {
|
||||||
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::APPEND_ONLY);
|
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::APPEND_ONLY);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return Future<Reference<IBackupFile>>(makeReference<BackupContainerS3BlobStoreImpl::BackupFile>(path, f));
|
return Future<Reference<IBackupFile>>(makeReference<BackupContainerS3BlobStoreImpl::BackupFile>(path, f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,8 @@ struct Traceable<Standalone<T>> : std::conditional<Traceable<T>::value, std::tru
|
|||||||
namespace literal_string_ref {
|
namespace literal_string_ref {
|
||||||
template <class T, int Size>
|
template <class T, int Size>
|
||||||
StringRef LiteralStringRefHelper(const char* str) {
|
StringRef LiteralStringRefHelper(const char* str) {
|
||||||
static_assert(std::is_same_v<T, const char(&)[Size]>, "Argument to LiteralStringRef must be a literal string");
|
static_assert(std::is_same_v<T, const char(&)[Size]> || std::is_same_v<T, const char[Size]>,
|
||||||
|
"Argument to LiteralStringRef must be a literal string");
|
||||||
return StringRef(reinterpret_cast<const uint8_t*>(str), Size - 1);
|
return StringRef(reinterpret_cast<const uint8_t*>(str), Size - 1);
|
||||||
}
|
}
|
||||||
} // namespace literal_string_ref
|
} // namespace literal_string_ref
|
||||||
|
@ -60,4 +60,6 @@ TEST_CASE("/flow/IThreadPool/NamedThread") {
|
|||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
void forceLinkIThreadPoolTests() {}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user