Closed
Bug 1186341
Opened 10 years ago
Closed 6 years ago
add a azure-entities.Entity object function that does a no-change upgrade
Categories
(Taskcluster :: Services, defect)
Taskcluster
Services
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jhford, Unassigned, Mentored)
Details
We have a great migration support. We have an upgrade function which runs each time an entity is loaded until changes are saved back to the entity. I understand that we don't want a load() method to mutate the object permanently, but it would be really nice if we had a function that I could put in a loop that says "Load this entity, run the migration on it and save the new form" without having to modify the object.
The main reason I want this is because it's a real pain to see debugging output from migrations happen so frequently until the object is modified. I'd like to have debugging output in the migration functions, but having that output every time an entity is loaded is not ideal. It also means that if the migration function changes over time that you might get different results saved back to azure depending on when the object was first mutated after the schema changes.
Comment 1•10 years ago
|
||
@jhford,
So basically, if we have:
var myEntity = base.Entity.configure({
version: 1,
properties: /* version 1 definition */,
}).configure({
version: 2,
properties: /* version 2 definition */,
migrate: ...
});
We should be able to make a stand alone binary in bin/ called bin/migrate.js:
// load config
var cfg = base.config(...);
myEntity.migrateTable();
Then we can run bin/migrate.js as a one-off dyno and delete migration code and version 1 definition
afterwards leaving us with:
var myEntity = base.Entity.configure({
version: 2,
properties: /* version 2 definition */,
});
Is that what you're thinking?
----
I agree that would be nice, and probably fairly easy to do.
Then we can remove legacy code, I like that...
Flags: needinfo?(jhford)
Reporter | ||
Comment 2•10 years ago
|
||
(In reply to Jonas Finnemann Jensen (:jonasfj) from comment #1)
> @jhford,
> So basically, if we have:
> var myEntity = base.Entity.configure({
> version: 1,
> properties: /* version 1 definition */,
> }).configure({
> version: 2,
> properties: /* version 2 definition */,
> migrate: ...
> });
>
> We should be able to make a stand alone binary in bin/ called bin/migrate.js:
> // load config
> var cfg = base.config(...);
>
> myEntity.migrateTable();
>
> Then we can run bin/migrate.js as a one-off dyno and delete migration code
> and version 1 definition
> afterwards leaving us with:
> var myEntity = base.Entity.configure({
> version: 2,
> properties: /* version 2 definition */,
> });
>
>
> Is that what you're thinking?
Yep. The value in not-migrating entities feels very low to me as long as we can do them in a background job. Once we've had a couple of schema changes (say 3-4), the Entity definitions are going to get really messy if we can't do a full table migration.
> ----
> I agree that would be nice, and probably fairly easy to do.
> Then we can remove legacy code, I like that...
Yay!
Flags: needinfo?(jhford)
Updated•9 years ago
|
Component: Platform Libraries → Platform and Services
Comment 3•7 years ago
|
||
This is now in the azure-entities library. The changes would be to add a `migrateTable` method to the Entity class which
- scans all entitites with version less than the latest version
- upgrades them to the latest version
You can find examples of scanning in https://github.com/taskcluster/taskcluster-index/blob/7aca33aa31c3237fd850ba7c73ed823e8f6c13f0/src/data.js#L175-L200
The azure-entities code is pretty sophisticated and uses some trickery with JavaScript "subclassing", so please have a look and ask any specific questions that might come up here in the bug.
Mentor: dustin
Summary: add a base.Entity object function that does a no-change upgrade → add a azure-entities.Entity object function that does a no-change upgrade
Comment 4•7 years ago
|
||
Can I work on this issue ?
Comment 6•7 years ago
|
||
I am not able to upgrade the entity. Can you please guide me ?
Comment 7•7 years ago
|
||
I can't, without any additional information :)
Comment 8•7 years ago
|
||
Hi @dustin. Since I have been going through the code of azure-entities and azure-blob-storage in parallel for the inMemory issue, can I take up this issue in case no one is on it? Thank you.
Comment 9•7 years ago
|
||
Divya, were you able to make any progress, or provide more information on what the problem is? If you're no longer working on this, perhaps it's OK for Kriti to take it?
Flags: needinfo?(divyabaid16)
Comment 11•7 years ago
|
||
@dustin so I am on this. For running tests on azure-entities, I need to use the inmemory version, right? Although(maybe I am doing it wrong), when I pass the account, tablename and credentials in the options of Entity.setup of src/entity.js file, I get the error as 'Provide accountname, accountkey, sas, etc.) and thus the tests don't run due to insufficient credentials. So how do I run the tests? Please guide me. Thank you!
Comment 12•7 years ago
|
||
@dustin so I am on this. For running tests on azure-entities, I need to use the inmemory version, right? Although(maybe I am doing it wrong), when I pass the account, tablename and credentials in the options of Entity.setup of src/entity.js file, I get the error as 'Provide accountname, accountkey, sas, etc.' and thus the tests don't run due to insufficient credentials. So how do I run the tests? Please guide me. Thank you!
Comment 13•7 years ago
|
||
For testing azure-entities, you do need credentials. Other projects that *use* azure-entities can use the inMemory version.
We can get you credentials in two ways: you can sign up for a "free tier" in Azure, and set up a storage account. Or, we could send you a "jungle" account credential for the Taskcluster. For that, we will need your GPG key; the easiest way to set one of those up is with a keybase.io account.
Assignee: divyabaid16 → kritisingh1.ks
Updated•6 years ago
|
Assignee: kritisingh1.ks → nobody
Comment 14•6 years ago
|
||
We'll be migrating away from azure-entities, so there's no sense in adding features.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Assignee | ||
Updated•6 years ago
|
Component: Platform and Services → Services
You need to log in
before you can comment on or make changes to this bug.
Description
•