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

View File

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