Skip to content

[IOTDB-2727] async memory reservation#5317

Closed
cornmonster wants to merge 2 commits intoapache:masterfrom
cornmonster:feature/async_memory_reservation
Closed

[IOTDB-2727] async memory reservation#5317
cornmonster wants to merge 2 commits intoapache:masterfrom
cornmonster:feature/async_memory_reservation

Conversation

@cornmonster
Copy link
Contributor

Async memory reservation for input/output buffer management.


import org.apache.thrift.TException;

public class DataBlockServiceImpl implements DataBlockService.Iface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we delete this class?


reservedBytes -= bytes;

List<MemoryReservationFuture<Void>> futures =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this way, if one query free its memory, it will only notify blocking Futures belonging to this query. Other queries won't be notified and still waiting.
And it seems that one free operation will only notify one blocking Future, but what if this freeing operation frees a large memory block which is large enough for multiple blocking Futures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. Will fix it.


private long reservedBytes = 0L;
private final Map<String, Long> queryMemoryReservations = new HashMap<>();
private final Map<String, List<MemoryReservationFuture<Void>>> queryIdToFutures = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have QueryId class now, you can use that class to replace String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants