Boyi Dai created HBASE-30589:
--------------------------------

             Summary: A lost response to taking the backup exclusive lock 
leaves every later backup operation blocked
                 Key: HBASE-30589
                 URL: https://issues.apache.org/jira/browse/HBASE-30589
             Project: HBase
          Issue Type: Bug
          Components: backup&restore
    Affects Versions: 4.0.0-alpha-1, 3.0.0
            Reporter: Boyi Dai


If the response to taking the backup exclusive lock is lost, the backup fails 
holding the lock, and every later backup create, delete and merge fails until 
the lock is cleared by hand. {{hbase backup repair}} reports nothing to repair 
and returns 0 without releasing it.

# One of the two conditional puts in 
{{BackupSystemTable.startBackupExclusiveOperation}} sets {{activesession:}} to 
{{yes}}, but the client gets an error back.
# The client retries it. {{checkAndMutate}} is not idempotent under retries 
(HBASE-15588), so the retry finds {{yes}} and returns false, and 
{{startBackupExclusiveOperation}} throws {{ExclusiveOperationException}}.
# {{BackupManager.startBackupSession}} waits for the lock it holds itself until 
{{hbase.backup.exclusive.op.timeout.seconds}} (an hour by default) and fails. 
The backup never wrote its RUNNING record.
# {{repair}} prints "no failed sessions found", finds no failed delete or 
merge, and returns 0 with the lock still held.

{{BackupAdminImpl.deleteBackups}} can leave the lock the same way: on the same 
lost response it returns -1 while holding it, before recording the delete.

This was found through code analysis. I reproduced it with a test that makes 
the backup system table region fail the first successful update of the lock 
after applying it: the backup fails waiting for its own lock, {{repair}} 
returns 0, and the next backup fails the same way.

The end state is the one HBASE-18886 reports for a cancelled backup command 
(the lock is held and no operation is recorded), so the fix covers that case 
too: {{repair}}, when there is no RUNNING backup and no failed delete or merge 
to repair, releases the lock if it is still held. {{repair}} already assumes no 
backup operation is running, since it marks a RUNNING backup failed and 
releases the lock without checking whether it is alive.

PR: https://github.com/apache/hbase/pull/8921



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to