Skip to content

PHPC-1891, PHPC-1892, PHPC-1893: Implement TopologyDescription, SDAMSubscriber, and TopologyChangedEvent #1244

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

Merged
merged 12 commits into from
Aug 17, 2021

Conversation

tanlisu
Copy link
Contributor

@tanlisu tanlisu commented Aug 3, 2021

@tanlisu tanlisu requested a review from jmikola August 3, 2021 15:39
@tanlisu tanlisu changed the title PHPC-1891: Implement TopologyDescription class PHPC-1891, PHPC-1892, PHPC-1932: Implement TopologyDescription, SDAMSubscriber, and TopologyChangedEvent Aug 4, 2021
@tanlisu
Copy link
Contributor Author

tanlisu commented Aug 4, 2021

@jmikola For updating the libmongoc submodule, how do I determine what to update LIBMONGOC_VERSION_CURRENT to?

@jmikola
Copy link
Member

jmikola commented Aug 4, 2021

For updating the libmongoc submodule, how do I determine what to update LIBMONGOC_VERSION_CURRENT to?

This was already covered in Ensure libmongoc version information is correct within the contributing docs. I added a note about the script's outstanding issue with detecting a version for a non-release, non-master branch (similar to what I noted in #1243 (comment)).

I've also amended the Update libmongoc submodule section to outline the process for pointing the submodule to a specific fork, which covers your case where you need to point to the commit in mongodb/mongo-c-driver#785.

@jmikola
Copy link
Member

jmikola commented Aug 4, 2021

Note: another step for bumping libmongoc submodules is to Update sources in build configurations. I recently did this in ac49353 and have since merged master into the feature/sdam-monitoring branch so you may want to update feature/sdam-monitoring and rebase this PR to incorporate those changes.

@tanlisu tanlisu force-pushed the phpc-1891 branch 2 times, most recently from 4f60636 to fe2e590 Compare August 5, 2021 20:29
@tanlisu
Copy link
Contributor Author

tanlisu commented Aug 5, 2021

The GitHub CI build failures (https://github.com/mongodb/mongo-php-driver/pull/1244/checks?check_run_id=3256294983) say "implicit declaration of function ‘mongoc_topology_description_new_copy’" - is this because I didn't update the libmongoc submodule correctly? I updated src/LIBMONGOC_VERSION_CURRENT using make libmongoc-version-current and checked that PHP_MONGODB_MONGOC_SOURCES was updated in both config.m4 and config.w32.

@jmikola
Copy link
Member

jmikola commented Aug 6, 2021

Is this because I didn't update the libmongoc submodule correctly?

Most likely. I don't see any commits in this PR updating .gitmodules or the src/libmongoc submodule. If you look at previous commits in PHPC where we update the libmongoc submodule, you'll see that we change src/LIBMONGOC_VERSION_CURRENT and the submodule concurrently. In your case, since you also need to update the submodule to point to a different repository, you also need to update .gitmodules (as discussed in #1244 (comment) and the recently updated docs linked therein).

@tanlisu
Copy link
Contributor Author

tanlisu commented Aug 6, 2021

Hmm I've updated .gitmodules and src/libmongoc (20ca7fc) but the src/libmongoc submodule doesn't seem to be updating - do you know what might be wrong?

@tanlisu tanlisu force-pushed the phpc-1891 branch 2 times, most recently from 71df8b7 to bcc17ce Compare August 6, 2021 19:54
@tanlisu tanlisu changed the title PHPC-1891, PHPC-1892, PHPC-1932: Implement TopologyDescription, SDAMSubscriber, and TopologyChangedEvent PHPC-1891, PHPC-1892, PHPC-1893: Implement TopologyDescription, SDAMSubscriber, and TopologyChangedEvent Aug 9, 2021
@tanlisu tanlisu marked this pull request as ready for review August 10, 2021 13:53
@tanlisu
Copy link
Contributor Author

tanlisu commented Aug 10, 2021

@jmikola I realize I didn't add arginfo for the TopologyDescription class as in #1245 - does it sound right to add that for just the hasReadableServer function which takes a read preference as argument?

@jmikola
Copy link
Member

jmikola commented Aug 10, 2021

I realize I didn't add arginfo for the TopologyDescription class as in #1245 - does it sound right to add that for just the hasReadableServer function which takes a read preference as argument?

Yes. Arginfo should definitely be correct for any method. The arginfo for hasReadableServer will resemble that for Manager::selectServer(), but you'll need to change some parameters in both macros to convey that the ReadPreference argument is optional and can be null.

Consider the following definitions of both macros from LXR:

===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(%s)
Copy link
Member

Choose a reason for hiding this comment

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

This test would be improved by capturing the final TopologyDescription and asserting that hasReadableServer() returns true.

===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(%s)
Copy link
Member

Choose a reason for hiding this comment

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

Related to my earlier comments, we can change this test to capture the last TopologyDescription object and expect true here.

@tanlisu
Copy link
Contributor Author

tanlisu commented Aug 11, 2021

The manager-ctor-auth_mechanism-error-001.phpt test fails for me locally and on the GitHub CI (https://github.com/mongodb/mongo-php-driver/pull/1244/checks?check_run_id=3304714843); I think it's caused by the most recent libmongoc submodule update since the test works when I revert the submodule and run it locally.
Note: it still doesn't seem to be working after updating to the most recent commit (mongodb/mongo-c-driver@6abd837)

@tanlisu tanlisu force-pushed the phpc-1891 branch 2 times, most recently from 489d07e to 1185aa6 Compare August 11, 2021 19:32
@jmikola
Copy link
Member

jmikola commented Aug 16, 2021

@tanlisu Also note that mongodb/mongo-c-driver#785 (for CDRIVER-3909) has been merged. You can revert the change to .gitmodules in this PR and update the submodule to mongodb/mongo-c-driver@d283803 (current HEAD of master). Switching back to the master branch should also mean make libmongoc-version-current should detect the correct version as well.

@tanlisu tanlisu force-pushed the phpc-1891 branch 2 times, most recently from fd04964 to c81a50d Compare August 17, 2021 14:12
@jmikola jmikola force-pushed the feature/sdam-monitoring branch from dc9b919 to 813d7b8 Compare August 17, 2021 14:17
@tanlisu tanlisu merged commit bcd2a7f into mongodb:feature/sdam-monitoring Aug 17, 2021
@tanlisu tanlisu deleted the phpc-1891 branch August 17, 2021 17:30
jmikola pushed a commit that referenced this pull request Nov 3, 2021
jmikola pushed a commit that referenced this pull request Dec 30, 2021
jmikola pushed a commit that referenced this pull request Jan 5, 2022
jmikola pushed a commit to jmikola/mongo-php-driver that referenced this pull request Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants