Skip to content

Commit 5714d9f

Browse files
committed
Initial fixes for parameter lookups.
1 parent df561c0 commit 5714d9f

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

modules/module-mongodb-storage/src/storage/implementation/MongoSyncBucketStorage.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class MongoSyncBucketStorage
348348
[
349349
{
350350
$match: {
351-
'key.g': this.group_id,
351+
'key.g': 0,
352352
lookup: { $in: lookupFilter },
353353
_id: { $lte: checkpoint.checkpoint }
354354
}
@@ -661,14 +661,16 @@ export class MongoSyncBucketStorage
661661
if (keepParameterLookupIds.has(id)) {
662662
continue;
663663
}
664-
await this.retriedDelete(`deleting parameter lookup data for ${name}`, signal, () =>
665-
this.db.bucket_parameters.deleteMany(
666-
{
667-
'key.g': id
668-
},
669-
{ maxTimeMS: lib_mongo.db.MONGO_CLEAR_OPERATION_TIMEOUT_MS }
670-
)
671-
);
664+
// FIXME: how do we do these deletes?
665+
// For now, we delete only when the source table is removed.
666+
// await this.retriedDelete(`deleting parameter lookup data for ${name}`, signal, () =>
667+
// this.db.bucket_parameters.deleteMany(
668+
// {
669+
// 'key.g': id
670+
// },
671+
// { maxTimeMS: lib_mongo.db.MONGO_CLEAR_OPERATION_TIMEOUT_MS }
672+
// )
673+
// );
672674
}
673675
}
674676

@@ -726,14 +728,23 @@ export class MongoSyncBucketStorage
726728
.toArray();
727729

728730
for (let table of tables) {
729-
await this.retriedDelete('deleting current data records for table', signal, () =>
731+
await this.retriedDelete(`deleting current data records for table ${table.table_name}`, signal, () =>
730732
this.db.current_data.deleteMany(
731733
{
732734
_id: idPrefixFilter<SourceKey>({ g: 0, t: table._id }, ['k'])
733735
},
734736
{ maxTimeMS: lib_mongo.db.MONGO_CLEAR_OPERATION_TIMEOUT_MS }
735737
)
736738
);
739+
await this.retriedDelete(`deleting parameter data records for table ${table.table_name}`, signal, () =>
740+
this.db.bucket_parameters.deleteMany(
741+
{
742+
key: idPrefixFilter<SourceKey>({ g: 0, t: table._id }, ['k'])
743+
},
744+
{ maxTimeMS: lib_mongo.db.MONGO_CLEAR_OPERATION_TIMEOUT_MS }
745+
)
746+
);
747+
737748
await this.db.source_tables.deleteOne({ _id: table._id }); // Delete the source table record itself
738749
}
739750
}
@@ -1067,7 +1078,7 @@ export class MongoSyncBucketStorage
10671078
.find(
10681079
{
10691080
_id: { $gt: options.lastCheckpoint.checkpoint, $lte: options.nextCheckpoint.checkpoint },
1070-
'key.g': this.group_id
1081+
'key.g': 0
10711082
},
10721083
{
10731084
projection: {

0 commit comments

Comments
 (0)