HDFS-17053. Optimize method BlockInfoStriped#findSlot to reduce time complexity. (#5757). Contributed by farmmamba.

Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
hfutatzhanghb 2023-06-19 17:19:23 +08:00 committed by GitHub
parent 7c54a78343
commit e14c52c25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,8 @@ private void initIndices() {
private int findSlot() {
int i = getTotalBlockNum();
for (; i < getCapacity(); i++) {
int capacity = getCapacity();
for (; i < capacity; i++) {
if (getStorageInfo(i) == null) {
return i;
}