Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/postgres/src/backend/commands/variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ is_staleness_acceptable(int32_t staleness_ms)
int32_t max_clock_skew_usec = YBGetMaxClockSkewUsec();
const int kMargin = 2;

if (staleness_ms * 1000 < kMargin * max_clock_skew_usec)
if ((int64_t) staleness_ms * 1000 < (int64_t) kMargin * max_clock_skew_usec)
{
GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
GUC_check_errmsg("cannot enable yb_read_from_followers with a staleness of less than "
Expand Down
2 changes: 2 additions & 0 deletions src/yb/yql/pgwrapper/pg_mini-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ TEST_F(PgMiniTest, FollowerReads) {
ASSERT_NOK(conn.Execute(Format("SET yb_follower_read_staleness_ms = $0", 999)));
// Setting a value > 2 * max_clock_skew should work.
ASSERT_OK(conn.Execute(Format("SET yb_follower_read_staleness_ms = $0", 1001)));
// Setting a large value (INT_MAX) should not overflow.
ASSERT_OK(conn.Execute(Format("SET yb_follower_read_staleness_ms = $0", INT_MAX)));

ASSERT_OK(conn.ExecuteFormat("SET yb_read_from_followers = false"));
if (expect_old_behavior_before_20482) {
Expand Down