Commit 0cff0d2
fix: use dual schema writer in MemDB to write both legacy and unified schemas
MemDB supports both legacy and unified schema storage, but was only
using LegacySchemaWriterAdapter which after our changes no longer writes
the legacy schema hash. This caused TestUnifiedSchemaHashWatch to fail
with a timeout waiting for hash updates.
Changes:
1. Updated SchemaWriter() to return a dualSchemaWriter that writes to
both legacy and unified storage (SchemaModeReadNewWriteBoth)
2. Refactored schema writing methods to avoid deadlocks:
- Added writeStoredSchemaNoLock() that uses the transaction's
db handle without acquiring additional locks
- Added writeSchemaHashNoLock() for transaction-scoped hash writes
- Added writeLegacySchemaHashFromDefinitionsNoLock() for legacy hash
3. Updated WriteStoredSchema() and WriteLegacySchemaHashFromDefinitions()
to use the transaction's db handle via txSource()
This ensures MemDB writes to both storages and properly updates the
schema hash for watchers, fixing the unified schema hash watch test.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 1c280b6 commit 0cff0d2
2 files changed
+27
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
482 | 467 | | |
483 | 468 | | |
484 | 469 | | |
485 | 470 | | |
486 | | - | |
| 471 | + | |
487 | 472 | | |
488 | 473 | | |
489 | 474 | | |
490 | 475 | | |
491 | 476 | | |
492 | 477 | | |
493 | | - | |
494 | | - | |
| 478 | + | |
| 479 | + | |
495 | 480 | | |
496 | 481 | | |
497 | 482 | | |
498 | 483 | | |
499 | 484 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | 485 | | |
504 | 486 | | |
505 | 487 | | |
| |||
517 | 499 | | |
518 | 500 | | |
519 | 501 | | |
520 | | - | |
| 502 | + | |
521 | 503 | | |
522 | 504 | | |
523 | 505 | | |
524 | 506 | | |
525 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
526 | 510 | | |
527 | 511 | | |
528 | 512 | | |
| |||
547 | 531 | | |
548 | 532 | | |
549 | 533 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | 534 | | |
561 | 535 | | |
562 | 536 | | |
| |||
574 | 548 | | |
575 | 549 | | |
576 | 550 | | |
577 | | - | |
| 551 | + | |
578 | 552 | | |
579 | 553 | | |
580 | 554 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
352 | 354 | | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
356 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
360 | 367 | | |
361 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
362 | 375 | | |
363 | 376 | | |
364 | 377 | | |
| |||
0 commit comments