Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the way how the backup agent makes use of the proxy and add proxy to trace events #10903

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions fdbbackup/backup.actor.cpp
Expand Up @@ -4076,6 +4076,7 @@ int main(int argc, char* argv[]) {
.detail("CommandLine", commandLine)
.setMaxFieldLength(0)
.detail("MemoryLimit", memLimit)
.detail("Proxy", proxy.orDefault(""))
.trackLatest("ProgramStart");

// Ordinarily, this is done when the network is run. However, network thread should be set before TraceEvents
Expand Down
11 changes: 10 additions & 1 deletion fdbclient/BackupContainer.actor.cpp
Expand Up @@ -270,11 +270,20 @@ Reference<IBackupContainer> IBackupContainer::openContainer(const std::string& u
r = makeReference<BackupContainerLocalDirectory>(url, encryptionKeyFileName);
} else if (u.startsWith("blobstore://"_sr)) {
std::string resource;
Optional<std::string> blobstoreProxy;

// If no proxy is passed down to the openContainer method, try to fallback to the
// fileBackupAgentProxy which is a global variable and will be set for the backup_agent.
if (proxy.present()) {
blobstoreProxy = proxy.get();
} else if (fileBackupAgentProxy.present()) {
blobstoreProxy = fileBackupAgentProxy.get();
}

// The URL parameters contain blobstore endpoint tunables as well as possible backup-specific options.
S3BlobStoreEndpoint::ParametersT backupParams;
Reference<S3BlobStoreEndpoint> bstore =
S3BlobStoreEndpoint::fromString(url, proxy, &resource, &lastOpenError, &backupParams);
S3BlobStoreEndpoint::fromString(url, blobstoreProxy, &resource, &lastOpenError, &backupParams);

if (resource.empty())
throw backup_invalid_url();
Expand Down
11 changes: 10 additions & 1 deletion fdbclient/BackupContainerFileSystem.actor.cpp
Expand Up @@ -1516,11 +1516,20 @@ Reference<BackupContainerFileSystem> BackupContainerFileSystem::openContainerFS(
r = makeReference<BackupContainerLocalDirectory>(url, encryptionKeyFileName);
} else if (u.startsWith("blobstore://"_sr)) {
std::string resource;
Optional<std::string> blobstoreProxy;

// If no proxy is passed down to the openContainer method, try to fallback to the
// fileBackupAgentProxy which is a global variable and will be set for the backup_agent.
if (proxy.present()) {
blobstoreProxy = proxy.get();
} else if (fileBackupAgentProxy.present()) {
blobstoreProxy = fileBackupAgentProxy.get();
}

// The URL parameters contain blobstore endpoint tunables as well as possible backup-specific options.
S3BlobStoreEndpoint::ParametersT backupParams;
Reference<S3BlobStoreEndpoint> bstore =
S3BlobStoreEndpoint::fromString(url, proxy, &resource, &lastOpenError, &backupParams);
S3BlobStoreEndpoint::fromString(url, blobstoreProxy, &resource, &lastOpenError, &backupParams);

if (resource.empty())
throw backup_invalid_url();
Expand Down
11 changes: 8 additions & 3 deletions fdbclient/S3BlobStore.actor.cpp
Expand Up @@ -714,7 +714,8 @@ ACTOR Future<S3BlobStoreEndpoint::ReusableConnection> connect_impl(Reference<S3B
TraceEvent("S3BlobStoreEndpointReusingConnected")
.suppressFor(60)
.detail("RemoteEndpoint", rconn.conn->getPeerAddress())
.detail("ExpiresIn", rconn.expirationTime - now());
.detail("ExpiresIn", rconn.expirationTime - now())
.detail("Proxy", b->proxyHost.orDefault(""));
return rconn;
}
}
Expand Down Expand Up @@ -747,7 +748,8 @@ ACTOR Future<S3BlobStoreEndpoint::ReusableConnection> connect_impl(Reference<S3B
TraceEvent("S3BlobStoreEndpointNewConnection")
.suppressFor(60)
.detail("RemoteEndpoint", conn->getPeerAddress())
.detail("ExpiresIn", b->knobs.max_connection_life);
.detail("ExpiresIn", b->knobs.max_connection_life)
.detail("Proxy", b->proxyHost.orDefault(""));

if (b->lookupKey || b->lookupSecret || b->knobs.sdk_auth)
wait(b->updateSecret());
Expand Down Expand Up @@ -960,7 +962,10 @@ ACTOR Future<Reference<HTTP::Response>> doRequest_impl(Reference<S3BlobStoreEndp
else
event.detail("RemoteHost", bstore->host);

event.detail("Verb", verb).detail("Resource", resource).detail("ThisTry", thisTry);
event.detail("Verb", verb)
.detail("Resource", resource)
.detail("ThisTry", thisTry)
.detail("Proxy", bstore->proxyHost.orDefault(""));

// If r is not valid or not code 429 then increment the try count. 429's will not count against the attempt
// limit.
Expand Down