[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32234: [PATCH 2/2] database: Serialize all database accesses in a th
From: |
Clément Lassieur |
Subject: |
bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread. |
Date: |
Sun, 26 Aug 2018 16:07:12 +0200 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Hi Ludovic,
Ludovic Courtès <address@hidden> writes:
> Excellent, thanks for working on this! This looks great to me, and I
> think the pros outweigh the cons. Did you check on a big database how
> well it performs?
Yes, I didn't see any difference. When I use Berlin's database, it
works well but crashes quickly for another reason (lack of disk space I
think, and /tmp being tmpfs).
> One comment:
>
>> -(define* (handle-build-event db event)
>> +(define* (handle-build-event event)
>> "Handle EVENT, a build event sexp as produced by
>> 'build-event-output-port',
>> -updating DB accordingly."
>> +updating the database accordingly."
>
> [...]
>
>> +(define %db-channel
>> + (make-parameter #f))
>> +
>> +(define-syntax-rule (with-db-critical-section db exp ...)
>> + "Evaluate EXP... in the critical section corresponding to %DB-CHANNEL.
>> +DB is bound to the argument of that critical section: the database
>> +connection."
>> + (call-with-critical-section (%db-channel)
>> + (lambda (db) exp ...)))
>> +
>
> I think I find it nicer to keep the ‘db’ parameter everywhere (except
> that it’s now a channel instead of an actual database) rather than using
> this global variable.
>
> WDYT?
That 'db' parameter made sense before, because there were different
database connections: one per fiber. But now that there is only one
global channel accessible from everywhere, I can't find any use for a
'db-channel' parameter.
Also, using two differents channels for the same database would be a
bug, it would break the serialization mechanism.
And I don't think using several databases (with one channel per
database) would make sense either.
WDYT?
- bug#32234: [PATCH 1/2] utils: Avoid deadlock when WITH-CRITICAL-SECTION calls are nested., Clément Lassieur, 2018/08/06
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Clément Lassieur, 2018/08/06
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Clément Lassieur, 2018/08/06
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Ludovic Courtès, 2018/08/19
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Danny Milosavljevic, 2018/08/27
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Clément Lassieur, 2018/08/27
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Danny Milosavljevic, 2018/08/27
- bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread., Clément Lassieur, 2018/08/27