You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'bugfix/extended-attributes-mismatch' into develop
Currently, if an `AttributeDescriptor`'s `IsExtendedAttribute` value changes, the configuration value changes, but the actual storage location of _existing_ attributes isn't updated. That's because the `AttributeDescriptor` is primarily used by the `ITopicRepository.Save()` method as well as the **OnTopic Editor**, but doesn't have the ability to _trigger_ broad-sweeping `ITopicRepository.Save()` operations.
This means that the storage location of an attribute may not be persisted until the next time that `AttributeValue` is saved. This can cause a problem, however, as previously, only attributes marked as `IsDirty` would be persisted as indexed attributes. As such, if `IsExtendedAttribute` was changed to _`true`_, then the value would be correctly removed from the indexed attributes storage and added to the extended attributes storage. But if the opposite were the case, it would be successfully removed from extended storage—but not added indexed storage. Ooops!
In practice, this is probably a rare scenario. We default to storing attributes as indexed. And we only store them as `IsExtendedAttribute` if their value exceeds the maximum character limit for an indexed attribute (currently 255 characters). However, in the rare case that this happens, the consequences would be pretty significant. And because this data loss wouldn't occur until any one topic was saved, it may be difficult to track down and account for the cause.
Unfortunately, despite being an edge case, the solution to this is fairly complicated. This bugfix includes the addition of an `IsExtendedAttribute` property to `AttributeValue`, a new `isExtendedAttribute` parameter on `AttributeValueCollection.SetValue()`, a new `IsExtendedAttributeMismatch()` helper in `TopicRepositoryBase`, and a new `excludeLastModified` parameter to the `TopicRepositoryBase.GetAttributes()` method in order to allow returning `IsExtendedAttributeMismatch()`ed when processing indexed attributes without interfering with the logic for byline (`LastModifiedBy`) and dateline (`LastModified`) processing. Whew!
That said, despite the additional _complexity_, this introduces minimal _overhead_ in terms of loading or even saving data. And it prevents a potentially confusing bug that would be difficult and frustrating to recover from if it were tripped. (And, in fact, it has already been tripped a few times—though only with configuration metadata that wasn't critical to the operation of the site.)
0 commit comments