Commit 9571d6e
committed
fix: restore DATE serialiser patch + address bugbot sweep findings
V1 live-api CI on 4aa768b still reproduced 33 "Incorrect datetime
value: '... +00:00'" errors on Audit mirror writes - the exact base-
DATE._stringify signature. Local instrumentation shows every MySQL
INSERT path (bulkInsert, insertQuery, upsert) dispatches through
mysql.DATE._stringify, so the CI observation points to some
Sequelize-internal path we can't isolate from here that prototype-
invokes the base method on a mysql attribute type.
Rather than continue bisecting Sequelize internals, restore a
targeted patch on Sequelize.DataTypes.DATE.prototype._stringify that
strips the " +00:00" offset suffix (MariaDB strict mode rejects it)
while keeping "YYYY-MM-DD HH:mm:ss.SSS" fractional seconds so local
SQLite round-trips preserve millisecond precision. Legacy SQLite
rows still round-trip via sqlite.DATE.parse's `date.includes("+")`
branch. Uses a static ESM `import moment from 'moment'` (the prior
attempt with `require('moment')` threw ReferenceError under ESM and
was silently swallowed by safeMirrorDbHandler's catch).
Also addresses the two open Bugbot findings:
- V1 `mirrorDBEnabled()` always returned true in test mode. The
in-process cost was the on-startup 11-table backfill iterating
every source/mirror pair. Gate the startup backfill on
isMysqlMirrorConfiguredForReconnect() instead of mirrorDBEnabled()
so SQLite-fallback test runs skip it. Keep mirrorDBEnabled() true
in mirrorTest mode - V1 integration tests rely on that implicit
test enablement for SQLite-fallback mirror writes to land.
- sweepMirrorOrphans[V2] loaded every PK from both mirror and source
tables in a single unbounded findAll. Replace with keyset-paginated
scans. Peak memory is now O(|mirror|) for the orphan-candidate set
rather than O(|mirror|+|source|); the source side is streamed.
Restore the original mirror-first scan order (a pre-push review
caught that an earlier refactor inverted it, which allowed false-
positive orphan deletes for rows inserted concurrently between the
source scan and the mirror scan).1 parent 4aa768b commit 9571d6e
4 files changed
Lines changed: 253 additions & 86 deletions
File tree
- src
- config
- database
- v2
- tests/v2/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
6 | 45 | | |
7 | 46 | | |
8 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
86 | 100 | | |
87 | 101 | | |
88 | 102 | | |
| |||
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
95 | | - | |
96 | 109 | | |
97 | 110 | | |
98 | 111 | | |
| |||
332 | 345 | | |
333 | 346 | | |
334 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
335 | 363 | | |
336 | 364 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
346 | 385 | | |
347 | 386 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
360 | 407 | | |
361 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
362 | 412 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
368 | 416 | | |
369 | 417 | | |
370 | 418 | | |
| |||
644 | 692 | | |
645 | 693 | | |
646 | 694 | | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
651 | 706 | | |
652 | 707 | | |
653 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
602 | 617 | | |
603 | 618 | | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
613 | 639 | | |
614 | 640 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
627 | 661 | | |
628 | 662 | | |
629 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
630 | 666 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
636 | 670 | | |
637 | 671 | | |
638 | 672 | | |
| |||
0 commit comments