mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
When PQ is full, workers wake up writer thread in every read.
However, without removing a fully acked page, queue is still full.
This commit changes the condition of notFull signal.
Fixed: #6801
(cherry picked from commit da68ff3803
)
Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>
This commit is contained in:
parent
a6cd4bf949
commit
27c512fb17
1 changed files with 10 additions and 6 deletions
|
@ -509,21 +509,25 @@ public final class Queue implements Closeable {
|
|||
public boolean isFull() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (this.maxBytes > 0L && isMaxBytesReached()) {
|
||||
return true;
|
||||
} else {
|
||||
return (this.maxUnread > 0 && this.unreadCount >= this.maxUnread);
|
||||
}
|
||||
return isMaxBytesReached() || isMaxUnreadReached();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMaxBytesReached() {
|
||||
if (this.maxBytes <= 0L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final long persistedByteSize = getPersistedByteSize();
|
||||
return ((persistedByteSize > this.maxBytes) || (persistedByteSize == this.maxBytes && !this.headPage.hasSpace(1)));
|
||||
}
|
||||
|
||||
private boolean isMaxUnreadReached() {
|
||||
return this.maxUnread > 0 && (this.unreadCount >= this.maxUnread);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue is considered empty if it does not contain any tail page and the headpage has no element or all
|
||||
* elements are acked
|
||||
|
@ -636,7 +640,7 @@ public final class Queue implements Closeable {
|
|||
}
|
||||
|
||||
if (! p.isFullyRead()) {
|
||||
boolean wasFull = isFull();
|
||||
boolean wasFull = isMaxUnreadReached();
|
||||
|
||||
final SequencedList<byte[]> serialized = p.read(left);
|
||||
int n = serialized.getElements().size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue