Commit 53eb317
committed
feat: add unified schema storage with ReadStoredSchema/WriteStoredSchema
Introduce the foundation for unified schema storage, where the entire
compiled schema (definitions + schema text + hash) is stored as a single
serialized proto blob, chunked across rows for SQL datastores.
Datastore interface changes:
- Add ReadStoredSchema(ctx, SchemaHash) to Reader interface
- Add WriteStoredSchema(ctx, *StoredSchema) to ReadWriteTransaction
- Add SchemaHash type with sentinel values for cache bypass
DataLayer interface changes:
- SnapshotReader now takes (Revision, SchemaHash) to thread cache keys
- OptimizedRevision/HeadRevision return SchemaHash alongside Revision
- Add SchemaMode configuration for migration path (legacy → dual → new)
- Add storedSchemaReaderAdapter for reading from StoredSchema protos
- Add writeSchemaViaStoredSchema for building and writing StoredSchema
Storage implementation:
- Add SQLByteChunker generic chunked blob storage for SQL datastores
- Add SQLSingleStoreSchemaReaderWriter for read/write of StoredSchema
- Add per-datastore ReadStoredSchema/WriteStoredSchema implementations
for postgres, crdb, mysql, spanner, and memdb
- Add schema table migrations for all SQL datastores
- Add populate migrations to backfill from legacy namespace/caveat tables
- Rename MySQL schema table to stored_schema (schema is a reserved word)
Caching:
- Add SchemaHashCache with LRU + singleflight for schema-by-hash lookups
Proxy/middleware updates:
- Add ReadStoredSchema/WriteStoredSchema pass-through to all datastore
proxies (observable, counting, readonly, singleflight, indexcheck,
strictreplicated, checkingreplicated, relationshipintegrity, hashcache)
- Update consistency middleware for new HeadRevision/OptimizedRevision
signatures
Proto changes:
- Add StoredSchema message to core.proto with V1StoredSchema containing
schema_text, schema_hash, namespace_definitions, caveat_definitions1 parent 0e16dd1 commit 53eb317
File tree
148 files changed
+9243
-703
lines changed- docs
- internal
- caveats
- datastore
- common
- crdb
- migrations
- memdb
- mysql
- migrations
- postgres
- migrations
- proxy
- indexcheck
- proxy_test
- schemacaching
- spanner
- migrations
- dispatch
- caching
- combined
- graph
- keys
- remote
- singleflight
- graph
- computed
- middleware/pertoken
- namespace
- relationships
- services
- integrationtesting
- consistencytestutil
- v1
- telemetry/otelconv
- testfixtures
- pkg
- cache
- cmd
- server
- cursor
- datalayer
- mocks
- datastore
- mocks
- test
- development
- middleware
- consistency
- datalayer
- proto
- core/v1
- dispatch/v1
- impl/v1
- query
- benchmarks
- schemadsl/generator
- services/v1
- proto/internal
- core/v1
- dispatch/v1
- impl/v1
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
148 files changed
+9243
-703
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
20 | 34 | | |
21 | 35 | | |
22 | 36 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
527 | | - | |
| 527 | + | |
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
559 | | - | |
| 559 | + | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
597 | | - | |
| 597 | + | |
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
| 665 | + | |
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
745 | | - | |
| 745 | + | |
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
826 | | - | |
| 826 | + | |
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
| |||
81 | 90 | | |
82 | 91 | | |
83 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
84 | 105 | | |
85 | 106 | | |
86 | 107 | | |
87 | 108 | | |
88 | 109 | | |
89 | 110 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
93 | 114 | | |
94 | | - | |
| 115 | + | |
95 | 116 | | |
96 | 117 | | |
97 | | - | |
| 118 | + | |
98 | 119 | | |
99 | 120 | | |
100 | | - | |
| 121 | + | |
101 | 122 | | |
102 | 123 | | |
103 | | - | |
| 124 | + | |
104 | 125 | | |
105 | 126 | | |
106 | | - | |
| 127 | + | |
107 | 128 | | |
108 | 129 | | |
109 | | - | |
| 130 | + | |
110 | 131 | | |
111 | 132 | | |
112 | | - | |
| 133 | + | |
113 | 134 | | |
114 | 135 | | |
115 | 136 | | |
116 | | - | |
| 137 | + | |
117 | 138 | | |
118 | 139 | | |
119 | | - | |
| 140 | + | |
120 | 141 | | |
121 | 142 | | |
122 | 143 | | |
123 | 144 | | |
124 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
125 | 155 | | |
| 156 | + | |
126 | 157 | | |
127 | 158 | | |
128 | 159 | | |
| |||
143 | 174 | | |
144 | 175 | | |
145 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
146 | 184 | | |
147 | 185 | | |
148 | 186 | | |
| |||
186 | 224 | | |
187 | 225 | | |
188 | 226 | | |
| 227 | + | |
189 | 228 | | |
190 | 229 | | |
191 | 230 | | |
| |||
230 | 269 | | |
231 | 270 | | |
232 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
233 | 276 | | |
234 | 277 | | |
235 | 278 | | |
| |||
279 | 322 | | |
280 | 323 | | |
281 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
282 | 329 | | |
283 | 330 | | |
284 | 331 | | |
| |||
292 | 339 | | |
293 | 340 | | |
294 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
295 | 346 | | |
296 | 347 | | |
297 | 348 | | |
298 | 349 | | |
299 | 350 | | |
300 | 351 | | |
| 352 | + | |
| 353 | + | |
301 | 354 | | |
302 | 355 | | |
303 | 356 | | |
304 | 357 | | |
305 | 358 | | |
306 | 359 | | |
307 | 360 | | |
308 | | - | |
| 361 | + | |
309 | 362 | | |
310 | 363 | | |
311 | 364 | | |
| |||
338 | 391 | | |
339 | 392 | | |
340 | 393 | | |
341 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
342 | 398 | | |
343 | 399 | | |
344 | 400 | | |
| |||
0 commit comments