Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch sahpool-digest Excluding Merge-Ins
This is equivalent to a diff from f786de8d18 to 500f2e6ec7
2025-03-16
| ||
14:05 | Fix a long-standing filename digest computation bug in the OPFS SAHPool VFS which caused all VFS-stored filenames to have a digest value of 0. See /forumpost/042d53c928382021 for full details. (check-in: 493cbe7450 user: stephan tags: trunk) | |
2025-03-14
| ||
12:37 | Fix an internal doc typo reported in forum post e25e581f917. (check-in: fa6f6ccdff user: stephan tags: trunk) | |
11:14 | Minor doc corrections for the sahpool-digest fix and merge in current trunk. (Closed-Leaf check-in: 500f2e6ec7 user: stephan tags: sahpool-digest) | |
09:34 | Cherrypick the [2b582c0097e33] doc addition, which was initially committed to the wrong branch. (check-in: f786de8d18 user: stephan tags: trunk) | |
2025-03-13
| ||
18:51 | Fix the generate_series extension for the case where the termination value is not an even multiple of the step from the start value and there is also a value=NNN constraint in the WHERE clause. Forum post bf2dc8e9 (check-in: 75e72e3b0d user: drh tags: trunk) | |
2025-03-12
| ||
11:41 | Document that sqlite_update_hook() can unset the current hook by passing a NULL callback, to address forum post 652aef4747. (check-in: 2b582c0097 user: stephan tags: cygwin-fixes) | |
2025-02-26
| ||
03:32 | Merge trunk into the sahpool-digest branch. (check-in: fc1eeb7d1f user: stephan tags: sahpool-digest) | |
Changes to ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js.
︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | left in OPFS but are treated as transient by this VFS and they will be cleaned up during VFS init. */ const PERSISTENT_FILE_TYPES = capi.SQLITE_OPEN_MAIN_DB | capi.SQLITE_OPEN_MAIN_JOURNAL | capi.SQLITE_OPEN_SUPER_JOURNAL | capi.SQLITE_OPEN_WAL; const FLAG_COMPUTE_DIGEST_V2 = capi.SQLITE_OPEN_MEMORY /* Part of the fix for https://github.com/sqlite/sqlite-wasm/issues/97 Summary: prior to version 3.50.0 computeDigest() always computes a value of [0,0] due to overflows, so it does not do anything useful. Fixing it invalidates old persistent files, so we instead only fix it for files created or updated since the bug was discovered and fixed. This flag determines whether we use the broken legacy computeDigest() or the v2 variant. We only use this flag for newly-created/overwritten files. Pre-existing files have the broken digest stored in them so need to continue to use that. What this means, in terms of db file compatibility between versions: - DBs created with versions older than this fix (<3.50.0) can be read by post-fix versions. Such DBs which are written to in-place (not replaced) by newer versions can still be read by older versions, as the affected digest is only modified when the SAH slot is assigned to a given filename. - DBs created with post-fix versions will, when read by a pre-fix version, be seen as having a "bad digest" and will be unceremoniously replaced by that pre-fix version. When swapping back to a post-fix version, that version will see that the file entry is missing the FLAG_COMPUTE_DIGEST_V2 bit so will treat it as a legacy file. This flag is stored in the same memory as the various SQLITE_OPEN_... flags and we must be careful here to not use a flag bit which is otherwise relevant for the VFS. SQLITE_OPEN_MEMORY is handled by sqlite3_open_v2() and friends, not the VFS, so we'll repurpose that one. If we take a currently-unused bit and it ends up, at some later point, being used, we would have to invalidate existing VFS files in order to move to another bit. Similarly, if the SQLITE_OPEN_MEMORY bit were ever reassigned (which it won't be!), we'd invalidate all VFS-side files. */; /** Subdirectory of the VFS's space where "opaque" (randomly-named) files are stored. Changing this effectively invalidates the data stored under older names (orphaning it), so don't do that. */ const OPAQUE_DIR_NAME = ".opaque"; /** |
︙ | |||
325 326 327 328 329 330 331 332 333 334 335 336 337 338 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | + | } return e ? (e.sqlite3Rc || capi.SQLITE_IOERR) : 0; }, //xSleep is optionally defined below xOpen: function f(pVfs, zName, pFile, flags, pOutFlags){ const pool = getPoolForVfs(pVfs); try{ flags &= ~FLAG_COMPUTE_DIGEST_V2; pool.log(`xOpen ${wasm.cstrToJs(zName)} ${flags}`); // First try to open a path that already exists in the file system. const path = (zName && wasm.peek8(zName)) ? pool.getPath(zName) : getRandomName(); let sah = pool.getSAHForPath(path); if(!sah && (flags & capi.SQLITE_OPEN_CREATE)) { |
︙ | |||
620 621 622 623 624 625 626 | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | - + + | this.#apBody); this.setAssociatedPath(sah, '', 0); return ''; } const fileDigest = new Uint32Array(HEADER_DIGEST_SIZE / 4); sah.read(fileDigest, {at: HEADER_OFFSET_DIGEST}); |
︙ | |||
651 652 653 654 655 656 657 658 659 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | + + + + + + + - - + + + + - - - - - - - - + + + + + + + + + + + + + | in the metadata. */ setAssociatedPath(sah, path, flags){ const enc = textEncoder.encodeInto(path, this.#apBody); if(HEADER_MAX_PATH_SIZE <= enc.written + 1/*NUL byte*/){ toss("Path too long:",path); } if(path && flags){ /* When creating or re-writing files, update their digest, if needed, to v2. We continue to use v1 for the (!path) case (empty files) because there's little reason not to use a digest of 0 for empty entries. */ flags |= FLAG_COMPUTE_DIGEST_V2; } this.#apBody.fill(0, enc.written, HEADER_MAX_PATH_SIZE); this.#dvBody.setUint32(HEADER_OFFSET_FLAGS, flags); |
︙ |
Changes to ext/wasm/tester1.c-pp.js.
︙ | |||
3502 3503 3504 3505 3506 3507 3508 | 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 | - + | ++nAuxReused; } return x; } }); db.exec([ "create table t(a);", |
︙ |
Added ext/wasm/tests/opfs/sahpool/digest-worker.js.