## Description
remove unneeded Result in exec unixepoch
## Motivation and context
I can't commit a lot of time to the project but I'm slowly trying to get
into the code and I'm currently taking a look at understanding enough to
implement https://github.com/tursodatabase/turso/issues/602 at least
partially.
While exploring the code for `unixepoch` I found what seems to be like
an unneeded `Result`, since the underlying APIs don't fail themselves.
## Description of AI Usage
No AI Usage, I'm trying to get into the code base the old-fashioned way
as a way to keep up my Rust skills more or less sharp (had to change
jobs and I no longer work with Rust as much :( )
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#4292
## Description
The existing squeue overflow handling logic improperly error'd when
`squeue full` instead of best-effort pushing any overflow SQE's when
`flush_overflow` was called and then preserved others for later retry.
Also fixed bug where `empty` didn't take overflow SQE's into
consideration.
## Motivation and context
fixing 2043523817/j
ob/58714851849?pr=4326
## Description of AI Usage
nada
Reviewed-by: Pedro Muniz (@pedrocarlo)
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#4329
Hey great project! In this PR I did some improvements for optimization
and code readability. please run the benchmarks yourself to see if you
like these changes. for me it yields 5-8% better performance specially
on long queries.
Note: I removed some `unwrap` from the `parser.rs`, please review those
parts, tests are running fine, but I'm unsure about soundness of what I
did there, If we need those unwraps it is easy to add unwrap to
`TokenType`.
## Description
I improved lexer in following ways:
1. Used `.get(self.offset..).unwrap_or(&[])` to eliminate `panic` code
handling generation.
2. Improved `eat_while` implementation to be faster and also easier to
work with.
For the second commit:
1. I moved `None` to `TokenType` itself, as it is slower to process
`Option<TokenType>`.
General improvement:
I marked some parts of code with `cold()` as they are unlikely branches.
I added `new` function to `Token` and it is much easier to read the
code.
## Motivation and context
Improving lexer and parser performance and also code readability.
## Description of AI Usage
None, I have copilot installed, I tried to use it for `new` function
refactoring parts it generated too many bugs that I rewrote those parts
myself again.
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#4327
## Description
Emits Affinity instruction in places SQLite also emits affinity
instructions.
<!--
Please include a summary of the changes and the related issue.
-->
## Motivation and context
Closes https://github.com/tursodatabase/turso/issues/4154Closes#3481
Closes https://github.com/tursodatabase/turso/issues/3477
<!--
Please include relevant motivation and context.
Link relevant issues here.
-->
## Description of AI Usage
Ai generated with my prompting and guidance.
https://opncd.ai/share/EC7FRkwT
<!--
Please disclose how AI was used to help create this PR. For example, you
can share prompts,
specific tools, or ways of working that you took advantage of. You can
also share whether the
creation of the PR was mainly driven by AI, or whether it was used for
assistance.
This is a good way of sharing knowledge to other contributors about how
we can work more efficiently with
AI tools. Note that the use of AI is encouraged, but the committer is
still fully responsible for understanding
and reviewing the output.
-->
Closes#4300
This is take 2 of this PR. With most of the description from the other
PR intact.
https://github.com/tursodatabase/turso/pull/4208
If you want to test the change try running `cargo run --bin tursodb
test.db --readonly` in two separate shells in main and in this PR.
## Description
Avoid file locking in read only mode, so that multiple processes can
read from it. We don't really support multi processing yet, but this
allows us to run many databases in read-only mode in multiple processes.
Includes some fixes in unnecessarily opening WAL files and just
simplifying the WAL opening logic.
**EDIT:**
I mistankely thought that for some reason this was fixed after I closed
this PR, but I noticed that I was just dumb and forgot to rebase my test
runner PR to remove these commits. So I thought the issue was fixed in
main, when it was not.
<!--
Please include a summary of the changes and the related issue.
-->
## Motivation and context
I'm building a custom test runner and for parallelism, I need to run
some Databases in different processes in read-only mode.
<!--
Please include relevant motivation and context.
Link relevant issues here.
-->
## AI Disclosure
Used AI for a bug I was having regarding opening a WAL in read-only
mode, when it did not exist. It was great excuse to test opencode and
its share feature
https://opncd.ai/share/fDj8QAsz
<!--
Please disclose if any LLM's were used in the creation of this PR and to
what extent,
to help maintainers properly review.
-->
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#4309
## Description
run PRAGMA journal_mode=experimental_mvcc with mvcc
## Motivation and context
After https://github.com/tursodatabase/turso/pull/4294 we need a way run
with mvcc mode.
## Description of AI Usage
it wrote the remove first line
Closes#4298
## CI speed improvements
Let's use Sccache for compiling our code faster, cargo nextest to run
tester faster, run all tests in CI, automatically terminate workflows if
you push a new commit (so we don't waste more money running code that we
don't care anymore).
Also https://github.com/useblacksmith/rust-cache is deprecated, so we
should be using `Swatinem/rust-cache@v2`
## CI test setup fixes
We were ignoring entire suites of tests in CI. Re-enable them and fix
the failures. Most of them were stale test setups, apart from https://gi
thub.com/tursodatabase/turso/pull/4311/commits/a67eb0006d8ac23dd85918309
303701959fdc988 which appears to be a real bug.
Also fix linking sqlite not working on windows for compat tests
## Runtime code fixes
a67eb0006d
dd85918309303701959fdc988 appears to be a real bug in GroupCompletion
code - `succeeded()` requires that the result be set to `Some(None)`
## Motivation and context
Closes https://github.com/tursodatabase/turso/issues/4266
<!--
Please include relevant motivation and context.
Link relevant issues here.
-->
## Description of AI Usage
Ai just edited the files for me, I was the one asked it do the changes
in the workflows
<!--
Please disclose how AI was used to help create this PR. For example, you
can share prompts,
specific tools, or ways of working that you took advantage of. You can
also share whether the
creation of the PR was mainly driven by AI, or whether it was used for
assistance.
This is a good way of sharing knowledge to other contributors about how
we can work more efficiently with
AI tools. Note that the use of AI is encouraged, but the committer is
still fully responsible for understanding
and reviewing the output.
-->
Closes#4311
Few small tweaks in SDKs:
1. Export `ConnectionSync` type from Python SDK
2. Remove dependency on `conn_raw_api` and corresponding methods from
rust bindings - no one use them so let's drop support for this feature
completely
3. Add Waker dependency in the sdk-kit in order to integrate it later to
rust bindings
4. Add io_uring feature to the sdk-kit
Closes#4284
## Description
BTreeCursor sets null flag to false once `seek` is called. This PR does
the same for MVCC
## Motivation and context
join.test failed with some cases due to this bug
## Description of AI Usage
I asked AI to find the issue but I ended showing the agent why he did
things wrong and that he should be ashamed
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#4296
`resume` was not re-entrant and panicked in case when was called after
operation completion.
```
thread '<unnamed>' panicked at sync/sdk-kit/src/turso_async_operation.rs:59:20:
`async fn` resumed after completion
...
```
This PR makes `resume` method for `PyTursoAsyncOperation` re-entrant
(like in the c-api) and also convert exception type in the sync module
Closes#4315
## Description
This PR adds missing affinity conversion to hash joins by applying
affinity conversion to build and probe keys before hashing.
```
turso> CREATE TABLE x(a INTEGER);
turso> CREATE TABLE y(b TEXT);
turso> INSERT INTO x VALUES (2),(3);
turso> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
turso> SELECT a, b
FROM x JOIN y ON a = b
ORDER BY a, b;
┌───┬─────┐
│ a │ b │
├───┼─────┤
│ 2 │ 02 │
├───┼─────┤
│ 2 │ 2 │
├───┼─────┤
│ 2 │ 2.0 │
└───┴─────┘
```
## Motivation and context
Fixes#3482.
Currently, Turso returns an empty result set:
```
turso> CREATE TABLE x(a INTEGER);
turso> CREATE TABLE y(b TEXT);
turso> INSERT INTO x VALUES (2),(3);
turso> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
turso> SELECT a, b
FROM x JOIN y ON a = b
ORDER BY a, b;
turso>
```
Expected behavior:
```
sqlite> CREATE TABLE x(a INTEGER);
sqlite> CREATE TABLE y(b TEXT);
sqlite> INSERT INTO x VALUES (2),(3);
sqlite> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
sqlite> SELECT a, b
...> FROM x JOIN y ON a = b
...> ORDER BY a, b;
2|02
2|2
2|2.0
```
## Description of AI Usage
This PR was developed with assistance from Claude Sonnet 4.5 through
code completions.
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#4317