-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Replace assertBusy of indexExists #126501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
123e9c9
9c1d4c0
a3338b3
7ea2eab
59c6473
780d0e7
75c1464
5ef316e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1731,6 +1731,20 @@ public static boolean indexExists(String index, Client client) { | |
return getIndexResponse.getIndices().length > 0; | ||
} | ||
|
||
public static void ensureIndexExists(String index) { | ||
ensureIndexExists(index, SAFE_AWAIT_TIMEOUT.seconds(), SAFE_AWAIT_TIMEOUT.timeUnit()); | ||
} | ||
|
||
public static void ensureIndexExists(String index, long timeout, TimeUnit unit) { | ||
|
||
safeGet( | ||
clusterAdmin().prepareHealth(new TimeValue(timeout, unit), index) | ||
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED) | ||
.execute(), | ||
timeout, | ||
unit | ||
); | ||
} | ||
|
||
|
||
/** | ||
* Syntactic sugar for enabling allocation for <code>indices</code> | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit, maybe
awaitIndexExists
to show that it will wait? Otherwise this reads to me as something that will immediately fail if the index doesn't exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep renamed as suggested. Thanks!