Skip to content

Commit 717fa6b

Browse files
authored
PHPC-1870 and PHPC-1872: Fix zSeries builds and testing with RS arbiters (#1232)
* PHPC-1870: Include config.h after php.h to avoid redef of WORDS_BIGENDIAN This should fix zSeries build failures introduced by 324182a * PHPC-1872: Count data-bearing nodes for write concern WC using the total server count cannot be satisfied if the RS includes arbiters.
1 parent f317976 commit 717fa6b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/phongo_apm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifdef HAVE_CONFIG_H
18-
#include "config.h"
19-
#endif
20-
2117
#include "bson/bson.h"
2218
#include "mongoc/mongoc.h"
2319

@@ -26,6 +22,10 @@
2622
#include <Zend/zend_interfaces.h>
2723
#include <Zend/zend_operators.h>
2824

25+
#ifdef HAVE_CONFIG_H
26+
#include "config.h"
27+
#endif
28+
2929
#include "phongo_compat.h"
3030
#include "php_phongo.h"
3131
#include "phongo_apm.h"

tests/server/server-executeQuery-008.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ $manager = create_test_manager();
1313

1414
$primaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
1515
$primary = $manager->selectServer($primaryRp);
16-
$serverCount = count($manager->getServers());
16+
17+
// Count all data-bearing members to use for the write concern
18+
$dataBearingNodes = count(array_filter($manager->getServers(), function (MongoDB\Driver\Server $server) {
19+
return ($server->isPrimary() || $server->isSecondary());
20+
}));
1721

1822
$bulk = new \MongoDB\Driver\BulkWrite;
1923
$bulk->insert(['_id' => 1, 'x' => 1]);
20-
$primary->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern($serverCount));
24+
$primary->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern($dataBearingNodes));
2125

2226
$secondaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
2327
$secondary = $manager->selectServer($secondaryRp);

0 commit comments

Comments
 (0)