The DeltaChangeErrorEventArgs.CanContinue attribute is not stopping the next changes


(Maxwell B. Fernandes) #1

After updating the component (RemObject), my application started not to interrupt the next changes, even setting DeltaChangeErrorEventArgs.CanContinue = false;

This setting always worked for the ProcessError event of the BusinessProcessor object.

For example: In my case I have two records to insert into the same transaction.
line 1
line 2

Flow:

-> 1st: BeforeProcessDelta
-> 2nd: BeforeProcessChange [line 1]
-> 3rd: ProcessError (e.DeltaChange.Message = trigger_person_bi - Invalid Code) [line1]
-> 4th: BeforeProcessChange [line 2]
-> 5º: ProcessError (e.DeltaChange.Message = current transaction is aborted, commands ignored until end of transaction block)
-> 6: AfterProcessDelta

If the variable [.CanContinue = false;] in the [ProcessError] method, the flow should stop in the 3rd step.

======= Connection Settings =======

ConnectionDefinition conexaoBD = new ConnectionDefinition();
conexaoBD.Name = “ConexaoBD”;
conexaoBD.Pool.MaxPoolSize = 10;
conexaoBD.Pool.WaitTimeOut = 600;

conexaoBD.ConnectionString = “DEVART_POSTGRESQL.NET?”;
conexaoBD.ConnectionString += “Host=localhost”;
conexaoBD.ConnectionString += “;Port=5432”;
conexaoBD.ConnectionString += ";Database=postgres;
conexaoBD.ConnectionString += “;User Id=postgres”;
conexaoBD.ConnectionString += “;Password=postgres”;
conexaoBD.ConnectionString += “;Unicode=True;Persist Security Info=True;Schema=public;Pooling=false;UnpreparedExecute=true;Max Pool Size=100;Connection Timeout=15;Default Command Timeout=0;”;
conexaoBD.Default = true;

connectionManager.ConnectionDefinitions.Add(conexaoBD);

connectionManager.PoolingBehavior = RemObjects.SDK.Pooling.PoolBehavior.RaiseError;
connectionManager.PoolTransactionBehaviour = PoolTransactionBehaviour.Rollback;
connectionManager.WaitIntervalSeconds = 10;
connectionManager.PoolingEnabled = false;
connectionManager.MaxPoolSize = 5;
connectionManager.ConnectionPoolTimeout = 600;

======= Components =======

Devart: 7.11.1229.0

RemObjects Data Abstract for .NET, Server Edition - 9.4.109.1377

PostgreSQL 10.3

======= Application log =======

RemObjects.DataAbstract.DAException: Multiple rows match the change in delta 'person: ’
em RemObjects.DataAbstract.DataAdapter.MergeTableDelta(DataTable table, Delta delta, Boolean acceptChangesDuringUpdate, Boolean briefcase)
em RemObjects.DataAbstract.DataAdapter.MergeTableDelta(DataTable table, Delta delta)
em RemObjects.DataAbstract.DataAdapter.MergeDelta(DataSet dataset, IEnumerable`1 deltas)
em RemObjects.DataAbstract.DataAdapter.InternalUpdate(DataSet dataset, String[] tableNames)
em RemObjects.DataAbstract.DataAdapter.Update(DataSet dataset)

======= PostgreSQL log =======

2019-01-16 09:22:30.318 -03 [4424] ERROR: trigger_person_bi - Invalid Code
2019-01-16 09:22:30.318 -03 [4424] CONTEXT: PL/pgSQL function f_person() line 5 at RAISE
2019-01-16 09:22:30.318 -03 [4424] STATEMENT: INSERT INTO “public”.“person” (

  "id_person",

  "name")

VALUES (

  1,

  E'Maxwell')

2019-01-16 09:22:30.319 -03 [4424] ERROR: current transaction is aborted, commands ignored until end of transaction block
2019-01-16 09:22:30.319 -03 [4424] STATEMENT: select nextval(’“seq_primary_key”’)
2019-01-16 09:22:30.320 -03 [4424] LOG: duration: 0.044 ms statement: COMMIT

Is there any configuration / variable that we can change so that upon triggering the ProcessError method it can interrupt the flow of the transaction by giving ROLLBACK that has changed in this new version of RemObjects?


(antonk) #3

Hello

I’ve re-tested the ProcessError handling on the latest Data Abstract release and it seems to work as expected.

The logic of the ProcessError event has not been changed for a very long time. The only change there is that a service property RollbackUpdatesOnError has been introduces. However this property only sets an initial value for the eventArgs.CanContinure property and doesn’t change other behavior:

e.CanContinue = !this.RollbackUpdatesOnError;

Could you please double-check that you do set CanContinue to false in the event handler?

If you do then please create a small testcase where this behavior could be reproduced and send it to support@ (if possible, please provide database script and use the NPGSQ driver in this testcase)

Thanks in advance


(Maxwell B. Fernandes) #4

Hello,

We set the variable ** this.RollbackUpdatesOnError = true; ** in the event ** AfterAcquireConnection ** and the system behaved as expected.

Yes,

I can set false to the variable ** CanContinue ** in the event handler.

Thank you!
Our problem has been solved.


(antonk) #5

Could you elaborate a bit more (so if there is a potential issue in DA we’ll be able to fix it):

What was the code of the ProcessError event handler before you changed it?

Also, better place to set the RollbackUpdatesOnError property is in the service constructor, right after the InitializeComponent call. That said, setting RollbackUpdatesOnError to true makes it not necessary to define the ProcessError event handler.