tkhurana opened a new pull request, #2642:
URL: https://github.com/apache/phoenix/pull/2642

   PhoenixRegionServerEndpoint.stop() ran ReplicationLogGroup.closeAll() in 
preStop, before HBase closes the regions. A live write already committed to the 
WAL could then fail replication with IOException("Closed"); with a clean region 
close the WAL is never replayed, so the edit was never shipped.
   
   The endpoint's stop now closes the groups only if the server has no open 
IndexRegionObserver region, e.g. after the regions were moved away before a 
graceful stop (ReplicationLogGroup.closeAllIfNoOpenRegions). Otherwise the 
close is deferred: IndexRegionObserver counts its open regions per server 
(postOpen/postClose), and when the last one closes while the server is stopped, 
stopping or aborted, ReplicationLogGroup.regionClosed() closes that server's 
groups. HBase calls postClose after the region close has drained in-flight 
writes, including their replication sync, so every committed write is shipped 
and the writers close cleanly with a trailer. A failed open runs postClose, 
possibly without postOpen, so a per-region flag keeps the count from being 
undercounted. A count that reaches zero in normal operation (regions moved 
away) leaves the groups open.
   
   A kill skips the region close, so testWALRestore still closes the killed 
RS's groups by hand. testGracefulRegionServerStopClosesLogGroups holds a write 
after its WAL commit across a stop and checks that the stopping RS's own log 
carries it; it fails with the old preStop close. 
testRegionServerStopAfterUnloadClosesLogGroups moves the regions away first and 
checks that the stop closes the groups.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to