Project

General

Profile

Bug #2344

invalid scoping for dynamic buffers

Added by Stanislav Lomany almost 10 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
07/24/2014
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

svl_upd20140725a.zip (122 KB) Stanislav Lomany, 07/25/2014 06:20 AM

History

#1 Updated by Stanislav Lomany almost 10 years ago

Dynamic buffers for permanent tables should have global scope.

static DataModelObject createDynamicBufferForPermTable(Class dmoIface,
                                                          String bufferName,
                                                          Database database)
{
   ...
   int blockDepth = TransactionManager.getNestingLevel() - 1;
   DataModelObject buffer = (DataModelObject) RecordBuffer.define(bufClass,
                                                                  database.getName(),
                                                                  uniqueBufferName,
                                                                  bufferName,
                                                                  blockDepth); // scoped to current block in allBuffers
   ...
   RecordBuffer.openScopeAt(0, buffer); // global scope
   return buffer;
}

#2 Updated by Stanislav Lomany almost 10 years ago

private static Temporary createDynamicBufferForTempTable(Class dmoIface,
                                                            String bufferName,
                                                            RecordBuffer master,
                                                            TempTable tempTable,
                                                            int blockDepth)
{
   ...
   Temporary temporary;
   if (master != null)
   {
      temporary = TemporaryBuffer.define((Temporary) master.getDMOProxy(),
                                         uniqueBufferName,
                                         bufferName,
                                         blockDepth);
   }
   else
   {
      temporary = TemporaryBuffer.define(bufClass,
                                         uniqueBufferName,
                                         bufferName,
                                         blockDepth == 0,
                                         undoable); // SPECIFY blockDepth?
   }
   TemporaryBuffer temporaryBuffer = ((TemporaryBuffer) RecordBuffer.get(temporary));
   temporaryBuffer.setDynamic();
   temporaryBuffer.setTempTableRef(tempTable);
   TemporaryBuffer.openScopeAt(blockDepth, temporary);

   if (tempTable._dynamic())
   {
      DynamicTablesHelper.getInstance().registerBufferForDynamicTable(temporaryBuffer);

      // Add the target buffer to the set of all buffers at top block. This is only used by
      // dynamically defined temp-table buffers because they must be ready available in
      // the current block depth without waiting for an open scope for moving from from
      // prepend set (yet, the buffer is still contained in pending buffers).
      bufferManager.registerBuffer(temporaryBuffer);   // WORKAROUND FOR SOME SPECIFIC CASE
   }

  return temporary;
}

#3 Updated by Stanislav Lomany almost 10 years ago

Fixes my testcases, #2329 and parameter_code_search (I guess #2331 is about that?). Note that I've altered

** 224 ECF 20140703          Use current block depth in createDynamicBufferForPermTable instead of
**                           -1. This ensures buffer is registered properly with buffer manager.

and

** 097 OM  20140417          Dynamic temp-table buffers are directly available at the moment they 
**                           are declared instead of waiting for next block to open.

But I'm not sure what to tests run in order to be sure that I've not regressed these solutions.

#4 Updated by Eric Faulhaber almost 10 years ago

Stanislav Lomany wrote:

Dynamic buffers for permanent tables should have global scope.

Are you sure about this? How did you confirm this?

#5 Updated by Eric Faulhaber almost 10 years ago

Pending a reply to my last question...

Stanislav Lomany wrote:

Fixes my testcases, #2329 and parameter_code_search (I guess #2331 is about that?).

Early on in #2331 (note 1), the department_code_create API exhibited similar/related behavior, which I addressed with my 224 change in RecordBuffer.

Please list your test cases -- I'm working on an issue related to buffer scope (static and dynamic) at the moment, so these are of particular interest.

But I'm not sure what to tests run in order to be sure that I've not regressed these solutions.

Make sure the department_code_create API is not regressed (I don't see how it would be from this change). There is still an issue with the output of that API (the primary reason for #2331), but Vadim is working on that problem.

With respect to the RecordBuffer change you are proposing, I can see why it fixes the failures, but setting the blockDepth to 0 (global scope) seemed overly aggressive to me. Hence, the question in the last note.

#6 Updated by Stanislav Lomany almost 10 years ago

Dynamic buffers for permanent tables should have global scope.

Are you sure about this? How did you confirm this?

E.g. I've created a buffer in some non-top-level external procedure, and it will be available in the top-level external procedure.

#7 Updated by Greg Shah almost 10 years ago

Please check your testcases into testcases/uast/dynamic_buffer/.

#8 Updated by Stanislav Lomany almost 10 years ago

I use

uast/dynamic_tables/dbuf-double-pending.p
uast/dynamic_tables/dbuf-scope1.p

I checked them in that directory because all dbuf-* testcases reside there.

#9 Updated by Greg Shah almost 10 years ago

Good.

#10 Updated by Stanislav Lomany almost 10 years ago

Make sure the department_code_create API is not regressed

Am I missing some files or do you mean 4) Department CREATE.xml?

#11 Updated by Eric Faulhaber almost 10 years ago

Stanislav Lomany wrote:

Make sure the department_code_create API is not regressed

Am I missing some files or do you mean 4) Department CREATE.xml?

That's the right one, my mistake earlier.

#12 Updated by Eric Faulhaber almost 10 years ago

Are you getting this after running dbuf-scope1.p?

warning - pcondb for db p2j_test has lkctr -1 (395)

#13 Updated by Stanislav Lomany almost 10 years ago

Yes. I ignored it:

Cause    An internal schema lock that is released was never taken out.
Resolution Upgrade to OpenEdge 10.1C02.
Workaround The message can be suppressed with the -nolkctr startup parameter within the client session.

#14 Updated by Stanislav Lomany almost 10 years ago

4) Department CREATE output:

<error source="sPApiUpd_ValidateAIRecord adeptau0.p" subType="Invalid Data Value" type="Validation Failure">Department Type "J" is invalid.</error>

#15 Updated by Eric Faulhaber almost 10 years ago

Code review 0725a:

Looks good. Please note that Vadim has a change to RecordBuffer for #2331 (vmn_upd20140723a.zip) which is currently under regression test. Once that has passed testing and is checked in, please merge your update with that version and regression test.

Vadim: once your update passes regression testing, please check it in and post the bzr revision to #2331 -- Stanislav is a watcher on that issue.

#16 Updated by Eric Faulhaber almost 10 years ago

Stanislav Lomany wrote:

4) Department CREATE output:

[...]

You have to run "1) Department Type CREATE.xml" as a prerequisite, which will create the department type "J" to which the error message refers.

See <app_name>_api_xml_tests_explanation_20140617.doc in #2266.

#17 Updated by Stanislav Lomany almost 10 years ago

  • Status changed from WIP to Review

Regression-tested. Committed to bzr rev 10586.

#18 Updated by Eric Faulhaber almost 10 years ago

  • % Done changed from 0 to 100
  • Status changed from Review to Closed

#19 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 11 to Cleanup and Stablization for Server Features

Also available in: Atom PDF