Fixing overlord unable to become a leader when syncing the lock from metadata store. (#14038)

This commit is contained in:
Karan Kumar 2023-04-10 12:37:31 +05:30 committed by GitHub
parent d52bc333aa
commit 8712098301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -201,7 +201,6 @@ public class TaskLockbox
task.getId(), task.getId(),
task.getGroupId() task.getGroupId()
); );
continue;
} }
} }
@ -237,6 +236,7 @@ public class TaskLockbox
* groupId, dataSource, and priority. * groupId, dataSource, and priority.
*/ */
@VisibleForTesting @VisibleForTesting
@Nullable
protected TaskLockPosse verifyAndCreateOrFindLockPosse(Task task, TaskLock taskLock) protected TaskLockPosse verifyAndCreateOrFindLockPosse(Task task, TaskLock taskLock)
{ {
giant.lock(); giant.lock();
@ -297,6 +297,12 @@ public class TaskLockbox
return createOrFindLockPosse(request); return createOrFindLockPosse(request);
} }
catch (Exception e) {
log.error(e,
"Could not reacquire lock for task: %s from metadata store", task.getId()
);
return null;
}
finally { finally {
giant.unlock(); giant.unlock();
} }

View File

@ -449,9 +449,9 @@ public class TaskLockboxTest
); );
final TaskLockbox lockbox = new TaskLockbox(taskStorage, metadataStorageCoordinator); final TaskLockbox lockbox = new TaskLockbox(taskStorage, metadataStorageCoordinator);
expectedException.expect(IllegalArgumentException.class); TaskLockboxSyncResult result = lockbox.syncFromStorage();
expectedException.expectMessage("lock priority[10] is different from task priority[50]"); Assert.assertEquals(1, result.getTasksToFail().size());
lockbox.syncFromStorage(); Assert.assertTrue(result.getTasksToFail().contains(task));
} }
@Test @Test