Skip to content
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

In Eclipse IDE "Eclipse Open" interval does not have "ide" field #191

Open
levaja opened this issue Jun 24, 2015 · 16 comments
Open

In Eclipse IDE "Eclipse Open" interval does not have "ide" field #191

levaja opened this issue Jun 24, 2015 · 16 comments
Assignees
Labels
Milestone

Comments

@levaja
Copy link
Contributor

levaja commented Jun 24, 2015

In StartUpHandler, in startWatchDog() method, WD is first started and then WatchDogGlobals.hostIDE is set to IDE.ECLIPSE. This causes some intervals not to have their IDE field initialized.

I can add a fix for this in my already opened PR or I can submit a new one, @Inventitech just let me know what do you think.

@Inventitech
Copy link
Contributor

Just reuse your existing PR :-)

@Inventitech
Copy link
Contributor

Good catch!

@levaja
Copy link
Contributor Author

levaja commented Jun 24, 2015

Okay. Don't merge it yet, I'll probably have something more to add :)

@levaja levaja added the bug label Aug 14, 2015
@levaja levaja added this to the WatchDog 1.5 milestone Aug 14, 2015
@levaja levaja self-assigned this Aug 14, 2015
@levaja levaja closed this as completed Aug 24, 2015
@levaja
Copy link
Contributor Author

levaja commented Aug 31, 2015

This bug occured again, with introduction of silent registration. Upcoming fix will solve it once and for all by initializing it before any plugin activity is started.

@levaja levaja reopened this Aug 31, 2015
@levaja levaja mentioned this issue Aug 31, 2015
@levaja levaja closed this as completed Oct 26, 2015
@levaja levaja reopened this Nov 12, 2015
@levaja
Copy link
Contributor Author

levaja commented Nov 12, 2015

@Inventitech I've checked. All intervals (only 23) without "ide" field (in version 1.5.0) belong to 4 different users. All of them later on have intervals belonging to Eclipse.

Thus, this bug only happened in Eclipse.

@Inventitech
Copy link
Contributor

Ok. Thanks for checking.

Add IDE field to all documents which do not already have one
db.intervals.update({"ide":{$exists:false}}, {$set:{"ide":"ec"}}, true, true)

Question: What do the last two false, true do? I cannot find that documented: https://docs.mongodb.org/v2.6/reference/method/db.collection.update/

and do the same for db.users, db.projects and so on.

@levaja
Copy link
Contributor Author

levaja commented Nov 12, 2015

And this command should update all the intervals in the database which don't have "ide" field, to have "ide":"ec":

db.intervals.update({"ide":{$exists:false}},{$set: {"ide":"ec"}}, true, true)

Note that it can take a while to execute it (on my laptop, it took 13 minutes to update 7.28 millions of intervals).

@levaja
Copy link
Contributor Author

levaja commented Nov 12, 2015

Oh, didn't see your comment before mine :-)

https://docs.mongodb.org/manual/reference/method/db.collection.update/#combine-the-upsert-and-multi-options

The first boolean is for "upsert" ('true' means to add a field if it doesn't exist). The second boolean is for "multi" ('true' if we want to apply command on all the intervals returned by query).

@levaja
Copy link
Contributor Author

levaja commented Nov 12, 2015

I've checked User registrations on server and tried to match them with existing intervals:
db.users.find({"ide":{$exists:false},"wdv":"1.5.0"}).forEach(function(item){printjson(db.intervals.distinct("ide",{"userId":item.id}));}).

There are, however, some users of IntelliJ among them (just 5 out of 71) , but also users for which is not possible to determine the ide (probably users without intervals), 31 out of 71. I think it would be the easiest solution to manually update these IntelliJ Users with "ide":"ij", and all the others with "ide":"ec".

For projects:
db.projects.find({"ide":{$exists:false},"wdv":"1.5.0"}).forEach(function(item) {printjson(db.intervals.distinct("ide",{"projectId":item.id}));})

we have only 1 empty (that's good!), 5 IntelliJ and 53 Eclipse projects.

@Inventitech
Copy link
Contributor

Inventitech commented Apr 19, 2016

Check number of intervals with non-ide field:

> db.intervals.count({"ide":{$exists:false}}) 8298778

Then update them
db.intervals.update({"ide":{$exists:false}},{$set: {"ide":"ec"}}, true, true)

@Inventitech
Copy link
Contributor

OK, this seems to have worked
> db.intervals.update({"ide":{$exists:false}},{$set: {"ide":"ec"}}, true, true) WriteResult({ "nMatched" : 8298778, "nUpserted" : 0, "nModified" : 8298778 })

and we get
> db.intervals.count({"ide":{$exists:false}}) 0

@Inventitech
Copy link
Contributor

Inventitech commented Apr 19, 2016

Note to myself: I still need to perform the user-to-IDE matching suggested by Igor in the last comment so that user accounts have the best possible IDE field.

@Inventitech Inventitech reopened this Apr 19, 2016
@Inventitech
Copy link
Contributor

Completed now.

@Inventitech
Copy link
Contributor

Get the empty user/project registrations, perform this check: db.projects.find({"ide":{$exists:false},"wdv":"1.5.0"}).forEach(function(item) {printjson(db.intervals.distinct("ide",{"projectId":item.id}) + " "+ item.id);})

Do some Emacs-magic.

Put them in a var lli = [ "id1", "id2" ]

Then run:

lli.forEach( function(item) { db.projects.update({"id":item},{$set: {"ide":"ij"}}, true, true) })

@Inventitech
Copy link
Contributor

I just discovered we still have this problem, and on a much larger scale now.

@Inventitech Inventitech reopened this Apr 5, 2017
@Inventitech
Copy link
Contributor

Intervals are often missing the ide field, but at least it is always present in the projects. We can thus do a write-over from the projects to the intervals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants