mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 18:48:26 +00:00
Merge pull request #1130 from ggtakec/update_multiread
Strict processing of MultiRead method
This commit is contained in:
commit
e1886b5343
21
src/curl.cpp
21
src/curl.cpp
@ -4152,14 +4152,17 @@ int S3fsMultiCurl::MultiRead()
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ++iter) {
|
for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ){
|
||||||
S3fsCurl* s3fscurl = *iter;
|
S3fsCurl* s3fscurl = *iter;
|
||||||
|
|
||||||
bool isRetry = false;
|
bool isRetry = false;
|
||||||
|
bool isPostpone = false;
|
||||||
long responseCode = -1;
|
long responseCode = -1;
|
||||||
if(s3fscurl->GetResponseCode(responseCode, false)){
|
if(s3fscurl->GetResponseCode(responseCode, false)){
|
||||||
if(400 > responseCode){
|
if(-1 == responseCode){
|
||||||
|
// This is a case where the processing result has not yet been updated (should be very rare).
|
||||||
|
isPostpone = true;
|
||||||
|
}else if(400 > responseCode){
|
||||||
// add into stat cache
|
// add into stat cache
|
||||||
if(SuccessCallback && !SuccessCallback(s3fscurl)){
|
if(SuccessCallback && !SuccessCallback(s3fscurl)){
|
||||||
S3FS_PRN_WARN("error from callback function(%s).", s3fscurl->url.c_str());
|
S3FS_PRN_WARN("error from callback function(%s).", s3fscurl->url.c_str());
|
||||||
@ -4189,12 +4192,16 @@ int S3fsMultiCurl::MultiRead()
|
|||||||
S3FS_PRN_ERR("failed a request(Unknown response code: %s)", s3fscurl->url.c_str());
|
S3FS_PRN_ERR("failed a request(Unknown response code: %s)", s3fscurl->url.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isPostpone){
|
||||||
|
clist_req.erase(iter);
|
||||||
|
clist_req.push_back(s3fscurl); // Re-evaluate at the end
|
||||||
|
iter = clist_req.begin();
|
||||||
|
}else{
|
||||||
if(!isRetry || 0 != result){
|
if(!isRetry || 0 != result){
|
||||||
// If an EIO error has already occurred, it will be terminated
|
// If an EIO error has already occurred, it will be terminated
|
||||||
// immediately even if retry processing is required.
|
// immediately even if retry processing is required.
|
||||||
s3fscurl->DestroyCurlHandle();
|
s3fscurl->DestroyCurlHandle();
|
||||||
delete s3fscurl;
|
delete s3fscurl;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
S3fsCurl* retrycurl = NULL;
|
S3fsCurl* retrycurl = NULL;
|
||||||
|
|
||||||
@ -4213,13 +4220,17 @@ int S3fsMultiCurl::MultiRead()
|
|||||||
delete s3fscurl;
|
delete s3fscurl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
iter = clist_req.erase(iter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
clist_req.clear();
|
clist_req.clear();
|
||||||
|
|
||||||
if(0 != result){
|
if(0 != result){
|
||||||
// If an EIO error has already occurred, clear all retry objects.
|
// If an EIO error has already occurred, clear all retry objects.
|
||||||
for(s3fscurllist_t::iterator iter = clist_all.begin(); iter != clist_all.end(); ++iter){
|
for(s3fscurllist_t::iterator iter = clist_all.begin(); iter != clist_all.end(); ++iter){
|
||||||
delete (*iter);
|
S3fsCurl* s3fscurl = *iter;
|
||||||
|
s3fscurl->DestroyCurlHandle();
|
||||||
|
delete s3fscurl;
|
||||||
}
|
}
|
||||||
clist_all.clear();
|
clist_all.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user