Skip to content
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

Lucene Index - Read Committed #411

Closed
rsoika opened this issue Aug 22, 2018 · 4 comments
Closed

Lucene Index - Read Committed #411

rsoika opened this issue Aug 22, 2018 · 4 comments
Labels
Milestone

Comments

@rsoika
Copy link
Member

rsoika commented Aug 22, 2018

Read Uncommitted

In the current version Lucene Index works with an Isolation level equals to 'Read Uncommitted'. This means, during a transaction each client reads the uncommitted index. This means a different transaction read changed index by an transaction which is still in progress. This leads to Dirty reads. In addition a rollback did not update the index. This my lead to kind of unexpected behavior and errors.

Read Committed

The solution is an implementation of "Read Committed". This means a transaction can not search in a uncommitted index. Index updated by different transaction which is still in progress can not be read. Dirty reads are prevented.

Solution

The LuceneIndexWriter writes a LucenEventLogEntry each time a client requests an update. This is called the EventLogCache. When a client reads the index, the LuceneIndexSearchService calls the method "flushEventLogCache" of the LuceneIndexWriter. This is a method running in a new Transaction (annotation TransactionNew). The method checks if committed EventLog entries exits. If so the method updates the index first. This new behavior will have a tolerable impact on performance as the first read call must wait until the index was refreshed. Writes become a little bit faster.

@rsoika rsoika added the feature label Aug 22, 2018
@rsoika
Copy link
Member Author

rsoika commented Aug 22, 2018

Started branch 'issue-411'

rsoika added a commit that referenced this issue Aug 22, 2018
rsoika added a commit that referenced this issue Aug 22, 2018
rsoika added a commit that referenced this issue Aug 22, 2018
@rsoika
Copy link
Member Author

rsoika commented Aug 23, 2018

In case that the dertyIndex flag is set to "true", but the flushCache method did not find any event log entries, than we should not reset the dirtyIndex flag to false because there is still a uncommitted transaction running. How to solve this issue?

rsoika added a commit that referenced this issue Aug 23, 2018
@rsoika
Copy link
Member Author

rsoika commented Aug 25, 2018

Check if this affects the inernal method call "isCallerReader".
This method did not check the data obejct for null!

possible solution:

	 * In case the document is not yet full initialized and has no data, the method returns true. 
	 * 
	 * @return true if user has readaccess
	 */
	private boolean isCallerReader(Document document) {

		if (document==null || document.getData()==null) {
			// method is called on non not fully persisted document
			return true;
		}

@rsoika
Copy link
Member Author

rsoika commented Aug 25, 2018

To avoid a conflict with the snapshotservice we need to prafix the eventLogEntryID instad of sufix the eventLogEntryID.

This is because the snapshotservice constructs the following JPQL which includes the eventLogEntries

SELECT document FROM Document AS document
 WHERE document.id > 'c246275c-f0a0-48c1-b803-f86fef6552e9-'
 AND document.id < 'c246275c-f0a0-48c1-b803-f86fef6552e9-1535232763173'
 ORDER BY document.id ASC

rsoika added a commit that referenced this issue Aug 25, 2018
@rsoika rsoika added this to the 4.4.0 milestone Aug 26, 2018
@rsoika rsoika closed this as completed Oct 1, 2018
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
bvfalcon pushed a commit to bvfalcon/imixs-workflow that referenced this issue Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant