OAK-12249: lazy ES index provisioning — skip creation for empty reindex - #3085
Conversation
a6f718a to
2f564a4
Compare
fabriziofortino
left a comment
There was a problem hiding this comment.
Logic LGTM. Just a few improvements.
| @Override | ||
| public ElasticIndexWriter getWriter() { | ||
| return (ElasticIndexWriter) super.getWriter(); | ||
| public FulltextIndexWriter<ElasticDocument> getWriter() { | ||
| return super.getWriter(); |
There was a problem hiding this comment.
there is actually no need for that. We could remove it
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| @Version("2.4.1") |
There was a problem hiding this comment.
There was a problem hiding this comment.
I know, I'm not sure what to put here. This was to get the build working. Should I align, already increase waiting for that PR to merge ?
892ed26 to
3d68cd4
Compare
When FT_OAK-12249 and FT_OAK-12248 are both enabled, ElasticIndexWriter defers provisionIndex() from the constructor to the first updateDocument() or deleteDocuments() call. A reindex that produces zero documents never creates an Elasticsearch index or alias, eliminating the empty-index problem described in OAK-12249. Deployment order is enforced at runtime: isLazyProvisioningActive() returns true only when both toggles are on. Enabling FT_OAK-12249 alone logs a WARN and falls back to eager provisioning, preventing 404 errors on query paths that lack graceful 404 handling. ensureProvisioned() handles the incremental-write-after-empty-reindex case: if an alias does not exist when the first document arrives, it creates a new backing index with a fresh seed and points the alias at it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3d68cd4 to
ef33424
Compare
|
This PR changed classes in Both packages are still declared as This breaks |
|
Yeah, the situation was weird. My PR was building fine until it didn't anymore without adding the package-info.json files. So I didn't know exactly what was going on, whether they should be added or not, with which version, etc. Anyway, there was a commit that was missed before the PR got merged. |
|
@bhabegger - the right thing here would have been to ask. |
Summary
provisionIndex()from theElasticIndexWriterconstructor to the firstupdateDocument(),deleteDocumentTree(), ordeleteDocument()call when bothFT_OAK-12249andFT_OAK-12248are enabledensureProvisioned()handles the incremental-write-after-empty-reindex case: if an alias does not exist when the first document arrives, it creates a new backing index with a fresh seed and points the alias at itDependency on OAK-12248
OAK-12248 (#2950, graceful 404 handling) has merged to trunk. This branch is rebased on top of it.
The runtime dependency remains:
isLazyProvisioningActive()returnstrueonly when bothFT_OAK-12249andFT_OAK-12248are enabled. EnablingFT_OAK-12249alone falls back to eager provisioning and logs aWARN.Tests
Three new unit tests in
ElasticIndexWriterTest:lazyProvisioning_requiresGraceful404Toggle— asserts lazy provisioning is inactive when OAK-12248 toggle is offemptyReindex_doesNotCreateEsIndex— verifies no ES index is created during construction when no documents are writtennonEmptyReindex_provisionsOnFirstDocument— verifiesprovisionIndex()is called on the firstupdateDocument()and not beforeAll 11 tests in
ElasticIndexWriterTestpass; fulloak-search-elasticsuite (514 tests) passes.Note
Supersedes #2955, opened from #2955 (bhabegger/jackrabbit-oak), moved to this fork to pick up CI.
Jira
https://issues.apache.org/jira/browse/OAK-12249