-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#15243) * Pipeline to pipeline communication acked queue improvements. * Handle InterruptedException exception in input back, warn message improvement when in-flight events are partially sent and other minor such as descriptive logs, etc improvements. * Apply suggestions from code review Check if queue is open after thread acquires the lock. Co-authored-by: Ry Biesemeyer <[email protected]> * Apply suggestions from code review Unite test case improvement: use `assertThrows` when validating the exception. Co-authored-by: Ry Biesemeyer <[email protected]> * Pulling off of introducing wrap with operations. * Introduce functional interface to broadly use to catch the exception types. * Addressing comments: do not retry sending inflight events on case. We still throw if we get error when opening queue. * will not be reached input retry logic, removing. * Move queue close check after thread acquiring a lock. Make read next page interface private since it is an internal use purpose. * Apply suggestions from code review Leave a comment for the write lock and remove unnecessary warning with `ensure_delivery=>false` Co-authored-by: Ry Biesemeyer <[email protected]> * Remove unused method, check if current thread acquired lock when accessing next page. * pq: getting possibly-shared access to next read page is illegal The private `Queue#nextReadPage()` method requires that the caller has exclusive ownership of the lock, and failing to have the lock is an illegal state that cannot be recoverd from; it would leak the effectively-private `Page` to a caller that cannot reliably use it without corrupting other callers. Both callers of this private method already call it with exclusive access, so this safeguard is merely to prevent future development from breaking the expectation unknowingly. As such, we throw an `IllegalStateException`. * pq: use shared queue-closed check for block and non-block reads By moving the closed-check from the blocking `Queue#readBatch` to the shared private `Queue#nextReadPage`, we ensure that both blocking reads by `Queue#readBatch` and non-blocking reads by `Queue#nonBlockReadBatch` behave the same when the queue has been closed. * pq: make exception message constants descriptive * p2p: clarify comment about cumulating retry behaviour --------- Co-authored-by: Ry Biesemeyer <[email protected]> Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit e890049) Co-authored-by: Mashhur <[email protected]>
- Loading branch information
1 parent
de4241a
commit acaec27
Showing
15 changed files
with
186 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
logstash-core/src/main/java/org/logstash/ackedqueue/QueueExceptionMessages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
|
||
package org.logstash.ackedqueue; | ||
|
||
/** | ||
* A public class holds number of descriptive messages are used during the interaction with acked queue. | ||
*/ | ||
public class QueueExceptionMessages { | ||
|
||
public final static String CANNOT_READ_FROM_CLOSED_QUEUE = "Attempted to read on a closed acked queue."; | ||
|
||
public final static String CANNOT_WRITE_TO_CLOSED_QUEUE = "Tried to write to a closed queue."; | ||
|
||
public final static String BIGGER_DATA_THAN_PAGE_SIZE = "data to be written is bigger than page capacity"; | ||
|
||
public final static String CANNOT_CREATE_QUEUE_DIR = "Error creating queue directories."; | ||
|
||
public final static String CANNOT_DESERIALIZE = "cannot find deserialize method on class "; | ||
|
||
public final static String UNHANDLED_ERROR_WRITING_TO_QUEUE = "Unhandleable error occurred while writing to queue."; | ||
|
||
public final static String CANNOT_READ_PAGE_WITHOUT_LOCK = "Cannot get next read page without first acquiring the lock."; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.