-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
OpenStack SWIFT: fseek(): stream does not support seeking #25954
Comments
This comment has been minimized.
This comment has been minimized.
My traceback says also a problem arised in The code says // Streams may advertise themselves as seekable, but still not
// actually allow fseek. We'll manually go forward in the stream
// if fseek failed.
if (!stream_get_meta_data($body)['seekable'] || -1 === fseek($body, $start, SEEK_SET)) {
$consumeBlock = 8192;
for ($consumed = 0; $start - $consumed > 0;) {
if (feof($body)) {
throw new Exception\RequestedRangeNotSatisfiable('The start offset ('.$start.') exceeded the size of the entity ('.$consumed.')');
}
$consumed += strlen(fread($body, min($start - $consumed, $consumeBlock)));
}
} however as seen the public function stream_seek($offset, $whence = SEEK_SET) {
$result = fseek($this->source, $offset, $whence);
return $result == 0 ? true : false;
} that returns |
Ok, i discovered there is --- lib/private/Files/ObjectStore/Swift.php.orig 2021-02-24 20:07:09.000000000 +0100
+++ lib/private/Files/ObjectStore/Swift.php 2021-03-17 17:27:04.987925583 +0100
@@ -29,12 +29,13 @@
use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use function GuzzleHttp\Psr7\stream_for;
-use Icewind\Streams\RetryWrapper;
+use Icewind\Streams\SeekableWrapper;
use OCP\Files\NotFoundException;
use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\StorageAuthException;
-const SWIFT_SEGMENT_SIZE = 1073741824; // 1GB
+
+const SWIFT_SEGMENT_SIZE = 209715200;
class Swift implements IObjectStore {
/**
@@ -126,7 +127,7 @@
}
}
- return RetryWrapper::wrap($response->getBody()->detach());
+ return SeekableWrapper::wrap($response->getBody()->detach());
}
/** Can anybody confirm? |
I can try it next week. |
Still, I think the approach as in #20033 is better, as Swift supports |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Still valid on NC 23.0.4 |
Duplicate of #8275 or #14617 but for OpenStack SWIFT, as #20033 does NOT fix it (it is intended for S3 only).
The text was updated successfully, but these errors were encountered: