Backport some bug fixes from the 3.x branch to the 2.x branch by ilixiaocui · Pull Request #1277 · apache/ratis

What changes were proposed in this pull request?

We are currently operating ​​Ratis 2.4.0 in production at significant scale​​, where we've observed two recurring issues related to snapshot installation – consistent with existing community reports (reference: RATIS-2140 RATIS-2208)

​​Would it be possible​​, at your convenience, to consider backporting the associated fixes to the ​​2.x maintenance branch​​? Such an effort would greatly assist our team in planning a ​​stable production upgrade path​​ while continuing to leverage this foundational version.

We sincerely appreciate your guidance on this matter and remain grateful for the community's ongoing stewardship of Ratis.

What is the link to the Apache JIRA

RATIS-2140
RATIS-2208

How was this patch tested?