Skip to content

Commit 31ba709

Browse files
committed
Implement S3 transaction rollback for PMGD handler
In case of failure, the exception handler will make sure all added objects within the current query context are removed from S3. Signed-off-by: Steven Rojas <[email protected]>
1 parent 5bd18e3 commit 31ba709

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/QueryHandlerPMGD.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "pmgd.h"
4848
#include "util.h"
4949
#include "PmgdFilter.h"
50+
#include "OpsIOCoordinator.h"
5051

5152
#include "APISchema.h"
5253
#include <jsoncpp/json/writer.h>
@@ -276,6 +277,16 @@ void QueryHandlerPMGD::process_query(
276277
Json::Value response;
277278
response.append(exception_error);
278279
proto_res.set_json(fastWriter.write(response));
280+
281+
if (VDMSConfig::instance()->get_aws_flag()) {
282+
VCL::RemoteConnection *connection = get_existing_connection();
283+
for (const std::string image : images_log) {
284+
connection->Remove_Object(image);
285+
}
286+
for (const std::string video : videos_log) {
287+
connection->Remove_Object(video);
288+
}
289+
}
279290
};
280291

281292
try {

0 commit comments

Comments
 (0)