[v14.x] Backport 33570 and 33508 to v14.x
#33508 cannot be backported directly, but must be preceded with a backport of #33570.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines