aryangupta1998 commented on PR #8260:
URL: https://github.com/apache/ozone/pull/8260#issuecomment-2800889228
@Tejaskriya, thanks for adding the tests.
Regarding the priority handling, I checked the code and noticed that
BackgroundTaskQueue is backed by a PriorityQueue using:
`Comparator.comparingInt(BackgroundTask::getPriority)`
So we can assign priorities to the tables we want to compact based on a
predefined static order. Let's say we decide to compact the tables in this
order,
```
private static final List<String> PRIORITY_ORDER = Arrays.asList(
"deletedTable",
"deletedDirectoryTable",
"multipartInfoTable",
"keyTable",
"fileTable",
"directoryTable"
);
```
Then, in the CompactTask constructor, we can assign priority using the
table’s index in this list:
```
public CompactTask(String tableName) {
this.tableName = tableName;
int index = PRIORITY_ORDER.indexOf(tableName);
this.priority = (index >= 0) ? index : PRIORITY_ORDER.size(); //
fallback to lowest
}
@Override
public int getPriority() {
return priority;
}
```
With this change, tasks in the background service will be polled and
executed in the order of their assigned priority, ensuring higher-tombstone
tables get compacted first.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]