Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#37509 | Verification added to redis preloading to prevent array_comb… #37510

Conversation

LeanderFS
Copy link
Contributor

…ine receiving false as second argument

Description (*)

This change will ensure the preloading code will continue to run even when exec() returns false.

Fixed Issues (if relevant)

  1. Fixes Redis preloading fails when exec() returns false #37509

Manual testing scenarios (*)

See #37509

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

…ay_combine receiving false as second argument
@m2-assistant
Copy link

m2-assistant bot commented May 17, 2023

Hi @LeanderFS. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels May 19, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Copy link
Contributor

@engcom-Hotel engcom-Hotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @LeanderFS,

Please look into my review comments. Also can you please cover this change with some automated tests like unit tests by mocking the object?

Thanks

@@ -51,7 +51,10 @@ public function load($id, $doNotTestCacheValidity = false)
$redis->hGet(self::PREFIX_KEY . $key, self::FIELD_DATA);
}

$this->preloadedData = array_filter(array_combine($this->preloadKeys, $redis->exec()));
$redisResponse = $redis->exec();
$this->preloadedData = $redisResponse ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you check here if the redisResponse is an array, then only do the further action otherwise set an empty array.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$redis->exec() return array so not required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the method signature for exec() in Credis_Client class tells us that it returns array only but internally as per the documentation of credis, for better performance wraps the phpredis library when available. but when checking the implementation in phpredis, exec() can return Redis|array|false also. Thats why I asked to add a check here if the return value is array then only move further.

@m2-community-project m2-community-project bot moved this from Pending Review to Changes Requested in Pull Requests Dashboard May 31, 2023
@sinhaparul sinhaparul added the Project: Community Picked PRs upvoted by the community label Sep 13, 2023
@m2-community-project m2-community-project bot added this to Changes Requested in Community Dashboard Sep 13, 2023
@m2-community-project m2-community-project bot removed this from Changes Requested in Pull Requests Dashboard Sep 13, 2023
@engcom-Echo engcom-Echo moved this from Changes Requested to Pending Review in Community Dashboard Sep 18, 2023
@m2-community-project m2-community-project bot moved this from Pending Review to Review in Progress in Community Dashboard Sep 18, 2023
@engcom-Hotel engcom-Hotel moved this from Review in Progress to Changes Requested in Community Dashboard Sep 19, 2023
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE, Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

Failed Functional tests are different in 2 consecutive runs:

Functional Tests CE:
image

image

Functional Tests EE:
image

image

Failed tests seem flaky to me, hence moving further with this PR.

Thanks

@engcom-Hotel engcom-Hotel moved this from Changes Requested to Pending Review in Community Dashboard Sep 20, 2023
@engcom-Hotel engcom-Hotel moved this from Pending Review to Review in Progress in Community Dashboard Sep 20, 2023
@m2-community-project m2-community-project bot moved this from Review in Progress to Ready for Testing in Community Dashboard Sep 20, 2023
@engcom-Lima engcom-Lima added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 25, 2023
@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Oct 4, 2023

✔️ QA Passed

Preconditions

  • Magento 2.x
  • Redis 6.0.10 (Probably every version of Redis)
  • phpredis

Manual Testing Scenario

  1. Install Magento 2 as normal
  2. Enable Redis in env.php under cache->frontend->default
  3. Make sure to set backend option to Magento\\Framework\\Cache\\Backend\\Redis
  4. Set id_prefix and preload_keys
  5. Run bin/magento cache:clean

Actual Result: ✔️
image

After: ✔️
image

Before: ✖️

image

Tested all the manual scenarios, no impact on regression testing.

Failed tests seem flaky to me hence moving this PR to merge in progress.

Thanks

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests EE, Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel engcom-Hotel moved this from Ready for Testing to Merge in Progress in Community Dashboard Oct 4, 2023
@engcom-Hotel
Copy link
Contributor

Failed tests are flaky, hence moved PR in Merge in progress. Please have a look at the below screenshot for reference:

image

Thanks

@engcom-Charlie
Copy link
Contributor

@magento run all tests

Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit e2a7b53 into magento:2.4-develop Dec 8, 2023
8 of 12 checks passed
@engcom-Echo engcom-Echo moved this from Merge in Progress to Recently Merged in Community Dashboard Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Community Dashboard
Recently Merged
Development

Successfully merging this pull request may close these issues.

Redis preloading fails when exec() returns false
8 participants