Skip to content

feat: Store metadata in SQLite#1366

Draft
d3xter666 wants to merge 44 commits intofeat/incremental-build-4from
feat/incremental-build-sqlite-native-metadata
Draft

feat: Store metadata in SQLite#1366
d3xter666 wants to merge 44 commits intofeat/incremental-build-4from
feat/incremental-build-sqlite-native-metadata

Conversation

@d3xter666
Copy link
Copy Markdown
Member

@d3xter666 d3xter666 commented Apr 28, 2026

JIRA: CPOUI5FOUNDATION-1209

Uses https://nodejs.org/api/sqlite.html to store incremental build metadata.
Gains write performance, since writing to SQL is non-blocking

@d3xter666 d3xter666 marked this pull request as draft April 28, 2026 06:53
@d3xter666 d3xter666 changed the title Feat/incremental build sqlite native metadata feat: Store metadata in SQLite Apr 28, 2026
RandomByte and others added 28 commits April 28, 2026 10:01
* Improve handling for concurrent resource access and modifications,
  especially when buffering streams.
* Deprecate getStatInfo in favor of dedicated getSize, isDirectory,
getLastModified methods.
* Deprecate synchronous getStream in favor of getStreamAsync and
  modifyStream, allowing for atomic modification of resource content
* Generate Resource hash using ssri
Add msgpackr, better-sqlite3, and classic-level to packages/project
so all cache option branches have these available after npm ci.

CPOUI5FOUNDATION-1174
Native addons like better-sqlite3 and classic-level require
compilation after npm ci. Without rebuild, benchmarks for
options C, D, and E fail with missing binding errors.
npm rebuild does not compile native addons in workspace monorepos.
Run node-gyp rebuild directly in each native addon directory.

Also add --show-output to hyperfine to surface build errors.
Add BuildTimings utility that measures cache read/write and serialization
operations. Enabled via UI5_BUILD_TIMINGS=true environment variable.

Instruments all CacheManager read/write methods and logs a summary table
at the end of the build showing call counts, totals, averages, min, and max
per operation category (Reads, Writes, Resource I/O).
- Option J: Incremental Request Managers
- Option K: Flat JSON Store
- Option L: JSONL+jq Streaming
Adds scripts/run-serve-timings-benchmark.mjs that measures warm-cache
ui5 serve startup performance across all cache option branches.

Spawns ui5 serve --port 0, triggers on-demand build via HTTP GET,
captures Build succeeded timing, then kills the process. Outputs
markdown report and JSON data.
ANSI color codes from chalk can break regex parsing of 'Build succeeded'
and timing table output. Set NO_COLOR=1 to disable all chalk formatting
in the spawned build process.
RandomByte and others added 13 commits April 28, 2026 10:01
* Improve handling for concurrent resource access and modifications,
  especially when buffering streams.
* Deprecate getStatInfo in favor of dedicated getSize, isDirectory,
getLastModified methods.
* Deprecate synchronous getStream in favor of getStreamAsync and
  modifyStream, allowing for atomic modification of resource content
* Generate Resource hash using ssri
Add msgpackr, better-sqlite3, and classic-level to packages/project
so all cache option branches have these available after npm ci.

CPOUI5FOUNDATION-1174
Replace file-based JSON storage with a single SQLite database via
better-sqlite3. All 5 metadata categories stored as tables with
composite keys and JSON text values. WAL mode enabled for read perf.

New file: MetadataStore.js — SQLite wrapper with prepared statements.
CacheManager.js delegates all read/write to MetadataStore.
Added close() lifecycle method.

Expected: ~45% size reduction, ~3x speed, ACID transactions.

CPOUI5FOUNDATION-1174
Add BuildTimings utility that measures cache read/write and serialization
operations. Enabled via UI5_BUILD_TIMINGS=true environment variable.

Instruments all CacheManager read/write methods and logs a summary table
at the end of the build showing call counts, totals, averages, min, and max
per operation category (Reads, Writes, Resource I/O).
Previously BuildTimings.logSummary() was called before cache writes
executed, causing write operations to show 0 calls in the timing report.

Moving the summary log to the finally block after cache writes ensures
all write timings (writeIndexCache, writeTaskMetadata, etc.) are
correctly captured and displayed.
Co-authored-by: Copilot <copilot@github.com>
@d3xter666 d3xter666 force-pushed the feat/incremental-build-sqlite-native-metadata branch from 76a8dbc to 31a0af9 Compare April 28, 2026 07:02
d3xter666 and others added 3 commits April 28, 2026 10:25
Revert changes outside packages/project and scripts to match
the base branch. Restore ContentAddressableStorage usage in
CacheManager and fix getHash() back to getIntegrity() calls.
Co-authored-by: Copilot <copilot@github.com>
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.

3 participants