Skip to content

Conversation

@SantoshNC68
Copy link
Member

Applicable Issues

NA

Description of the Change

Made code changes to handle the updation of events in Object to Event mapper.
Also updated the logic to not store duplicate eventIds.

Alternate Designs

Benefits

Performance improvements in storing the ObjectToEvent mapping relation without having to query multiple times.

Possible Drawbacks

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: @SantoshNC68 , @raja-maragani

@SantoshNC68 SantoshNC68 changed the title Maintainance Fix for MongoDBHandling on ObjectToEvent map handling Aug 23, 2020
Copy link
Member

@e-pettersson-ericsson e-pettersson-ericsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly comments on javadoc. Are there no updates needed in the tests for these changes?

@SantoshNC68
Copy link
Member Author

Fixed comments from Emelie in 74d6c4b

Copy link
Member

@e-pettersson-ericsson e-pettersson-ericsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the tests still needs to be updated, but otherwise I commented mostly on logging and general naming.


public boolean isEventInEventObjectMap(String eventId) {
String condition = "{\"_id\" : \"" + eventId + "\"}";
String condition = "{\"objects\": { \"$in\" : [\"" + eventId + "\"]} }";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the top of this class a variable is defined for this key called 'listPropertyName' - use it here also. However, given that you've changed the structure of this document to look like:

```
"_id": "aggregated-object-id",
 "objects": ["event-id", "event-id"]
```

the key of the list should perhaps be called "events" instead of "objects"? It would look somehting like this instead:

```
"_id": "aggregated-object-id",
 "events": ["event-id", "event-id"]
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the top of this class a variable is defined for this key called 'listPropertyName' - use it here also. However, given that you've changed the structure of this document to look like:

"_id": "aggregated-object-id",
"objects": ["event-id", "event-id"]

the key of the list should perhaps be called "events" instead of "objects"? It would look somehting like this instead:

"_id": "aggregated-object-id",
"events": ["event-id", "event-id"]

changed "events" instead of "objects"

Copy link
Contributor

@durga-vasaadi durga-vasaadi Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"events" instead of "objects" changes will come in future, this changes will be release ASAP, could you please review the current changes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see another PR open, which duplicates this one. Please update the changes in this PR and close the other one (then we keep the review history also) It's possible for @SantoshNC68 to allow @durga-vasaadi as collaborator on your fork, and this way you can both push to this one PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I have done that and we have worked together, but because of the issues on the travis we have another PR. We will close that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we will not make changes for events in this PR but will do it another PR as we need to see the impact of that.

try {
// lock and get the AggregatedObject
String aggregatedObject = getAggregatedObject(id, true);
LOGGER.debug("AGGREGATED OBJECT : " + aggregatedObject);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want to log the entire aggregation twice? They can be very big, so it might clutter the log.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed logger

@tobiasake
Copy link
Contributor

What is the plan of these latest changes. Are the plan to merge this to Master ? Or just have it in this 2.0 maintenance branch and never have it on Master.
There is an internal ticket about redo the whole latest 2.x releases due to the issue of queueing up event/aggregations in Java memory instead of letting those event wait in RabbitMq instead until EI can process them instead of having this waiting in Memory which is not persistent if Queue is full or EI crash, all this event/aggregation processing is lost.

As it is now, it can't be merge directly to master. You need to implement same thing one more time, but for Master branch on PR based on Master branch code base.

@SantoshNC68
Copy link
Member Author

What is the plan of these latest changes. Are the plan to merge this to Master ? Or just have it in this 2.0 maintenance branch and never have it on Master.
There is an internal ticket about redo the whole latest 2.x releases due to the issue of queueing up event/aggregations in Java memory instead of letting those event wait in RabbitMq instead until EI can process them instead of having this waiting in Memory which is not persistent if Queue is full or EI crash, all this event/aggregation processing is lost.

As it is now, it can't be merge directly to master. You need to implement same thing one more time, but for Master branch on PR based on Master branch code base.

Yes they will need to be updated in the master branch also and we will make it as a separate PR for master branch.

for (String expectedID : new ArrayList<>(checklist)) {
if (expectedID.equals(document.get("_id").toString())) {
checklist.remove(expectedID);
Document objects = (Document) document.get("objects"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be "events"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis complains a lot about compilation errors, which can be discovered earlier if you run the maven commands in your local environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be events. Just wanted to check why the travis has been failing.

Copy link
Member

@e-pettersson-ericsson e-pettersson-ericsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to test this locally due to my Java environment, but since I know it's been tested in a real environment and I realize time is of the essence for this fix, I'll approve it. But I hope the remaining comments will be fixed in an upcoming PR as soon as possible. And that these changes are also made on master if the same issue occurs there.

@SantoshNC68 SantoshNC68 merged commit ce574ff into eiffel-community:2.0.0-maintenance Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants