Skip to content

PHPC-1184: Add alternative topologies to Travis CI #871

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 2 commits into from
Jul 16, 2018

Conversation

derickr
Copy link
Contributor

@derickr derickr commented Jul 2, 2018

No description provided.

@derickr derickr force-pushed the PHPC-1184-alternative-topologies-travis branch 17 times, most recently from 2b74723 to b63fb69 Compare July 3, 2018 14:12
@derickr derickr force-pushed the PHPC-1184-alternative-topologies-travis branch from b63fb69 to e36f03f Compare July 10, 2018 13:46
started: drop
failed: drop
started: geoNear
failed: geoNear
Copy link
Member

Choose a reason for hiding this comment

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

geoNear is deprecated (PM-939). I think a more robust solution would just be to issue an aggregate with an unsupported pipeline operator (e.g. [ { "$unsupported": 1 } ]) or an update with a similarly unsupported modifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will see if I can fix that.

* @return bool
* @throws RuntimeException
*/
function command_works($uri, $command)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to type-hint $command here?

Alternatively, allow it to take any array|object and then wrap it in a Command as needed. This is what PHPLIB's DatabaseCommand helper does. It would save you from needing to import and construct MongoDB\Driver\Command from skip_if_sleep_command_unavailable(), and anything else that may use this in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will fix that too.

@@ -5,6 +5,7 @@ ConnectionTimeoutException: exceeding sockettimeoutms
<?php skip_if_not_live(); ?>
<?php skip_if_not_clean(); ?>
<?php skip_if_test_commands_disabled(); ?>
<?php skip_if_sleep_command_unavailable(); ?>
Copy link
Member

Choose a reason for hiding this comment

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

Since we already have a skip for disabled test commands on the line above, what is the case where sleep isn't supported? Unfortunately, it looks like the command is no longer in our own manual, so I've linked to one of the Chinese translations (cloned from an older version).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. I wonder if that's related to fail points on mongos not being supported. Depending on the outcome of that ticket, it may make sense to simply skip this test for mongos and leave /* See: SERVER-36066 */ as a comment between the skip function and ?>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The work for skipping this properly (based on the sleep function existing) is already done, so I don't see a reason to remove that again.

Copy link
Member

Choose a reason for hiding this comment

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

If I understand skip_if_sleep_command_unavailable() correctly, it's going to introduce a one-second delay if the server does support the command. If this is also the only place that function would be used, I think the skip is preferable.

I think the best improvement might actually be modifying skip_if_test_commands_disabled() to also skip if the primary server is a mongos node, since it doesn't seem to support any test commands (despite reporting otherwise when we query its configuration).

That will also prove more useful down the line if we inevitably add more tests that want to set fail points.

I'm actually curious how the following tests pass on mongos:

The other two tests that set fail points are currently disabled:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't explain why those two tests actually work, but I checked, and they indeed fail with operation exceeded time limit, even when talking to mongos. I can't reproduce this effect in the shell though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And also, setting the failpoint on mongos succeeds:

mongos> db.runCommand( { configureFailPoint: 'maxTimeAlwaysTimeOut', mode: 'alwaysOn' } );
{
	"ok" : 1,
	"operationTime" : Timestamp(1531733041, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1531733041, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

Copy link
Member

Choose a reason for hiding this comment

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

Ah, so it is a case of this specific test command not working on mongos. Works for me, then.

["code"]=>
int(26)%A
int(8)%A
Copy link
Member

Choose a reason for hiding this comment

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

The fact that this still reports error code 8 ("UnknownError") instead of 26 ("NamespaceNotFound") is more evidence that geoNear is not being actively maintained and we should probably avoid using it for any testing.

c.f. https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err

@@ -12,8 +12,7 @@
"nssize": 1,
"port": 3000,
"bind_ip_all": true,
"smallfiles": true,
"setParameter": {"enableTestCommands": 1}
"smallfiles": true
Copy link
Member

Choose a reason for hiding this comment

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

Why are you removing enableTestCommand?

I'm curious if this is the reason you needed to introduce skip_if_sleep_command_unavailable(). Perhaps there's a bug in skip_if_test_commands_disabled()?

@derickr derickr force-pushed the PHPC-1184-alternative-topologies-travis branch 2 times, most recently from 709e29d to 36ce628 Compare July 12, 2018 09:54
@derickr derickr changed the base branch from master to v1.5 July 12, 2018 10:57
@derickr derickr force-pushed the PHPC-1184-alternative-topologies-travis branch 4 times, most recently from 4a2b3f6 to b42d739 Compare July 13, 2018 15:28
@derickr derickr changed the title [WIP] Try out starting our own versions and SSL PHPC-1184: Add alternative topologies to Travis CI Jul 13, 2018
@derickr derickr requested a review from jmikola July 13, 2018 15:49
- export PATH=${PWD}/mongodb-linux-x86_64-${SERVER_VERSION}/bin/:${PATH}
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}.tgz
- tar zxf mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}.tgz
- export PATH=${PWD}/mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}/bin:${PATH}
Copy link
Member

Choose a reason for hiding this comment

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

Was there a problem with the standard Linux builds? Is it that they ship without SSL support?

I'm just curious if we might run into issues with the build team no longer supplying 14.04 builds for newer releases down the line (assuming Travis doesn't upgrade to 16.04 sooner).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the standard ones ship without SSL support :-/ And yes, we will run into issues when we stop supporting 14.04 and Travis doesn't upgrade :-/

- ulimit -a
- ulimit -c unlimited || true
- .travis.scripts/before_script.sh

script:
- export MONGODB_URI=`cat /tmp/uri.txt`
- echo $MONGODB_URI
Copy link
Member

Choose a reason for hiding this comment

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

setup_mo.sh already prints the URI (prefixed with "MongoDB Test URI: "). Why bother doing so again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally, I added the echo here because for some reason the environment variable didn't propagate between steps (i.e., before_script and script). I then later added the export to fix this, and the echo stayed for testing. I am inclined to keep it.

"nssize": 1,
"port": 3000,
"bind_ip_all": true,
"smallfiles": true
Copy link
Member

Choose a reason for hiding this comment

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

Per mongodb-labs/mongo-orchestration#247 (comment), I think we can remove nssize, smallfiles, and noprealloc from all of these configs.

Only the STANDALONE_OLD case under the 3.0.x server version will use MMAPv1 (where noprealloc might still apply); however, I'm not convinced it's worth optimizing for that case (especially since it's not even a replica set). Having these servers use /tmp as their DB path should be enough optimization, since I would expect that to be a RAM disk.

I had previously removed noprealloc from our non-Travis configs in 2ef765a but stupidly added the others in 9a83bde. Perhaps we can remove all three options across the board (for these Travis configs and the non-Travis configs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made a ticket for it, to do this as a low priority thing later: https://jira.mongodb.org/browse/PHPC-1240

"procParams": {
"dbpath": "/tmp/REPLICASET/3000/",
"ipv6": true,
"logappend": true,
Copy link
Member

Choose a reason for hiding this comment

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

Is this option important given that the Travis build boxes are ephemeral?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was useful for Travis in debug mode.

"ipv6": true,
"logappend": true,
"logpath": "/tmp/REPLICASET/3000/mongod.log",
"journal": true,
Copy link
Member

Choose a reason for hiding this comment

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

I expect this was copied over from our non-Travis configs. It looks like storage.journal.enabled defaults to true only on 64-bit platforms, so it's probably sensible to keep this set explicitly in case.

@@ -0,0 +1,89 @@
{
"configsvrs": [ {
"members" : [
Copy link
Member

Choose a reason for hiding this comment

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

These JSON files appear to be using a mix of four-space and tab indents. I'd suggest standardizing on four-space indents, as I did for our non-Travis configs in 8b19fcb.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was only this one... → fixed.

@@ -57,7 +57,7 @@ if (isset($document)) {
<?php exit(0); ?>
--EXPECTF--
Executing command took 0.%d seconds
Rewinding cursor took 1.%d seconds
Rewinding cursor took 0.%r(4|5)%r%d seconds
Copy link
Member

Choose a reason for hiding this comment

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

Good catch. 👍

@@ -12,7 +12,7 @@ PHPC-1045: Segfault if username is not provided for SCRAM-SHA-1 authMechanism
require_once __DIR__ . "/../utils/basic.inc";

// URI does not support auth, but that is not necessary for the test
$m = new MongoDB\Driver\Manager(URI, ['authMechanism' => 'SCRAM-SHA-1', 'ssl' => false]);
$m = new MongoDB\Driver\Manager(URI, ['authMechanism' => 'SCRAM-SHA-1']);
Copy link
Member

Choose a reason for hiding this comment

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

Is the "URI does not support auth" comment above still relevant, given that we may be testing against a server using authentication?

Perhaps this should be changed to: "URI may or may not support auth, but that..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@@ -5,6 +5,7 @@ ConnectionTimeoutException: exceeding sockettimeoutms
<?php skip_if_not_live(); ?>
<?php skip_if_not_clean(); ?>
<?php skip_if_test_commands_disabled(); ?>
<?php skip_if_sleep_command_unavailable(); ?>
Copy link
Member

Choose a reason for hiding this comment

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

If I understand skip_if_sleep_command_unavailable() correctly, it's going to introduce a one-second delay if the server does support the command. If this is also the only place that function would be used, I think the skip is preferable.

I think the best improvement might actually be modifying skip_if_test_commands_disabled() to also skip if the primary server is a mongos node, since it doesn't seem to support any test commands (despite reporting otherwise when we query its configuration).

That will also prove more useful down the line if we inevitably add more tests that want to set fail points.

I'm actually curious how the following tests pass on mongos:

The other two tests that set fail points are currently disabled:

@derickr derickr force-pushed the PHPC-1184-alternative-topologies-travis branch from b42d739 to 7ae04b2 Compare July 16, 2018 09:30
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

LGTM, although there still appear to be two build failures in https://travis-ci.org/mongodb/mongo-php-driver/builds/404364466.

@derickr derickr merged commit 7ae04b2 into mongodb:v1.5 Jul 16, 2018
derickr added a commit that referenced this pull request Jul 16, 2018
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