Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@driusan
Copy link
Collaborator

@driusan driusan commented Dec 12, 2024

This updates DBRowProvisioner to remove the strval (and fixes #9335).

After doing that, it became clear that the inner class could be replaced by a generator while still fulfilling the contract of returning a \Traversable. Doing this made it more obvious that since #9334, pselect could be used directly while maintaining the lazy evaluation instead of bypassing the Database object to use the PDO directly. However this required injecting a LorisInstance object to the constructor to get the database connection.

With access to the LorisInstance object, the DBRowProvisioner can also get a new database connection and disable query buffering to lazily retrieve rows since PR #9344. This may theoretically improve performance and memory usage on large provisioners but has not been tested. (Performance did not decrease in raisinbread but it is not a large dataset where it would be noticeable.)

@driusan driusan added Category: Cleanup PR or issue introducing/requiring at least one clean-up operation Language: PHP PR or issue that update PHP code Category: Refactor PR or issue that aims to improve the existing code Category: Perfomance Issue or PR that aims to report or improve perfomance labels Dec 12, 2024

$provisioner = $provisioner->filter($filter);

$traversable = (new \LORIS\Data\Table())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This part didn't seem to be useful, so I verified and removed while testing.

*/
public function getAllInstances() : \Traversable
{
$DB = (\NDB_Factory::singleton())->database();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the bulk of the PR. The rest is mostly just propagating LorisInstance objects places that didn't have it.

@driusan driusan force-pushed the NoProvisionerStrVal branch from 3732d13 to 04ddf5c Compare December 12, 2024 18:30
self::$display,
self::$clearFilter,
'0',
'2 rows'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test was failing and when I investigated I don't see any rows with a value of "0" in RB and nothing inserted from the test, so I'm not sure where "2" was coming from and I think it's an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change it to test '4300' with '1 rows' so that the test is still testing the filter? I feel like testing for no results is less foolproof, and the max age test covers that below anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good idea. I'll try.

@driusan driusan force-pushed the NoProvisionerStrVal branch 3 times, most recently from 4411abd to 2f23574 Compare December 13, 2024 13:34
@skarya22 skarya22 self-assigned this Dec 13, 2024
@skarya22 skarya22 self-requested a review December 13, 2024 20:27
self::$display,
self::$clearFilter,
'0',
'2 rows'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change it to test '4300' with '1 rows' so that the test is still testing the filter? I feel like testing for no results is less foolproof, and the max age test covers that below anyway

@skarya22 skarya22 assigned driusan and unassigned skarya22 Dec 13, 2024
@skarya22 skarya22 added the State: Needs rebase PR that needs to be rebased to proceed (conflicts, wrong branch...) label Jan 13, 2025
@driusan driusan force-pushed the NoProvisionerStrVal branch from 2f23574 to 4f13b5a Compare January 23, 2025 15:37
@driusan driusan removed the State: Needs rebase PR that needs to be rebased to proceed (conflicts, wrong branch...) label Jan 23, 2025
@driusan
Copy link
Collaborator Author

driusan commented Jan 23, 2025

@skarya22 I believe I've done all your requested changes and rebased this.

@skarya22 skarya22 self-requested a review January 23, 2025 19:01
@skarya22 skarya22 self-assigned this Jan 23, 2025
Copy link
Contributor

@skarya22 skarya22 left a comment

Choose a reason for hiding this comment

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

LGTM!

@skarya22 skarya22 added Passed manual tests PR has been successfully tested by at least one peer and removed Category: Refactor PR or issue that aims to improve the existing code labels Jan 28, 2025
@driusan driusan merged commit 79a1c77 into aces:main Feb 3, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Cleanup PR or issue introducing/requiring at least one clean-up operation Category: Perfomance Issue or PR that aims to report or improve perfomance Language: PHP PR or issue that update PHP code Passed manual tests PR has been successfully tested by at least one peer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove strval from src/Data/Provisioners/DBRowProvisioner.php

2 participants