-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow legacy deduplication #741
base: master
Are you sure you want to change the base?
Conversation
it has still been processed
jh-bate updated values.yaml file in qa3 |
jh-bate updated flux policies file in qa3 |
jh-bate deployed platform jf_deduplication branch to qa3 namespace |
/deploy qa3 data |
jh-bate updated values.yaml file in qa3 |
jh-bate updated flux policies file in qa3 |
jh-bate deployed platform jf_deduplication branch to qa3 namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of questions and comments, but it is a lot of code. :)
|
||
func (m *DataMigration) writeErrors() { | ||
if !m.settings.writeToDisk { | ||
m.groupedErrors = map[string][]ErrorData{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this return
here?
return nil | ||
} | ||
|
||
func (c MigrationStats) report() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put this with the rest of MigrationStats
?
@@ -0,0 +1,175 @@ | |||
package utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What all are we doing here? Just adding the deduplicator name, version, and hash, right? Can we just replace this with a direct Mongo update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I am beginning to wonder if it is even required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after discussion with Jimmy and how he ran the test I don't think this is required any longer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you keep this code in a separate saved feature branch, just in case.
/deploy qa3 data |
jh-bate updated values.yaml file in qa3 |
jh-bate updated flux policies file in qa3 |
jh-bate deployed platform jf_deduplication branch to qa3 namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more changes and clarifications. Plus, one thing we should chat about regarding the deduplication version versus the identity fields version.
data/store/mongo/mongo_data_set.go
Outdated
|
||
if filter.IsLegacy != nil && *filter.IsLegacy { | ||
selector["_id"] = bson.M{"$not": bson.M{"$type": "objectId"}} | ||
if filter.LegacyOnly != nil { | ||
if *filter.LegacyOnly { | ||
selector["_id"] = bson.M{"$not": bson.M{"$type": "objectId"}} | ||
} else { | ||
selector["_id"] = bson.M{"$type": "objectId"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it was either rename it to LegacyOnly
OR change the code. I'd revert this code back to what it was deleted here.
data/types/bolus/bolus.go
Outdated
if b.DeliveryContext != nil { | ||
validator.String("deliveryContext", b.DeliveryContext).Exists().OneOf(DeliveryContext()...) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just change to:
if b.DeliveryContext != nil { | |
validator.String("deliveryContext", b.DeliveryContext).Exists().OneOf(DeliveryContext()...) | |
} | |
validator.String("deliveryContext", b.DeliveryContext).OneOf(DeliveryContext()...) |
There is no need for the b.DeliveryContext != nil
. The validator handles that via the Exists
test, which we also don't want because this field is optional.
DeviceDeactivateHashVersionUnknown string = "" | ||
DeviceDeactivateHashVersionCurrent string = types.IdentityFieldsVersion | ||
DeviceDeactivateHashVersionLegacy string = types.LegacyIdentityFieldsVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually don't need the string
type as it is implicit.
DeviceDeactivateHashVersionUnknown string = "" | |
DeviceDeactivateHashVersionCurrent string = types.IdentityFieldsVersion | |
DeviceDeactivateHashVersionLegacy string = types.LegacyIdentityFieldsVersion | |
DeviceDeactivateHashVersionUnknown = "" | |
DeviceDeactivateHashVersionCurrent = types.IdentityFieldsVersion | |
DeviceDeactivateHashVersionLegacy = types.LegacyIdentityFieldsVersion |
if *dataSet.Deduplicator.Version != "" { | ||
return *dataSet.Deduplicator.Version | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this conditional. It is checked two lines above.
if *dataSet.Deduplicator.Version != "" { | |
return *dataSet.Deduplicator.Version | |
} | |
return *dataSet.Deduplicator.Version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think may need to modify this. Since we are just returning the *dataSet.Deduplicator.Version
here it is very possible is not either either the current or the legacy and the logic would break. I think we may need to break the intertwined DeviceDeactivateHashVersionLegacy
and types.LegacyIdentityFieldsVersion
.
Let's chat about this next week.
} | ||
} | ||
|
||
var missingLegacyGroupIdErr = errors.New("missing required legacy groupId for the device deactive hash legacy version") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really want to create static error variables since it loses the context of where the error actually originated from (the caller
). Just take the right side and replace it in the two locations of missingLegacyGroupIdErr
.
return missingLegacyGroupIdErr | ||
} | ||
case DeviceDeactivateHashVersionCurrent: | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to ensure there is no LegacyGroupID
specified here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it does no harm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to make some changes to the versions. Let's chat tomorrow.
@@ -24,8 +24,6 @@ func NewBase(name string, version string) (*Base, error) { | |||
} | |||
if version == "" { | |||
return nil, errors.New("version is missing") | |||
} else if !net.IsValidSemanticVersion(version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed?
DeviceDeactivateHashVersionUnkown DeviceDeactivateHashVersion = "" | ||
DeviceDeactivateHashVersionCurrent DeviceDeactivateHashVersion = "1.1.0" | ||
DeviceDeactivateHashVersionLegacy DeviceDeactivateHashVersion = "0.0.0" | ||
DeviceDeactivateHashVersionUnknown = "unknown-hash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think we have a disconnect. I may not have explained myself very well. These version strings need to remain the same.
There need to be two separate version groups.
First, the version of the DeviceDeactivationHash deduplicator. That would be "0.0.0" (for Jellyfish) and "1.1.0" (for current Platform).
Second, the version of the identity fields, that would be, for simplicity, "0" (for legacy) and "1" (for current). This is what is passed into the datum.IdentityFields function.
The hash function and HashOptions, since it is not specific to the DeviceDeactivateHash deduplicator, should use the identity fields version.
Or, for complete separation of concerns, you could add a third version, the hash version, either "0" or "1".
So, then the code maps from deduplicator version to hash version to identity fields version.
The DeviceDeactivateHash code looks at its version, maps its version to a hash version and creates the HashOptions with that version. Then, the hash code looks at its version, maps its version to an identity field versions and calls IdentityFields with that identity field version.
Then, you've completely isolated the DeviceDeactivationHash deduplicator from the hash functionality from the identity fields functionality. In practice, we definitely have to do the first step (deduplicator version to hash version) because there will be another duplicator for continuous data sets that is not based off the device id, but the data set id, and doesn't deactivate, but deletes.
Technically, we don't actually need the hash version and could just use the identity fields version for both hash function and IdentityFields function.
Does that make sense? Let's chat about this tomorrow.
back-37 - Migrate all existing jellyfish data to add required Platform deduplication hash using the existing generated jellyfish
_id
back-2773 - Update platform to validate certain fields in pumpSettingsOverride and overridePresets
back-2728 - Support tandem pumpSettings in the platform
back-2520 - Data model changes to support Control-IQ sleep schedules
BACK-2607 - Bolus includes deliveryContext
BACK-3074 - basal/suspend to remove the duration maximum validation