Project

General

Profile

Feature #6414

ERROR attribute for buffer, dataset and temp-table

Added by Greg Shah about 2 years ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
version_reported:
version_resolved:

History

#1 Updated by Greg Shah about 2 years ago

Although we generally have full support for ERROR-STATUS:ERROR, the ERROR attribute also exists for buffer, dataset and temp-table. All three have some level of runtime implementation already. The gap marking reports support as conversion full and runtime partial. I know that COMPILER:ERROR is just a runtime stub, but there is also this comment:

<rule>attrs.put(prog.kw_error   , rw.cvt_lvl_full       | rw.rt_lvl_partial)</rule> <!-- no runtime for DataSets -->

I know there is really runtime there for datasets, but on the other hand there are some specific details in the 4GL docs which I'm not sure if we support fully:

  • Indicates an error from a FILL() or SAVE-ROW-CHANGES().
  • Is cleared when the object's before-image records are removed in ACCEPT-CHANGES(), EMPTY-DATASET(), FILL(), MERGE-CHANGES() and REJECT-CHANGES().
  • Ignored (or lost?) if the before-table is not NO-UNDO.
  • "For the Buffer object handle, this attribute causes the row to be backed out rather than merged with the MERGE-CHANGES method or the MERGE-ROW-CHANGES method."
  • Serialized in appserver calls.

And there is this note:

The ERROR attribute is writeable for a ProDataSet object, a Temp-table object, and a Buffer object. You can set the ERROR attribute programmatically in order to manage the application response to errors. For example, you might set the ERROR attribute to FALSE in order to ignore all errors that might be returned for a statement using the NO-ERROR option. However, note that manually setting this attribute has no affect on ABL error management. Thus, if you set the ERROR attribute to TRUE, the AVM does not also raise the ERROR condition.

Do we support all of the above?

#2 Updated by Greg Shah about 2 years ago

Ovidiu: What is the status of this one?

#3 Updated by Ovidiu Maxiniuc about 2 years ago

Sometimes the usage of error attribute is incorrectly wired using the compiler wrapper. I have the conversion changes to address these.
I need to do a complete (as much as possible) testcase when it comes to DataSet runtime. ATM, the flag is changed as follows (looking in FWD code):
  • manually, when the ABL programmers consider necessary;
  • set to true when a buffer.fill() and dataset.fill() encounter errors;
  • set to true when SAVE-ROW-CHANGES encounters an error;
  • the flag is cleared (set to false) when merge-changes, reject-changes and accept-changes are successful;
  • also cleared when emptied.

These seems to match the description you found. But need testing to confirm the exact conditions. The only thing that I cannot confirm is whether it is "Serialized in appserver calls.". I think not, but it should not be difficult to add.

#4 Updated by Eric Faulhaber 9 months ago

  • Assignee set to Ovidiu Maxiniuc

Ovidiu, how much effort is there to finish this? We are trying to get it done this month.

#5 Updated by Ovidiu Maxiniuc 9 months ago

Since #6414-3 we have the Errorable interface which groups together all error attributes, regardless of object type (no more incorrect unwrapping).

I scanned again FWD code for usages mentined in #6414-1. They all seem fine, except for the following two which I not sure:
  • behaviour of MERGE-ROW-CHANGES method is not influenced by this flag (although the MERGE-CHANGES is);
  • not serialized in DatasetWrapper and table serializers (json/xml).

It should take a few hours to check if these need and do the implementation, if the case.

Do we have tests in xfer test suite for this attribute?

#6 Updated by Eric Faulhaber 8 months ago

Ovidiu Maxiniuc wrote:

Do we have tests in xfer test suite for this attribute?

I am not aware of any. Marian, do you have an idea?

#7 Updated by Marian Edu 8 months ago

Eric Faulhaber wrote:

Ovidiu Maxiniuc wrote:

Do we have tests in xfer test suite for this attribute?

I am not aware of any. Marian, do you have an idea?

It doesn't seems to have much but I can easily add a few more test methods in the existing one, for serialisation this one is definitively being serialised but I think the only thing we've tested on this area was how the data is being passed along, and serialised for rest/soap.

#8 Updated by Ovidiu Maxiniuc 8 months ago

  • % Done changed from 0 to 50
  • Status changed from New to WIP

I created 6414a and committed the first part of the changes which include only for passing the ERROR attribute with the dataset in the DatasetWrapper.
I did some tests and I could not find any evidence that the ERROR attribute is serialized in JSON/XML for neither dataset not tables (individual records).

What remains to be done is fix MERGE-ROW-CHANGES to reject changes in case the flag is set.

#9 Updated by Ovidiu Maxiniuc 8 months ago

  • Status changed from WIP to Review
  • % Done changed from 50 to 100

Task branch was rebased to trunk/14805 updated to r14807.
The latest update contains the handling of ERROR attribute for MERGE-ROW-CHANGES and MERGE-CHANGES. I had some difficulties because there are multiple datasets and temp-tables involved and the PK management changed recently so this created a bit of a mess. All tables having the same PK pools :( it was nearly impossible to know lookup the right record to be processed in after/before buffers.
Ready for review.

At this moment, I am not aware of other missing usages of ERROR attribute.

#10 Updated by Eric Faulhaber 8 months ago

Code review 6414a/14806-7:

The changes to the DataSet* classes look fine. I am not as familiar to the functionality in BufferImpl.mergeRowChanges, so it is difficult for me to review this method. There are a few concerning things, however.

1) The early out:

      if (changesBuf.rowState().isUnknown() || changesBuf.rowState().intValue() == Buffer.ROW_UNMODIFIED)
      {
         return true; // ??
      }

Is this a success condition? The row being unmodified seems like it should be ok, but is it ok if the row state is unknown? The comment // ?? is a little unsettling.

2) Throwing a RuntimeException (line 10563) upon catching PersistenceException will cause an abend. This is not new, but is there a more graceful way to fail?

#11 Updated by Ovidiu Maxiniuc 8 months ago

Eric Faulhaber wrote:

Code review 6414a/14806-7:

Thank you for the review. A second pair of eyes are always better when we talk programming.

1) The early out:
[...]
Is this a success condition? The row being unmodified seems like it should be ok, but is it ok if the row state is unknown? The comment // ?? is a little unsettling.

This is normal. No changes means nothing to handle. I added a comment describing the situation.

2) Throwing a RuntimeException (line 10563) upon catching PersistenceException will cause an abend. This is not new, but is there a more graceful way to fail?

I overlooked that in my first commit. I am not aware what error should we throw here because I do not know what OE would do in this case, if they encounter a similar processing. This was the cause of initial solution. I picked the most appropriate: 11926 Found unexpected error while merging changes. I think this is fine until we find the true error in this case.

Branch 6414a updated, rebased and pushed as r14827.

#12 Updated by Eric Faulhaber 8 months ago

  • Status changed from Review to Internal Test

Ovidiu Maxiniuc wrote:

Branch 6414a updated, rebased and pushed as r14827.

Thanks for addressing the code review issues. The changes look good to me.

What testing is needed before we merge to trunk?

#13 Updated by Ovidiu Maxiniuc 8 months ago

I think there are very few places in customer projects which are affected by the changes in this branch. The fwdtests on a very large application customer application should do it. I think that is of the few to use the merge[Row]Changes if not the only one.

Task branch rebased and pushed up as r14831.

#14 Updated by Ovidiu Maxiniuc 7 months ago

The task branch was rebased to latest trunk. The current revision is 14861.
I also test with a large customer application and no regression was revealed.

#15 Updated by Eric Faulhaber 7 months ago

  • Status changed from Internal Test to Merge Pending

Greg, I think this is ready for merge to trunk (Ovidiu, correct me if you think otherwise).

#16 Updated by Greg Shah 7 months ago

You can merge to trunk now.

#17 Updated by Ovidiu Maxiniuc 7 months ago

  • Status changed from Merge Pending to Test

Committed revision 14859. The branch was archived.

#18 Updated by Eric Faulhaber 6 months ago

  • Status changed from Test to Closed

Also available in: Atom PDF