Github user nsoft commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/433#discussion_r213400327
--- Diff:
solr/core/src/java/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessor.java
---
@@ -405,4 +435,54 @@ protected void doClose() {
collection, slice.getName(),
DistributedUpdateProcessor.MAX_RETRIES_ON_FORWARD_DEAULT);
}
+
+ /**
+ * Create as many collections as required. This method loops to allow
for the possibility that the routeTimestamp
+ * requires more than one collection to be created. Since multiple
threads may be invoking maintain on separate
+ * requests to the same alias, we must pass in the name of the
collection that this thread believes to be the most
+ * recent collection. This assumption is checked when the command is
executed in the overseer. When this method
+ * finds that all collections required have been created it returns the
(possibly new) most recent collection.
+ * The return value is ignored by the calling code in the async
preemptive case.
+ *
+ * @param targetCollection the initial notion of the latest collection
available.
+ * @param docTimestamp the timestamp from the document that determines
routing
+ * @param printableId an identifier for the add command used in error
messages
+ * @return The latest collection, including collections created during
maintenance
+ */
+ public String maintain(String targetCollection, Instant docTimestamp,
String printableId, boolean asyncSinglePassOnly) {
+ do { // typically we don't loop; it's only when we need to create a
collection
+
+ // Note: This code no longer short circuits immediately when it sees
that the expected latest
--- End diff --
That's fine, the comment mostly aimed at making the review process clearer.
You're right it probably doesn't need to be carried forward
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]