The entire update will fail. From Apex Developer Guide - Apex Transactions:
All DML operations in a transaction either complete successfully, or if an error occurs in one operation, the entire transaction is rolled back and no data is committed to the database. The boundary of a transaction can be a trigger, a class method, an anonymous block of code, a ...
In the case of an exception in a trigger, all records involved in that trigger will not be updated, regardless of if allOrNone is set, because Salesforce cannot determine which records were successful. Triggers are synchronous in nature. The "before update" and "after update" simply refers to the half-way point initial commit phase. This initial commit is ...
Generally there are two ways to insert/update/delete/upsert records in Apex, the first is DML Statements and the other is the Database Class.
"Use DML statements if you want any error that occurs during bulk DML
processing to be thrown as an Apex exception that immediately
interrupts control flow ..."
"Use Database class methods if you want to ...
This is weird but I've find out that execute() is executed at the end of a test method, that's why the assertation is failed. Just place System.schedule and Test.stopTest into @TestSetup and It will work.
Setup | Deployment Settings | Allow deployments of components when corresponding Apex jobs are pending or in progress.
Caution: Enabling this option may cause Apex jobs to fail.
The above applies to deploying into a target org
If you are developing in a sandbox, and you are editing an apex class that is used in a running job of that sandbox, you need to ...
One class is not the same as another, even if it has the same name. However, you can modify your batch to simply use the first's:
Map<String,StudentFileQuable.ErrorClassToSend> errorMap = new Map<String,StudentFileQuable.ErrorClassToSend>();
Alternatively, you could pull out the class into its own top-level class, since it's to be shared ...
I'm posting as an answer. There are couple of issues with your code.
Email Template query is returning more than 1 record however you're
storing it in a single instance.
SOQL's written in for loop.
For temporary fix, get the list of Email Template and then use the  index record. Refer below code for reference:
global void execute(Database....
I've tested this with the following code:
public class StatefulBatch implements Database.Batchable<sObject>, Database.Stateful
private final StatefulBatchHelper helper = new StatefulBatchHelper();
public List<SObject> start(Database.BatchableContext c)
There might be specific known issue in specific version of Salesforce API if issue occurs on Production but isn't seen in Sandbox.
For example, if your production has winter 19 release and sandbox has spring 20 release, the issue may exist in Winter 19 and may be fixed in spring 20.
First of all, open Salesforce support case to find out root cause and ...
In documentation we have an example with private final String initialState; variable. This batch class does not implement Database.Stateful. Maybe you should just remove final keyword because we implement this interface and mark this variable as public?
Also, investigate this article. It could be helpfull.
You don't need nested iteration here. There's no reason to iterate over the keys of the inner Map. While you could make that work, you'd end up with a complex if/else or switch on statement inside the inner for loop.
It's much easier to directly access the inner Map keys whose values you require. It'd look something like this:
for (String s : ...
Since you already have a list of Ids (AcLst) you could query every Opportunity related to those Accounts, then populate a Map using the accountId as key and the list of opportunity as value.
Map<Id, List<Opportunity>> mapAccountIdOpportunityList = new Map<Id, List<Opportunity>>();
for (Opportunity o : [SELECT Id, StageName, AccountId,...
For the variables in stateful class in whom you don't wanna store state, you can make those variables as transient.
Use the transient keyword to declare instance variables that can't be
saved, and shouldn't be transmitted as part of the view state for a
Visualforce page. You can also use the transient keyword in Apex
classes that are serializable, ...
I don't think you need a batch class for this. At the data volume you mentioned
I expect somewhere between 100-200 records for Country. and maybe 500-1000 records for City
you should be able to handle this with a couple of quick queries and run updates:
Map<Id, Continent__c> continentsToUpdate = new Map<Id, Continent__c>();
// First, find ...