bkietz commented on code in PR #36536:
URL: https://github.com/apache/arrow/pull/36536#discussion_r1256076176
##########
cpp/src/arrow/filesystem/s3fs.cc:
##########
@@ -1158,7 +1179,7 @@ class ObjectInputFile final : public io::RandomAccessFile
{
req.SetKey(ToAwsString(path_.key));
ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
- auto outcome = client_lock->HeadObject(req);
+ auto outcome = std::move(client_lock)->HeadObject(req);
Review Comment:
`std::move` will not destroy this lock (in general, it's useful to think of
`std::move` as doing nothing except flagging a reference as legal to move
construct from). What you want here is
```suggestion
S3Model::HeadObjectOutcome outcome;
{
ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
outcome = std::move(client_lock)->HeadObject(req);
} // client lock goes out of scope here
```
or maybe
```suggestion
ARROW_ASSIGN_OR_RAISE(auto outcome, holder_->Lock().Map([&](auto
client_lock) {
return client_lock->HeadObject(req);
}));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]