fix macOS build
This commit is contained in:
parent
f9254849b4
commit
8f6b048e22
|
@ -1056,12 +1056,12 @@ void* worker_thread(void* thread_args) {
|
|||
}
|
||||
|
||||
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,
|
||||
args->num_processes,
|
||||
thread_id,
|
||||
args->num_threads,
|
||||
(unsigned int)pthread_self());
|
||||
(uint64_t)pthread_self());
|
||||
|
||||
if (args->tpsmax) {
|
||||
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"
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
#include "fdbrpc/AsyncFileEncrypted.h"
|
||||
#emdif
|
||||
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
|
@ -244,7 +246,9 @@ BackupContainerAzureBlobStore::BackupContainerAzureBlobStore(const NetworkAddres
|
|||
const std::string& containerName,
|
||||
const Optional<std::string>& encryptionKeyFileName)
|
||||
: containerName(containerName) {
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
setEncryptionKey(encryptionKeyFileName);
|
||||
#endif
|
||||
std::string accountKey = std::getenv("AZURE_KEY");
|
||||
auto credential = std::make_shared<azure::storage_lite::shared_key_credential>(accountName, accountKey);
|
||||
auto storageAccount = std::make_shared<azure::storage_lite::storage_account>(
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include "fdbclient/BackupContainerFileSystem.h"
|
||||
#include "fdbclient/BackupContainerLocalDirectory.h"
|
||||
#include "fdbclient/JsonBuilder.h"
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
#include "flow/StreamCipher.h"
|
||||
#endif
|
||||
#include "flow/UnitTest.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -1127,6 +1129,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
|
||||
ACTOR static Future<Void> createTestEncryptionKeyFile(std::string filename) {
|
||||
state Reference<IAsyncFile> keyFile = wait(IAsyncFileSystem::filesystem()->open(
|
||||
filename,
|
||||
|
@ -1163,6 +1167,7 @@ public:
|
|||
StreamCipher::Key::initializeKey(std::move(key));
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
}; // class BackupContainerFileSystemImpl
|
||||
|
||||
Future<Reference<IBackupFile>> BackupContainerFileSystem::writeLogFile(Version beginVersion,
|
||||
|
@ -1475,6 +1480,8 @@ bool BackupContainerFileSystem::usesEncryption() const {
|
|||
Future<Void> BackupContainerFileSystem::encryptionSetupComplete() const {
|
||||
return encryptionSetupFuture;
|
||||
}
|
||||
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> const& encryptionKeyFileName) {
|
||||
if (encryptionKeyFileName.present()) {
|
||||
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) {
|
||||
return BackupContainerFileSystemImpl::createTestEncryptionKeyFile(filename);
|
||||
}
|
||||
#else
|
||||
Future<Void> BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const& filename) {
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace backup_test {
|
||||
|
||||
|
|
|
@ -152,12 +152,13 @@ public:
|
|||
VectorRef<KeyRangeRef> keyRangesFilter,
|
||||
bool logsOnly,
|
||||
Version beginVersion) final;
|
||||
|
||||
static Future<Void> createTestEncryptionKeyFile(std::string const& filename);
|
||||
|
||||
protected:
|
||||
bool usesEncryption() const;
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
void setEncryptionKey(Optional<std::string> const& encryptionKeyFileName);
|
||||
#endif
|
||||
Future<Void> encryptionSetupComplete() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -133,7 +133,9 @@ std::string BackupContainerLocalDirectory::getURLFormat() {
|
|||
|
||||
BackupContainerLocalDirectory::BackupContainerLocalDirectory(const std::string& url,
|
||||
const Optional<std::string>& encryptionKeyFileName) {
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
setEncryptionKey(encryptionKeyFileName);
|
||||
#endif
|
||||
|
||||
std::string path;
|
||||
if (url.find("file://") != 0) {
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#include "fdbclient/AsyncFileS3BlobStore.actor.h"
|
||||
#include "fdbclient/BackupContainerS3BlobStore.h"
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
#include "fdbrpc/AsyncFileEncrypted.h"
|
||||
#endif
|
||||
#include "fdbrpc/AsyncFileReadAhead.actor.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
|
@ -145,7 +147,9 @@ BackupContainerS3BlobStore::BackupContainerS3BlobStore(Reference<S3BlobStoreEndp
|
|||
const S3BlobStoreEndpoint::ParametersT& params,
|
||||
const Optional<std::string>& encryptionKeyFileName)
|
||||
: m_bstore(bstore), m_name(name), m_bucket("FDB_BACKUPS_V2") {
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
setEncryptionKey(encryptionKeyFileName);
|
||||
#endif
|
||||
// Currently only one parameter is supported, "bucket"
|
||||
for (const auto& [name, value] : params) {
|
||||
if (name == "bucket") {
|
||||
|
@ -171,9 +175,11 @@ std::string BackupContainerS3BlobStore::getURLFormat() {
|
|||
|
||||
Future<Reference<IAsyncFile>> BackupContainerS3BlobStore::readFile(const std::string& path) {
|
||||
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreRead>(m_bstore, m_bucket, dataPath(path));
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
if (usesEncryption()) {
|
||||
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::READ_ONLY);
|
||||
}
|
||||
#endif
|
||||
f = makeReference<AsyncFileReadAheadCache>(f,
|
||||
m_bstore->knobs.read_block_size,
|
||||
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) {
|
||||
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreWrite>(m_bstore, m_bucket, dataPath(path));
|
||||
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
|
||||
if (usesEncryption()) {
|
||||
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::APPEND_ONLY);
|
||||
}
|
||||
#endif
|
||||
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 {
|
||||
template <class T, int Size>
|
||||
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);
|
||||
}
|
||||
} // namespace literal_string_ref
|
||||
|
|
|
@ -60,4 +60,6 @@ TEST_CASE("/flow/IThreadPool/NamedThread") {
|
|||
return Void();
|
||||
}
|
||||
|
||||
#else
|
||||
void forceLinkIThreadPoolTests() {}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue