Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function tableRequiresUpdate({
const { metadata } = table;

/** Check clustering */
const configCluster = JSON.stringify(config.clustering);
const configCluster = JSON.stringify(config.clustering || []);
const tableCluster = JSON.stringify(metadata.clustering?.fields || []);
if (configCluster !== tableCluster) return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,30 @@ if (!admin.apps.length) {
initializeApp();
}

const settingsApplied = new Set<string>();

const getConfiguredFirestore = (instanceId: string) => {
Comment thread
cabljac marked this conversation as resolved.
Outdated
const db = getFirestore(instanceId);
if (!settingsApplied.has(instanceId)) {
settingsApplied.add(instanceId);
try {
db.settings({ ignoreUndefinedProperties: true });
} catch {
// Firestore.settings() throws if the singleton has already been used
// elsewhere in the process. The dead-letter path doesn't strictly
// depend on ignoreUndefinedProperties, so swallow rather than crash
// and mask the original BigQuery error that led us here.
}
}
return db;
};

export default async (
rows: any[],
config: ChangeTrackerConfig,
e: Error
): Promise<void> => {
const db = getFirestore(config.firestoreInstanceId!);
db.settings({
ignoreUndefinedProperties: true,
});
const db = getConfiguredFirestore(config.firestoreInstanceId!);
Comment thread
cabljac marked this conversation as resolved.
Outdated
const batchArray = [db.batch()];

let operationCounter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ export class FirestoreBigQueryEventHistoryTracker

await clustering.updateClustering(metadata);

const documentIdColExists = fields.find(
const documentIdColExists = !!fields.find(
(column) => column.name === "document_id"
);
Comment thread
cabljac marked this conversation as resolved.
Outdated
const pathParamsColExists = fields.find(
const pathParamsColExists = !!fields.find(
(column) => column.name === "path_params"
);
Comment thread
cabljac marked this conversation as resolved.
Outdated

const oldDataColExists = fields.find(
const oldDataColExists = !!fields.find(
(column) => column.name === "old_data"
);
Comment thread
cabljac marked this conversation as resolved.
Outdated

Expand Down
Loading