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

Made multipart write test smarter #42

Merged
merged 7 commits into from
Aug 27, 2024
18 changes: 10 additions & 8 deletions src/S3File.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
}
}

AmazonS3CreateMultipartUpload startUpload(m_ai, m_object, m_log);
if (!startUpload.SendRequest()) {
m_log.Emsg("Open", "S3 multipart request failed");
return -ENOENT;
}
std::string errMsg;
startUpload.Results(uploadId, errMsg);

return 0;
}

Expand Down Expand Up @@ -194,6 +186,16 @@ int S3File::Fstat(struct stat *buff) {
}

ssize_t S3File::Write(const void *buffer, off_t offset, size_t size) {
if (uploadId == "") {
AmazonS3CreateMultipartUpload startUpload(m_ai, m_object, m_log);
if (!startUpload.SendRequest()) {
m_log.Emsg("Open", "S3 multipart request failed");
return -ENOENT;
}
std::string errMsg;
startUpload.Results(uploadId, errMsg);
}

std::string payload((char *)buffer, size);
size_t payload_size = payload.length();
if (payload_size != size) {
Expand Down
Loading