gjacoby126 commented on pull request #860: URL: https://github.com/apache/phoenix/pull/860#issuecomment-677926205
IndexRebuildRegionScanner doesn't _need_ to know that it's in a bad state because the region is splitting or closing. It just needs to know that it's in a bad state, and to throw an exception. It's a scanner -- at a high level, it should understand open, close, and next(). Scanners and iterators don't usually close _themselves_, some external class does. SRP says that each class should have one reason for existing, and one reason to change. Say HBase 3 adds a new event we'd want to stop the scanner for that's not covered by UARO.checkForRegionClosingOrSplitting(). You'd have to modify IndexRebuildRegionScanner in a bunch of places to call UARO.checkForNewEventState(). On the other hand, if sending a close or kill signal to the scanner is UARO's responsibility, then adding a new region event just changes UARO, and the scanner doesn't change. It's a cleaner separation of concerns. (And also makes this easier to unit test) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
