-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
The logic for parsing and loading the DocumentMetadataFields from the underlying BSON should be moved into DocumentMetadataFields to control the sprawl of metadata logic.
Along that change, we should fix a logic issue in loadLazyMetadata(). Before loading the metadata, we check the current status of "metadataFields.isModified()" so that we can "reset" that status after loading the metadata. However, this could cause a bug: If "score" originally has a value of 5 and then we overwrite a value of 10 without having lazy-loaded the metadata, later when the metadata is lazy-loaded, it'll appear as if 5 was the modified value rather than the original value. Luckily, we make sure to call lazyLoadMetadata() in turn so that this bug could never happen, but we should change this logic to instead _assert that "metadataFields.isModified()" is always false before lazy-loading metadata. If we're lazy-loading after having modified the metadata, we risk the misleading overwrite.