Page MenuHomeIn-Portal Phabricator

INP-1768 - Disable Load Balancing from CRON
ClosedPublic

Authored by alex on May 23 2019, 11:13 AM.

Details

Test Plan
Code fragment
$application->Conn->Query('SELECT * FROM inp_MasterOnly');
  • in Database Manager:
    1. create new database as copy/paste from database used in In-Portal
    2. in original database create inp_MasterOnly database table
    3. remember created database name
  • in IDE:
    1. open /tools/cron.php file for editing
    2. after $application->Init(); line add code shown above test plan
    3. save changes
    4. open /tools/run_event.php file for editing
    5. after $application->Init(); line add code shown above test plan
    6. comment out exit_code(1, 'This script needs to be enabled manually !'); line
    7. save changes
    8. change /system/config.php file to:
      • enable support for load balancing (see example in http://community.in-portal.org/x/Npkk and you can use same server as both slave & master)
      • for slave connection add DBName key (even though it's not listed in Confluence) with above copied database name
      • basically what we need is inp_MasterOnly table to be present on master (original) database only, but not on slave database
    9. in core/kernel/db/db_load_balancer.php file change \kDBLoadBalancer::reallyOpenConnection method change $this->servers[0]['DBName'] to $server['DBName'] (allows to use different DB name for slave, that was added in config.php file)
  • in CLI (command line)
    1. go to folder, where In-Portal is located
    2. execute php tools/cron.php
    3. confirm, that no SQL error happened
    4. execute php tools/run_event.php adm:OnBuild b674006f3edb1d9cd4d838c150b0567d
    5. confirm, that no SQL error happened

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 928
Build 928: arc lint + arc unit

Event Timeline

alex created this revision.May 23 2019, 11:13 AM
alex requested review of this revision.May 23 2019, 11:13 AM
alex edited the test plan for this revision. (Show Details)May 23 2019, 11:24 AM
alex added a project: Restricted Project.
erik accepted this revision.May 27 2019, 5:48 AM

Tested, working fine, but needs corrections in the test plan.

  1. Some additional table must be in the master DB, not in slave DB.
  2. in the tools/run_event.php line #15, which blocks script's test part execution, must be commented:
exit_code(1, 'This script needs to be enabled manually !');
This revision is now accepted and ready to land.May 27 2019, 5:48 AM
alex edited the test plan for this revision. (Show Details)May 27 2019, 7:26 AM
In D365#7225, @erik wrote:

Tested, working fine, but needs corrections in the test plan.

  1. Some additional table must be in the master DB, not in slave DB.
  2. in the tools/run_event.php line #15, which blocks script's test part execution, must be commented:

    exit_code(1, 'This script needs to be enabled manually !');

Updated test plan to incorporate these changes. Thank you.

This revision was automatically updated to reflect the committed changes.