lakeFS icon indicating copy to clipboard operation
lakeFS copied to clipboard

[Bug]: Error: Invalid Input Error: No magic bytes found at end of file 'lakefs://test-repo/main/lakes.parquet' after merge in tutorial

Open rhprasad0 opened this issue 3 years ago • 7 comments

What happened?

What actually happened, including error codes if applies.

See conversation on slack. AWS setup: EC2, S3, Postgres on RDS freebie. After merge of lakes-denmark and main branches, lakes.parquet in main branch cannot be read. Followed tutorial to the T. lakes-denmark branch works as intended.

Expected behavior

Lakes.parquet was to be queriable after merge in tutorial.

lakeFS version

1.2.0

How lakeFS is installed

AWS EC2, RDS, S3

Affected clients

Web UI

Relevant log output

Error: Invalid Input Error: No magic bytes found at end of file 'lakefs://test-repo/main/lakes.parquet'

Contact details

[email protected]

rhprasad0 avatar Nov 28 '23 18:11 rhprasad0

image

N-o-Z avatar Nov 30 '23 09:11 N-o-Z

Also this conversation on Slack might refer to the same issue.

arielshaqed avatar Dec 05 '23 14:12 arielshaqed

A user report is that 1.2.0 does not display this issue but 1.3.0 does.

arielshaqed avatar Dec 05 '23 14:12 arielshaqed

After delete the service worker running in the chrome application I cloud not reproduce the bug. I'll keep trying to reproduce it for couple of more days - and return to planned in case I fail.

nopcoder avatar Dec 10 '23 13:12 nopcoder

Failed to reproduce - moving back to Planned

nopcoder avatar Dec 11 '23 11:12 nopcoder

How to reproduce

  1. Start from the sample repository, and in the lakeFS UI open the lakefs.parquet file to reach the DuckDB console.

  2. Create a table from the parquet file:

    CREATE OR REPLACE TABLE lakes AS 
     SELECT * FROM READ_PARQUET('lakefs://example-repo/main/lakes.parquet');
    
  3. Now make a change to the table:

     DELETE FROM lakes WHERE Country != 'Denmark';
    
  4. Copy the table back to the parquet file:

    COPY lakes TO 'lakefs://example-repo/main/lakes.parquet';
    
  5. Now commit the changes. and query the table:

    SELECT * FROM READ_PARQUET('lakefs://example-repo/main/lakes.parquet') LIMIT 100;
    
  6. You can now use the following lakectl command to revert the last commit to the one before:

    lakectl branch revert lakefs://example-repo/main $(./lakectl log lakefs://example-repo/main --amount 1 | grep "ID:" | sed s'/ID:[[:space:]]*//') -y
    

    Run this command and execute the query (5) again. Repeat this until the bug is reproduced.

What is happening here

You will see that DuckDB first sends a HEAD request to get the file metadata. It then sends a GET requests for a range within the file, but the browser returns it from the "disk cache".

HEAD request: image

GET request: image

johnnyaug avatar Dec 28 '23 15:12 johnnyaug

DuckDB Wasm discord response - suggest to use cache break while requesting the s3 resources to bypass the browser's cache. Need to validate this solution - understand if it solves also the internal cache that duckdb manages.

nopcoder avatar Jan 01 '24 11:01 nopcoder