Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions extension/httpfs/httpfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ unique_ptr<HTTPResponse> HTTPFileSystem::GetRangeRequest(FileHandle &handle, str
}
if (static_cast<int>(response.status) < 300) { // done redirecting
out_offset = 0;

if (response.HasHeader("ETag") && !hfh.etag.empty() && response.GetHeaderValue("ETag") != hfh.etag) {
throw HTTPException(response, "ETag was initially %s and now it returned %s, this likely means the remote file has changed.\nTry restart the read / close file-handle and restart (e.g. `DETACH` in case of database file).", hfh.etag, response.GetHeaderValue("ETag"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

\nTry to restart the read or close the file-handle and read the file again (e.g. `DETACH` in the file is a database file).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably remove the file metadata from the HTTPFS cache so that we are sure to do a new HEAD request upon the next time we read the file (important for when enable_http_metadata_cache is enabled).

Comment on lines +230 to +231
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samansmink's: we do add an option, and error message

}

if (response.HasHeader("Content-Length")) {
auto content_length = stoll(response.GetHeaderValue("Content-Length"));
if ((idx_t)content_length != buffer_out_len) {
Expand Down
Loading