Skip to content

Handle attribute configuration mismatch on Save() #24

@JeremyCaney

Description

@JeremyCaney

Background

Currently, when calling ITopicRepository.Save()—and especially SqlTopicRepository.Save()all attributes flagged as AttributeDescriptor.IsExtendedAttribute are sent to the UpdateTopic stored procedure's @ExtendedAttributesXml parameter, but only AttributeValue.IsDirty attributes are sent via the @Attributes parameter.

Problem

This introduces a wrinkle when supporting moved attributes—i.e., attribute values that haven't changed, but whose storage location has been reconfigured via AttributeDescriptor.IsExtendedAttribute since the Topic was last Save()d. This can potentially result in data loss, since the ExtendedAttributesXml is always saved (thus deleting the attribute from the IsExtendedAttribute store), but only changed attributes are stored in the indexed attribute store.

Solution

To handle this, we should ideally factor in configuration mismatches as part of Save(). This would require tracking where attributes came from (e.g., via a AttributeValue.IsExtendedAttribute property) so that we can detect mismatches with the configuration (via the AttributeDescriptor.IsExtendedAttribute property). Then, any mismatched attributes would be sent to their respective store, regardless of whether or not they have been changed (i.e., independent of IsDirty()).

Implementation

  • AttributeValue.IsExtendedAttribute
  • AttributeValueCollection.SetValue(…, isExtendedAttribute)
  • Call SetValue(…, isExtendedAttribute) from SqlTopicRepository.Load()
  • TopicRepositoryBase.IsExtendedAttributeMismatch()
  • Factor IsExtendedAttributeMismatch() into GetAttributes()
  • Factor IsExtendedAttributeMismatch() into Save()

Metadata

Metadata

Assignees

Labels

Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Priority: 2Severity 0: Nice to haveStatus 5: CompleteTask is considered complete, and ready for deployment.Type: BugBehavior that is inconsistent with documented or expected behavior.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions