-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Recalculate Rollups Full Calculate only partially completing #662
Comments
@louisskelton that's not that much data volume at all, but in 1.7 the full recalculations moved over to always using Queueables to get around some limitations with Batch Apex. Do you happen to have an Apex trace on the user running the job? I'm wondering if there's some kind of exception being thrown. I'll kick off a LDV recalc this morning to see if there's anything unusual occurring. |
@louisskelton based on my initial experiments, this is probably due to large swathes of the "batch" not requiring state records. It's hard to track the ongoing status of the job as a result - so it's reporting as "completed" but still running the in background. You should be able to track the ongoing actual status in the Apex Jobs page. I will definitely be looking into improvements within the full recalc page to track the overall status of the job at a better level. Edit - also, just to give some additional context for posterity: using the standard 500 items per "batch", this job has processed 1.6 million records in two hours (about 60% complete). That's much faster than any batch process I've seen. |
Hi @jamessimone - thanks so much for taking a look! Really appreciate it. I added a trace and I think I caught it just in time! The queueable jobs were still going but about half an hour later they stopped with an error "Batchable instance is too big". Here are the logs:
|
@louisskelton something that might help is enabling the My 2.5 million record recalculation is about to finish, so I'm going to try upping the number to something in the tens of millions to see if I can reproduce what you're experiencing. |
Additional info - I added some logging into my own For the ~10 mm record job:
For the 2.5 mm record job:
This is where I added those lines within private class CursorBasedRetriever implements CalcItemRetriever {
private final Database.Cursor cursor;
private Integer countOfRecordsToReturn;
private Integer currentPosition = 0;
public CursorBasedRetriever(RollupRepository repo, RollupControl__mdt control) {
this.cursor = repo.getCursor();
this.countOfRecordsToReturn = control.BatchChunkSize__c.intValue();
}
public List<SObject> fetch() {
System.debug('Count of records to return: ' + this.countOfRecordsToReturn);
System.debug('Current position in cursor: ' + this.currentPosition);
System.debug('Cursor calculated number of records: ' + this.cursor.getNumRecords());
if (this.countOfRecordsToReturn + this.currentPosition > this.cursor.getNumRecords()) {
this.countOfRecordsToReturn = this.cursor.getNumRecords() - this.currentPosition;
}
List<SObject> fetchedRecords = this.cursor.fetch(this.currentPosition, this.countOfRecordsToReturn);
this.currentPosition += this.countOfRecordsToReturn;
System.debug('New position in cursor: ' + this.currentPosition);
System.debug('Heap size during fetch: ' + Limits.getHeapSize());
System.debug('Heap limits as a reminder: ' + Limits.getLimitHeapSize());
return fetchedRecords;
} So even the ~10mm record job has only taken up 1.4mb of space, which is just over 10% of the space available to the job as a whole. Maybe you can add those logging lines in and monitor how things progress - also, you should be able to use the toggle at the top of the recalc app so you can just select your CMDT record (so you don't have to type out all of your info each time). Hopefully that helps! |
Hi there! I hope you're well!☺️
I'm keen to consider apex-rollup as a replacement to DLRS but I seem to be falling at the first hurdle.
In a Sandbox, using apex-rollup 1.7.5, I've created a custom object named Line_Item__c and have created 6 million Line Item records related to 2 million Opportunities. There are are 3 Line Items for every Opportunity - i.e no data skew.
I'm using the 'Recalculate Rollups' tab to to an initial SUM rollup. It gets through about 500k Opportunities and then seems to run out of puff. Compared to the video tutorial, the Apex Jobs are showing it's used a Queueable process rather than batches. I've tried replicating the process using CMT Rollup pointing to a Rollup Control using 'Batchable' instead of Queueable but it still seems to be launching a Queueable process... Again, seems to run out of puff after 500k Opportunities.
I know these data volumes are quite high, but DLRS seems to crunch through very quickly, so I feel like I must be doing something wrong! Very keen to move away from DLRS so I'm anxious to get apex-rollups to work.
Thanks!
Louis
The text was updated successfully, but these errors were encountered: