Skip to content

httpfs: compile remote-read optimization guards on wasm - #71

Merged
adsharma merged 1 commit into
mainfrom
fix-wasm-httpfs-guards
Aug 29, 2026
Merged

httpfs: compile remote-read optimization guards on wasm#71
adsharma merged 1 commit into
mainfrom
fix-wasm-httpfs-guards

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Summary

Fixes the wasm build failure in httpfs/src/httpfs.cpp:

error: unknown type name 'PersistentBlockCache'
error: unknown type name 'PrefetchZone'
error: use of undeclared identifier 'copySpanPortion'
error: use of undeclared identifier 'submitPrefetch'

HTTPFS_REMOTE_READ_OPTIMIZATIONS is 0 on wasm (http_config.h), which compiles out the PrefetchZone/PersistentBlockCache declarations in httpfs.h and the zoneFor/submitPrefetch definitions in httpfs.cpp — but readFromFile() still referenced those types unconditionally.

Changes

  • Hoist copySpanPortion out of the HTTPFS_REMOTE_READ_OPTIMIZATIONS guard: it has no dependency on the guarded cache types and is needed by the L1 LRU-cache path in all builds.
  • Remove the dead #else branch that declared PersistentBlockCache*/PrefetchZone* locals — those types don't exist when optimizations are off.
  • Guard the optimized read layers behind HTTPFS_REMOTE_READ_OPTIMIZATIONS: the L2 (prefetch zone) + L3 (persistent disk cache) block, the write-through/submitPrefetch block after the network fetch, and the trace-log arguments referencing zone/diskCache.

Behavior on native builds is unchanged; the wasm single-threaded path now serves reads via L1 LRU + network fetch as before the optimizations were introduced.

Test plan

  • em++ -fsyntax-only -D__WASM__ on httpfs.cpp: all 4 errors gone.
  • Native release compile command on httpfs.cpp: clean (HTTPFS_REMOTE_READ_OPTIMIZATIONS=1 path unchanged).

HTTPFS_REMOTE_READ_OPTIMIZATIONS is 0 on wasm, which compiles out the
PrefetchZone/PersistentBlockCache declarations and the zoneFor/
submitPrefetch definitions, but readFromFile() still referenced those
types unconditionally, breaking the wasm build.

- Hoist copySpanPortion out of the optimization guard; it only serves
  the L1 LRU path, which exists in all builds.
- Drop the dead #else declarations of the guarded types.
- Guard the L2/L3 cache layers, the write-through/submitPrefetch block
  and the trace-log arguments referencing zone/diskCache behind
  HTTPFS_REMOTE_READ_OPTIMIZATIONS.
@adsharma
adsharma merged commit 6ebd4c5 into main Aug 29, 2026
2 of 4 checks passed
@adsharma
adsharma deleted the fix-wasm-httpfs-guards branch August 29, 2026 17:38
adsharma added a commit to LadybugDB/ladybug that referenced this pull request Aug 29, 2026
- Bump extension submodule: httpfs guarded the remote-read
  optimization code (PersistentBlockCache/PrefetchZone/
  copySpanPortion/submitPrefetch) so that it no longer breaks the
  wasm build where HTTPFS_REMOTE_READ_OPTIMIZATIONS is 0
  (LadybugDB/extensions#71).
- copy_constructors.h: declare the copy helper templates inline
  instead of static. Internal-linkage templates in a header trigger
  -Wunused-template in every TU that includes them without
  instantiating them, and per-TU static copies are an ODR hazard.
adsharma added a commit to LadybugDB/ladybug that referenced this pull request Aug 29, 2026
- Bump extension submodule: httpfs guarded the remote-read
  optimization code (PersistentBlockCache/PrefetchZone/
  copySpanPortion/submitPrefetch) so that it no longer breaks the
  wasm build where HTTPFS_REMOTE_READ_OPTIMIZATIONS is 0
  (LadybugDB/extensions#71).
- copy_constructors.h: declare the copy helper templates inline
  instead of static. Internal-linkage templates in a header trigger
  -Wunused-template in every TU that includes them without
  instantiating them, and per-TU static copies are an ODR hazard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant