saintstack commented on a change in pull request #378: HBASE-22684 The log
rolling request maybe canceled immediately in Log…
URL: https://github.com/apache/hbase/pull/378#discussion_r303223651
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
##########
@@ -950,16 +944,13 @@ protected final SyncFuture getSyncFuture(long sequence) {
}
protected boolean isLogRollRequested() {
- return rollRequested;
+ return rollRequested.get();
}
protected final void requestLogRoll(final
WALActionsListener.RollRequestReason reason) {
// If we have already requested a roll, don't do it again
- if (rollRequested) {
- return;
- }
- if (!this.listeners.isEmpty()) {
- rollRequested = true; // No point to assert this unless there is a
registered listener
+ // And only set rollRequested to true when there is a registered listener
+ if (!this.listeners.isEmpty() && rollRequested.compareAndSet(false, true))
{
Review comment:
This looks good. Like a good bug fix.
----------------------------------------------------------------
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]
With regards,
Apache Git Services