Thanks Rowan, this is useful.

Is it normal to get a `SQLITE_BUSY_RECOVERY` response from an API when:
- No processes have crashed.
- All API uses close/finalize their db/stmt objects.

I am testing some code I wrote to make sure it retires on BUSY by creating
many processes that acquire locks with `BEGIN IMMEDIATE`.

`SQLITE_BUSY_RECOVERY` occurs at around 7 processes requesting a write
lock, but not at 5 processes or below.

Does this indicate corrupted data?







On Mon, Sep 2, 2019 at 2:45 AM Rowan Worth <row...@dug.com> wrote:

> On Fri, 30 Aug 2019 at 04:18, test user <example.com.use...@gmail.com>
> wrote:
>
> > B. Is there any method for determining lock transitions for connections?
> >     - Is there an API?
> >     - Would it be possible to use dtrace to instrument SQLite to detect
> > lock transitions?
> >         - Where should I be looking?
> >
>
>  On unix sqlite uses fcntl() with cmd=F_SETLK on specific byte locations to
> acquire locks -- I'm not familiar with dtrace, but I've used strace + sed
> to watch sqlite lock activity before. eg:
>
> #!/bin/sh
>
> PID=$1
>
> replace() {
>      echo "s#F_SETLK, {type=F_$1, whence=SEEK_SET, start=$2, len=$3}#$4#"
> }
>
> strace -Ttt -ff -e trace=fcntl -p $PID 2>&1 |
> sed \
>     -e "$(replace RDLCK 1073741824 1 acquireR{PENDING})" \
>     -e "$(replace RDLCK 1073741825 1 acquireR{RESERVED})" \
>     -e "$(replace RDLCK 1073741826 510 acquire{SHARED})" \
>     -e "$(replace WRLCK 1073741824 1 acquireW{PENDING})" \
>     -e "$(replace WRLCK 1073741825 1 acquireW{RESERVED})" \
>     -e "$(replace WRLCK 1073741826 510 acquire{EXCLUSIVE})" \
>     -e "$(replace UNLCK 1073741824 2 release{PENDING+RESERVED})" \
>     -e "$(replace UNLCK 1073741824 1 release{PENDING})" \
>     -e "$(replace UNLCK 1073741825 1 release{RESERVED})" \
>     -e "$(replace UNLCK 1073741826 510 release{SHARED/EXCLUSIVE})" \
>     -e "$(replace UNLCK 0 0 release{ALL})"
>
> -Rowan
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to