quantranhong1999 commented on PR #2315:
URL: https://github.com/apache/james-project/pull/2315#issuecomment-2205570764
> Have you checked for race conditions?
Synchronized keyword does not solve the issue for example.
> With the UpdatedFlags ad hand we can instead subtilly mix added flags /
deletes flags?
BTW we might adopt a similar indempotent friendly way to apply updates into
OpenSearch too I believe...
It is likely not impossible with Lucene or at least our case for partial
update (Lucene supports partially update only NUMERIC and BINARY field type
while our flags need to be STRING to easily query). `Lucene does not provide a
direct API to update just a part of a document. The typical approach in Lucene
is to delete the old document and add a new one with the updated fields. This
is because Lucene's indexing structure does not allow for in-place updates of
individual fields without reindexing the entire document.`
> My feeling is we have an issue updating the flag for the messages that
already have a flag.
So after a `.updateDocument` call:
- If I use the old `IndexReader`, I see no change on the document but can
search for the document.
- If I use the new `IndexReader` (to try to get the latest snapshot of
the index), I see no change on the document and even can not search for the
document.
I tried to make `IndexWriter` commit everywhere and open new `IndexReader`
but can not see the change got reflected (right away). And somehow the update
is really laggy.
e.g:
- after we set the `FLAGGED` flag on the message, we see the message has no
flag.
- after we add the `ANSWER` flag to the message, we see the message has only
the `FLAGGED` flag.
I do not understand how that happens....
I tried to implement the optimistic concurrent control for the update flag,
but either the `.updateDocument` API of Lucene suck as it just returns void (no
way to know if the update succeeds or not so we can retry) or the `IndexReader`
is not reliable to get the latest status of the document.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]