Project

General

Profile

Bug #8281

Use CacheManager for DynamicQueryHelper and DynamicValidationHelper

Added by Dănuț Filimon 2 months ago. Updated 2 months ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:

8281a.diff Magnifier (11.4 KB) Dănuț Filimon, 02/16/2024 04:12 AM

History

#1 Updated by Dănuț Filimon 2 months ago

DynamicQueryHelper and DynamicValidationHelper initialize caches in a static block, these can be done through CacheManager.

I've looked into how all three caches are initialized and reached #2646-138 and Chapter_12_Directory. The configuration found in the mentioned issue seems to be old and did not work so I tried placing the dynamic-valexp-cache-size, dynamic-query-cache-lvl1-size and dynamic-query-cache-lvl2-size in the /server/default/standard/runtime/default/ container as follows:

  <node class="container" name="server">
    <node class="container" name="default">
      <node class="container" name="standard">
        <node class="container" name="runtime">
          <node class="container" name="default">
            ...
            <node class="integer" name="dynamic-query-cache-lvl1-size">
              <node-attribute name="value" value="32768"/>
            </node>
            <node class="integer" name="dynamic-query-cache-lvl2-size">
              <node-attribute name="value" value="8192"/>
            </node>
            <node class="integer" name="dynamic-valexp-cache-size">
              <node-attribute name="value" value="32768"/>
            </node>
          </node>
        </node>
        ...
      </node>
    </node>
  </node>

I've also tried placing them in /server/default/runtime/default/ and in both cases, the configured values were picked up and used. This is because it tries to search the used server_id (standard) and if it does not find it, it will search /server/default/runtime/default/, as this is how the searching algorithm works (see Chapter_12_Directory or com.goldencode.p2j.util.Utils line 3641).

The purpose of this task is to make the 3 caches configurable through CacheManager and also maintain the original configuration (the one specified above). Both methods should be documented in Database Configuration Cache Sizes.

#2 Updated by Dănuț Filimon 2 months ago

  • Status changed from New to WIP
  • Assignee set to Dănuț Filimon

#3 Updated by Dănuț Filimon 2 months ago

I also need to mention that the classes handle dynamic query and validation expressions conversion at runtime. If there are no queries or expression to convert, the caches will not be initialized since the class is not loaded in memory. This should not be a problem since dynamic queries are used often in any project.

Created 8281a.

#4 Updated by Dănuț Filimon 2 months ago

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

Committed 8281a/rev.14986. DynamicQueryHelper and DynamicValidationHelper caches are now created through CacheManager.

A straightforward implementation:
  • Caches are initialized by CacheManager;
  • The caches where made non-final;
  • Unnecessary class members for directory search were removed;
  • The DynamicQueryHelper caches use the discriminators lvl1 and lvl2 and the LRUCache name is now the class name + discriminator;

#5 Updated by Eric Faulhaber 2 months ago

Ovidiu, please review ASAP.

Danut, please finalize the documentation and do any testing that needs to be done once the review is done and any issues addressed. I'd like to get this merged to trunk as quickly as possible.

#6 Updated by Dănuț Filimon 2 months ago

Eric Faulhaber wrote:

Danut, please finalize the documentation and do any testing that needs to be done once the review is done and any issues addressed. I'd like to get this merged to trunk as quickly as possible.

I'll update the documentation right now, as for testing I made sure that the caches are created and use the configured values (if any).

I realized that I did not remove the import com.goldencode.p2j.directory.*; import from the classes. I'll make another commit, but with no history entry since it's minimal.

#7 Updated by Dănuț Filimon 2 months ago

Committed 8281a/rev.14987 which removes the unnecessary directory import and updated the Database Configuration Cache Sizes wiki with the latest cache configurations. Once #8281 is merged, the old configurations will no longer be available and the wiki will be updated again.

#8 Updated by Eric Faulhaber 2 months ago

Since this change takes away or changes existing configuration, please commit the necessary changes to the directory of every application repo, if the old configuration mode was in use for that application (customer projects as well as sample projects, like hotel [gui]).

These directory changes must be committed in coordination with the merge to trunk and/or any customer branches we maintain.

Finally, the merge notification should highlight this dependency.

#9 Updated by Dănuț Filimon 2 months ago

Eric Faulhaber wrote:

Since this change takes away or changes existing configuration, please commit the necessary changes to the directory of every application repo, if the old configuration mode was in use for that application (customer projects as well as sample projects, like hotel [gui]).

These directory changes must be committed in coordination with the merge to trunk and/or any customer branches we maintain.

Finally, the merge notification should highlight this dependency.

hotel_gui and customer projects I am working on do not have these caches configured (this is probably because there is no documentation referring to how the cache size can be set in directory.xml). I will make sure to point out this change in the merge notification and explain how to configure them.

#10 Updated by Constantin Asofiei 2 months ago

Danut, please follow these steps to apply the patch to 7156b:
  • do bzr diff -r 14985 > 8281a.diff and attach also here the 8281a.diff file
  • in 7156b, do this:
    bzr update && bzr revert && bzr clean-tree
    patch -p1 < /path/to/8281a.diff
    # commit the patch using the "Changes from branch 8281a rev 14987 built on trunk rev 14985" format, with explanation for the commit message.
    bzr commit -m "Changes from branch 8281a rev 14987 built on trunk rev 14985: ... more details here... Refs #8281" 
    

#11 Updated by Dănuț Filimon 2 months ago

I've already laid the field for the patch so I'll be attaching it here. There are no conflicts in 7156b when it is applied. I am going ahead with the commit.

#12 Updated by Dănuț Filimon 2 months ago

Committed 7156b/rev.15012. Applied the patch from #8281-11.

Constantin, should I mention the change in #7156?

#13 Updated by Constantin Asofiei 2 months ago

Dănuț Filimon wrote:

Constantin, should I mention the change in #7156?

Yes, please follow the template from previous entries.

#14 Updated by Ovidiu Maxiniuc 2 months ago

  • Status changed from Review to Internal Test

Eric Faulhaber wrote:

Ovidiu, please review ASAP.

I see nothing wrong with the code. The branch is a couple of revisions behind the trunk.

Danut, please finalize the documentation and do any testing that needs to be done once the review is done and any issues addressed. I'd like to get this merged to trunk as quickly as possible.

Dănuț, do not forget to add a note in the notification message that the keys for values of the caches have changed. Projects configured with dynamic-query-cache-lvl1-size, dynamic-query-cache-lvl2-size and dynamic-valexp-cache-size will have to be adjusted to use the new centralized naming path in directory. There is there is a wiki for this (Cache-Sizes in Chapter 22: Directory Configuration Reference), it must be updated.

#15 Updated by Dănuț Filimon 2 months ago

Ovidiu Maxiniuc wrote:

Dănuț, do not forget to add a note in the notification message that the keys for values of the caches have changed. Projects configured with dynamic-query-cache-lvl1-size, dynamic-query-cache-lvl2-size and dynamic-valexp-cache-size will have to be adjusted to use the new centralized naming path in directory. There is there is a wiki for this (Cache-Sizes in Chapter 22: Directory Configuration Reference), it must be updated.

I'll make sure to mention that the keys have been changes. As for the wiki, it was already updated and currently has the specifications for both configurations (old and new) after getting the changes to 7156b.

Eric, there is no more testing that needs to be done here, can we get this merged?

#16 Updated by Eric Faulhaber 2 months ago

  • Status changed from Internal Test to Merge Pending

Yes, please merge to trunk.

#17 Updated by Dănuț Filimon 2 months ago

  • Status changed from Merge Pending to Test

Branch 8281a was merged into trunk as revision 14989 and archived.

Also available in: Atom PDF