Skip to content

Commit 3eb9059

Browse files
committed
simple_db.ts: add lots of logging and attach "debug IDs" to log messages to help untangle the behavior of distinct instances
1 parent ad06f41 commit 3eb9059

File tree

5 files changed

+297
-129
lines changed

5 files changed

+297
-129
lines changed

packages/firestore/src/local/indexeddb_schema_converter.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ import {
128128
import { MemoryCollectionParentIndex } from './memory_index_manager';
129129
import { MemoryEagerDelegate, MemoryPersistence } from './memory_persistence';
130130
import { PersistencePromise } from './persistence_promise';
131-
import { SimpleDbSchemaConverter, SimpleDbTransaction } from './simple_db';
131+
import {
132+
SimpleDbSchemaConverter,
133+
SimpleDbTransaction,
134+
type IdbDatabaseDebugIdPair
135+
} from './simple_db';
132136

133137
/** Performs database creation and schema upgrades. */
134138
export class SchemaConverter implements SimpleDbSchemaConverter {
@@ -142,7 +146,7 @@ export class SchemaConverter implements SimpleDbSchemaConverter {
142146
* and local feature development.
143147
*/
144148
createOrUpgrade(
145-
db: IDBDatabase,
149+
idbDatabaseDebugIdPair: IdbDatabaseDebugIdPair,
146150
txn: IDBTransaction,
147151
fromVersion: number,
148152
toVersion: number
@@ -154,7 +158,13 @@ export class SchemaConverter implements SimpleDbSchemaConverter {
154158
`Unexpected schema upgrade from v${fromVersion} to v${toVersion}.`
155159
);
156160

157-
const simpleDbTransaction = new SimpleDbTransaction('createOrUpgrade', txn);
161+
const { idbDatabase: db, debugId: dbDebugId } = idbDatabaseDebugIdPair;
162+
163+
const simpleDbTransaction = new SimpleDbTransaction(
164+
'createOrUpgrade',
165+
txn,
166+
{ dbDebugId }
167+
);
158168

159169
if (fromVersion < 1 && toVersion >= 1) {
160170
createPrimaryClientStore(db);

0 commit comments

Comments
 (0)