Skip to content

Conversation

shaan1337
Copy link
Member

No description provided.

Copy link

linear bot commented Aug 14, 2025

Copy link
Contributor

github-actions bot commented Aug 14, 2025

Qodana for .NET

3 new problems were found

Inspection name Severity Problems
Redundant using directive 🔶 Warning 2
Redundant 'partial' modifier on type declaration 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

shaan1337 and others added 8 commits August 15, 2025 15:00
…reading them:

* If in-flight records are committed/cleared while reading them, stop where we have reached and return a partial result.

* Always read in-flight records before reading database records:
 * If in-flight records are committed while reading, we can be sure that they will be present in the subsequent query of database records.
 * After we've read the database records, some of them may overlap with in-flight records: deduplicate the result.

* Simplify inclusive/exclusive log position queries

* Simplify sorting by RowId: Always sort in ascending order (return negative RowIds for backwards database reads)
…es event by event, not transaction by transaction

(Using only the `PreparePosition` means that the checkpoint could move backwards when processing events from an explicit transaction)
…dditional complexity.

There were some issues with the implementation:
* "" ($all) was being passed as the index name to SubscriptionMessage.PollStream
* The position being polled was incorrect (it was using the main index's position instead of the secondary index's position)
* Long polls are not suitable for backward index reads - only forward reads
* MissedEvents: the lastIndexedPosition is the main index's position, not the secondary index's position
* cosmetic fixes
* don't exclude first event when subscribing to the beginning of the index
…n reached (instead of potentially reading an extra page)
- Throw ObjectDisposedException when disposed
- Use the prepare/commit positions from resolvedEvent.OriginalPosition
- Track the stream index processor's commit time as part of the commit time
- Separate initialization of the last appended record to avoid the need for synchronization. If the last event in the log was a system event, it was also previously filtered out by RecordAppended()
- Use the commit position instead of prepare position of events
…tion when reading events

This is required as prepares written with explicit transactions will not have an expected version set - the event number is derived from the commit record.
- Clear in-flight records after flushing the appender to make sure that concurrent reads will see the record either in the in-flight records or in the database
The data in the secondary indexes is already committed to a quorum number of nodes, so it might be ok.
But it might be risky, as disposal could be happening due to a fatal error.
for e.g consider the case where the system ran out of disk space: we are trying to write even more data.
…irectory by default:

- Indexes are usually stored on a separate disk so that IOPS are not shared with the DB for better performance
- It's better if DuckDB related files (like the write-ahead log, etc.) are stored in its own directory so that the database code doesn't accidentally modify them. (for e.g all .tmp files are deleted on startup)
@shaan1337 shaan1337 force-pushed the alexey/secondary-indexes-suggestions branch from 9b4b036 to 2f85acd Compare September 1, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants