Skip to content

Commit 97cf5c1

Browse files
committed
limit num threads in tests for 32 bit builds
1 parent 36fdfd4 commit 97cf5c1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

google/cloud/bigtable/internal/query_plan_test.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ TEST(QueryPlanTest, CreateFailedPlanAndRefresh) {
228228
fake_cq_impl->SimulateCompletion(false);
229229
}
230230

231+
// TODO(#15695): For reasons not yet understood, the fedora m32 CI build has
232+
// failures not seen in m64 builds when the number of threads is "too" high.
233+
constexpr int LimitNumThreadsOn32Bit(int num_threads) {
234+
#if INTPTR_MAX == INT32_MAX
235+
return std::min(num_threads, 500);
236+
#else
237+
return num_threads;
238+
#endif
239+
}
240+
231241
TEST(QueryPlanMultithreadedTest, RefreshInvalidatedPlan) {
232242
using google::bigtable::v2::PrepareQueryResponse;
233243
auto fake_cq_impl = std::make_shared<FakeCompletionQueueImpl>();
@@ -255,7 +265,7 @@ TEST(QueryPlanMultithreadedTest, RefreshInvalidatedPlan) {
255265
ASSERT_STATUS_OK(data);
256266
EXPECT_EQ(data->prepared_query(), "original-query-plan");
257267

258-
constexpr int kNumThreads = 1000;
268+
constexpr int kNumThreads = LimitNumThreadsOn32Bit(1000);
259269
std::vector<std::thread> threads(kNumThreads);
260270
std::array<StatusOr<PrepareQueryResponse>, kNumThreads> data_responses;
261271

@@ -321,7 +331,7 @@ TEST(QueryPlanMultithreadedTest, RefreshInvalidatedPlanTransientFailures) {
321331
ASSERT_STATUS_OK(data);
322332
EXPECT_EQ(data->prepared_query(), "original-query-plan");
323333

324-
constexpr int kNumThreads = 1000;
334+
constexpr int kNumThreads = LimitNumThreadsOn32Bit(1000);
325335
std::vector<std::thread> threads(kNumThreads);
326336
std::array<StatusOr<PrepareQueryResponse>, kNumThreads> data_responses;
327337

@@ -427,7 +437,7 @@ TEST(QueryPlanMultithreadedTest, RefreshInvalidatedPlanAfterFailedRefresh) {
427437
// of QueryPlan is RefreshState::kBegin, so the first thread to call
428438
// response() should trigger a new refresh with the other threads waiting for
429439
// it to complete.
430-
constexpr int kNumThreads = 1000;
440+
constexpr int kNumThreads = LimitNumThreadsOn32Bit(1000);
431441
std::vector<std::thread> threads(kNumThreads);
432442
std::array<StatusOr<PrepareQueryResponse>, kNumThreads> data_responses;
433443

0 commit comments

Comments
 (0)