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

Known ordering for RollupCalculateJob records #518

Closed
rogeramitchell opened this issue Jun 13, 2017 · 10 comments · Fixed by #536
Closed

Known ordering for RollupCalculateJob records #518

rogeramitchell opened this issue Jun 13, 2017 · 10 comments · Fixed by #536

Comments

@rogeramitchell
Copy link
Contributor

Hey there, I'm a huge fan of the tool and recommend it to anyone that needs rollups (virtually everyone).

I think there might be a feature missing to ensure there is a known order of records when using the "Calculate" or "Schedule Calculate" feature. It appears that RollupCalculateJob is getting the query locator from RollupService.masterRecordsAsQueryLocator, though I do not see where this is implementing an ORDER BY clause.

If the user were to start a calculation for a rollup, it does not seem that the user should need to wait until that calculation finishes to begin the next rollup (provided the same parent object exists).

If the query returned from RollupService.masterRecordsAsQueryLocator were to use an ORDER BY clause as part of the query string, the order would be predictable, and thus the rollups could be staggered to start by a few minutes.

  1. Is the statement above correct (re: predictable order)?
  2. If so, would you like me to submit a PR with the proposed changes?

I do not think the below solves for this, but figured I'd include it (in the event that it does)
https://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_apex_maps_and_sets_iteration_order.htm

@rogeramitchell
Copy link
Contributor Author

Another resource suggests that there is no guarantee of query result order without the inclusion of an ORDER BY clause in the query string.

https://salesforce.stackexchange.com/questions/7667/soql-result-ordering-in-the-absence-of-an-order-by-clause

@afawcett
Copy link
Collaborator

Great idea, thanks for sharing! 👍 Marked as enhancement.

@rogeramitchell
Copy link
Contributor Author

My pleasure, thank you for your work on the project @afawcett! Do you want me to submit a PR with the change?

@afawcett
Copy link
Collaborator

@renatoliveira Yes please! 👍

@renatoliveira
Copy link
Contributor

@afawcett I think you meant that to @rogeramitchell ? 😆

@afawcett
Copy link
Collaborator

;-) I did, thanks @renatoliveira 👍

@rogeramitchell
Copy link
Contributor Author

@afawcett submitted #536 as PR, looks like CI failed due to username being blank for the build. Not sure whether this is something I can resolve. Mind taking a look?

@afawcett
Copy link
Collaborator

afawcett commented Aug 6, 2017

Yeah thats an issue with the way the CI works in pull requests, don't worry. I'll have a look at your PR now, thanks for the submission! 👍

@afawcett
Copy link
Collaborator

afawcett commented Aug 6, 2017

This looks great, just merged. I will get it out in the next release. I will look to carve out some person time for some popular fixes/enhancements and include your work in this. Thanks again! 👍

@afawcett
Copy link
Collaborator

afawcett commented Jan 1, 2018

Fixed in v2.10

@afawcett afawcett closed this as completed Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants