> Changing the check to FLOAT8_FITS_IN_INT32 would reject larger values. > If we choose that limit, the timeout variable and the WaitForLSN() > argument should also use int so that the interface matches the > accepted range. > > Alternatively, we can preserve the int64 interface and check the > deadline calculation in WaitForLSN(): > > if (pg_mul_s64_overflow(timeout, USECS_PER_MSEC, &timeout_us) || > pg_add_s64_overflow(now, timeout_us, &endtime) || > !IS_VALID_TIMESTAMP(endtime)) > > ----------------- > > Another option is to reject values greater than or equal with > INT64_MAX/1000, which seems a bit hacky to me.
The max timeout value supported by WaitLatch() is INT_MAX, so I think it's reasonable to limit the range to int32. And I think it's ok to use int64 as the argument in WaitForLSN() because convert int32 to int64 is always safe. -- Regards, ChangAo Chen
