SQLite broken in git

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

SQLite broken in git

Marcel Wiesweg
Hi,

for me, database config is now broken in git.
Note how filenames are not properly added to the paths:

digikam(1472)/digikam (core) Digikam::AlbumManager::setDatabase:
DatabaseParameters: [ Type "QSQLITE", Name "/media/fotos/" tmb.Type "QSQLITE",
tmb.Name "/media/fotos/" ]

I suspect commit 37f5f5d59f174bcedc86438365f9a7270a1bd677 which introduced
changes in databaseparameters

Config settings seem unchanged:
[Database Settings]
Database Connectoptions=
Database Hostname=
Database Name=/media/fotos/
Database Name Thumbnails=/media/fotos/
Database Password=
Database Port=-1
Database Type=QSQLITE
Database Username=
Internal Database Server=false
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/06/11 23:08, Marcel Wiesweg wrote:

> Hi,
>
> for me, database config is now broken in git.
> Note how filenames are not properly added to the paths:
>
> digikam(1472)/digikam (core) Digikam::AlbumManager::setDatabase:
> DatabaseParameters: [ Type "QSQLITE", Name "/media/fotos/" tmb.Type "QSQLITE",
> tmb.Name "/media/fotos/" ]
>
> I suspect commit 37f5f5d59f174bcedc86438365f9a7270a1bd677 which introduced
> changes in databaseparameters
>
> Config settings seem unchanged:

this is strange, it should have been converted to something like

[Database Settings]
Images Connectoptions=
Images Hostname=
Images Name=digikam19
Images Password=digikam
Images Port=0
Images Type=QMYSQL
Images Username=digikam
Internal Database Server=false
Thumbnails Connectoptions=
Thumbnails Hostname=
Thumbnails Name=digikam19t
Thumbnails Password=digikam
Thumbnails Port=0
Thumbnails Type=QMYSQL
Thumbnails Username=digikam


> [Database Settings]
> Database Connectoptions=
> Database Hostname=
> Database Name=/media/fotos/
> Database Name Thumbnails=/media/fotos/
> Database Password=
> Database Port=-1
> Database Type=QSQLITE
> Database Username=
> Internal Database Server=false
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
       
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/07/11 00:03, Francesco Riosa wrote:
> On 09/06/11 23:08, Marcel Wiesweg wrote:
>> Hi,
>>
>> for me, database config is now broken in git.
>> Note how filenames are not properly added to the paths:

ok, copyed your settings and reproduced it a few times, seem similar to
a race-condition. But it happen when digikam run as a single thread

The first run settings are read from "legacy" and written synced to the
file, but database cannot open

the second time DK read the settings from the file and all is fine

Problem is I cannot understand why it has empty parameters and so asking
for help (still newbye in c++ evidently)

Using qtcreator I've set a breakpoint

databaseparameters.cpp:429
kDebug(50003) << "Trying to read legacy configuration";

DK first time reach that from main,
main.cpp:169
params.legacyAndDefaultChecks(firstAlbumPath);

when I do step into legacyAndDefaultChecks it's executed correctly,
filling the DatabaseParameters object params, then main() call
params.writeToConfig(config);
and also this one is correctly done

but

main.cpp:185
// initialize database
AlbumManager::instance()->setDatabase(params,
!commandLineDBPath.isNull(), firstAlbumPath);

don't work;

I'm using some scoped variable that it's emptyed in the meantime? What
I'm doing wrong?

P.S.
added a bunch of kdebug with
http://commits.kde.org/digikam/a3e9218bb02a1fb23728eaf6a9f7d56a70fe27fa


>>
>> digikam(1472)/digikam (core) Digikam::AlbumManager::setDatabase:
>> DatabaseParameters: [ Type "QSQLITE", Name "/media/fotos/" tmb.Type
>> "QSQLITE",
>> tmb.Name "/media/fotos/" ]
>>
>> I suspect commit 37f5f5d59f174bcedc86438365f9a7270a1bd677 which
>> introduced
>> changes in databaseparameters
>>
>> Config settings seem unchanged:
>> [Database Settings]
>> Database Connectoptions=
>> Database Hostname=
>> Database Name=/media/fotos/
>> Database Name Thumbnails=/media/fotos/
>> Database Password=
>> Database Port=-1
>> Database Type=QSQLITE
>> Database Username=
>> Internal Database Server=false

should become

[Database Settings]
Database Connectoptions=
Database Hostname=
Database Name=/media/fotos/
Database Name Thumbnails=/media/fotos/
Database Password=
Database Port=-1
Database Type=QSQLITE
Database Username=
Images Connectoptions=
Images Hostname=
Images Name=/media/fotos/
Images Password=
Images Port=-1
Images Type=QSQLITE
Images Username=
Internal Database Server=false
Thumbnails Connectoptions=
Thumbnails Hostname=
Thumbnails Name=/media/fotos/
Thumbnails Password=
Thumbnails Port=-1
Thumbnails Type=QSQLITE
Thumbnails Username=

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Marcel Wiesweg
In reply to this post by Francesco Riosa

>
> this is strange, it should have been converted to something like
>
> [Database Settings]
> Images Connectoptions=
> Images Hostname=
> Images Name=digikam19
> Images Password=digikam
> Images Port=0
> Images Type=QMYSQL

No I am using SQlite! No conversion in the config file please ;-)
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Gilles Caulier-4
I confirm the problem here :

[gilles@localhost build (master)]$ digikam
libdc1394 error: Failed to initialize libdc1394
digikam(9094)/digikam (core)
Digikam::DatabaseParameters::legacyAndDefaultChecks: Trying to read
legacy configuration
digikam(9094)/digikam (core)
Digikam::DatabaseParameters::legacyAndDefaultChecks: Database Type
Found.
digikam(9094)/digikam (core) Digikam::AlbumManager::setDatabase:
DatabaseParameters: [ Type "QSQLITE", Name "/mnt/data/Database/"
tmb.Type "QSQLITE", tmb.Name "/mnt/data/Database/" ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
digikam(9094)/digikam (core): Error while opening the database. Error
details [ QSqlError(-1, "Error opening database", "unable to open
database file") ]
QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is
still in use, all queries will cease to work.
QSqlDatabase:  driver not loaded
QSqlDatabase: available drivers: QSQLITE QSQLITE3 QMYSQL3 QMYSQL
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: Error while opening the
database. Error was < QSqlError(-1, "Driver not loaded", "Driver not
loaded") >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgDatabaseType
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgDatabaseName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: connectOptions
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgHostName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgPort
< -1 >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgUserName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgPassword
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::databaseForThread: Error while
opening the database. Details: [ QSqlError(-1, "Driver not loaded",
"Driver not loaded") ]
digikam(9094)/digikam (core) Digikam::DatabaseCoreBackend::open: Error
while opening the database. Trying again.
QSqlDatabase:  driver not loaded
QSqlDatabase: available drivers: QSQLITE QSQLITE3 QMYSQL3 QMYSQL
QSqlDatabasePrivate::removeDatabase: connection
'digikamDatabase-140126408' is still in use, all queries will cease to
work.
QSqlDatabasePrivate::addDatabase: duplicate connection name
'digikamDatabase-140126408', old connection removed.
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: Error while opening the
database. Error was < QSqlError(-1, "Driver not loaded", "Driver not
loaded") >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgDatabaseType
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgDatabaseName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: connectOptions
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgHostName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgPort
< -1 >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgUserName
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::open: parameters.imgPassword
< "" >
digikam(9094)/digikam (core)
Digikam::DatabaseCoreBackendPrivate::databaseForThread: Error while
opening the database. Details: [ QSqlError(-1, "Driver not loaded",
"Driver not loaded") ]
QSqlQuery::prepare: database not open

Gilles Caulier

2011/9/7 Marcel Wiesweg <[hidden email]>:

>
>>
>> this is strange, it should have been converted to something like
>>
>> [Database Settings]
>> Images Connectoptions=
>> Images Hostname=
>> Images Name=digikam19
>> Images Password=digikam
>> Images Port=0
>> Images Type=QMYSQL
>
> No I am using SQlite! No conversion in the config file please ;-)
> --
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
In reply to this post by Marcel Wiesweg
On 09/07/11 08:23, Marcel Wiesweg wrote:

>
>>
>> this is strange, it should have been converted to something like
>>
>> [Database Settings]
>> Images Connectoptions=
>> Images Hostname=
>> Images Name=digikam19
>> Images Password=digikam
>> Images Port=0
>> Images Type=QMYSQL
>
> No I am using SQlite! No conversion in the config file please ;-)

Hem, then I need to change the logic, at this moment it's teorically
possible to have separate engines for images and thumbnails, for example
a centralized mysql database for images and a local sqlite database for
thumbnails.

If avoiding conversion is paramount then we should revert, discuss the
wanted logic and then I can adapt it, so what re your suggestions?

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Marcel Wiesweg

> Hem, then I need to change the logic, at this moment it's teorically
> possible to have separate engines for images and thumbnails, for example
> a centralized mysql database for images and a local sqlite database for
> thumbnails.

I understand, that makes sense

>
> If avoiding conversion is paramount then we should revert, discuss the
> wanted logic and then I can adapt it, so what re your suggestions?

I guess it's probably one bug: With SQLite, we store the path but not the filename, because the filename is constant. There has always been code which adds the filename if only a directory is specified. I believe this must be broken at some place (but I'm at work currently, cannot have a look at the code)

Marcel
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/07/11 12:46, Marcel Wiesweg wrote:

>
>> Hem, then I need to change the logic, at this moment it's teorically
>> possible to have separate engines for images and thumbnails, for example
>> a centralized mysql database for images and a local sqlite database for
>> thumbnails.
>
> I understand, that makes sense
>
>>
>> If avoiding conversion is paramount then we should revert, discuss the
>> wanted logic and then I can adapt it, so what re your suggestions?
>
> I guess it's probably one bug: With SQLite, we store the path but not the filename, because the filename is constant. There has always been code which adds the filename if only a directory is specified. I believe this must be broken at some place (but I'm at work currently, cannot have a look at the code)

It's more probably something I've introduced dumping all the changes
from the sql/2.0 branch and re-applying to master.

But now I'm switching to "daughter" mono tasking, will be on this after
22:00 CET

- Francesco

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
In reply to this post by Marcel Wiesweg
On 09/07/11 12:46, Marcel Wiesweg wrote:

>
>> Hem, then I need to change the logic, at this moment it's teorically
>> possible to have separate engines for images and thumbnails, for example
>> a centralized mysql database for images and a local sqlite database for
>> thumbnails.
>
> I understand, that makes sense
>
>>
>> If avoiding conversion is paramount then we should revert, discuss the
>> wanted logic and then I can adapt it, so what re your suggestions?
>
> I guess it's probably one bug: With SQLite, we store the path but not the filename, because the filename is constant. There has always been code which adds the filename if only a directory is specified. I believe this must be broken at some place (but I'm at work currently, cannot have a look at the code)
>

It's confirmed by the fact that adding the file name to the config file
make digikam start without issues

[Database Settings]
Database Connectoptions=
Database Hostname=
Database Name=/media/fotos/digikam4.db
Database Name Thumbnails=/media/fotos/thumbnails-digikam.db
Database Password=
Database Port=-1
Database Type=QSQLITE
Database Username=

Also, while initializing configs and databases there are multiple
threads running.

there is a problem, adding the file names in
DatabaseParameters::legacyAndDefaultChecks does NOT work, I'm unable to
understand why ATM

While I've introduced the bug, the fact databases are checked while they
are accessed don't look a good thing is it possible to put config
reading and database check/initialization in a single thread? Would it
have a startup time penalty?

BTW what was the rationale behind storing the directory and not a plain
file path/name? there where already two names one for images the other
for thumbnails.
Could be possible to convert to use only file names? The logic for
migration would be:
is it a SQLITE database?
   the path point to a directory?
     yes, add the canonical file name and be done with it
     no, it's already a full path

I'm using qtcreator to follow the code while it's executed, and I'm
unable to get to the point, do you know something better?
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/08/11 03:56, Francesco Riosa wrote:

> On 09/07/11 12:46, Marcel Wiesweg wrote:
>>
>>> Hem, then I need to change the logic, at this moment it's teorically
>>> possible to have separate engines for images and thumbnails, for example
>>> a centralized mysql database for images and a local sqlite database for
>>> thumbnails.
>>
>> I understand, that makes sense
>>
>>>
>>> If avoiding conversion is paramount then we should revert, discuss the
>>> wanted logic and then I can adapt it, so what re your suggestions?
>>
>> I guess it's probably one bug: With SQLite, we store the path but not
>> the filename, because the filename is constant. There has always been
>> code which adds the filename if only a directory is specified. I
>> believe this must be broken at some place (but I'm at work currently,
>> cannot have a look at the code)
>>
>
> It's confirmed by the fact that adding the file name to the config file
> make digikam start without issues
>
> [Database Settings]
> Database Connectoptions=
> Database Hostname=
> Database Name=/media/fotos/digikam4.db
> Database Name Thumbnails=/media/fotos/thumbnails-digikam.db
> Database Password=
> Database Port=-1
> Database Type=QSQLITE
> Database Username=
>
> Also, while initializing configs and databases there are multiple
> threads running.


> there is a problem, adding the file names in
> DatabaseParameters::legacyAndDefaultChecks does NOT work, I'm unable to
> understand why ATM

This is false, indeed commit
http://commits.kde.org/digikam/18075f4d6f7779fc867b263e261e4f5857e1012c
does exactly this and solve the problem.

FYI I was running digikam from inside qtcreator but it obviously use
builded, opposedly to installed digikam runtime, but I'was modifing
libraries sources which are not loaded from build directory w/o setting
approbriate variables (yesterday it was late night :P).

>
> While I've introduced the bug, the fact databases are checked while they
> are accessed don't look a good thing is it possible to put config
> reading and database check/initialization in a single thread? Would it
> have a startup time penalty?

it was late, but this be true, I'll look in it deeper in the future

> BTW what was the rationale behind storing the directory and not a plain
> file path/name? there where already two names one for images the other
> for thumbnails.
> Could be possible to convert to use only file names? The logic for
> migration would be:
> is it a SQLITE database?
> the path point to a directory?
> yes, add the canonical file name and be done with it
> no, it's already a full path
>
> I'm using qtcreator to follow the code while it's executed, and I'm
> unable to get to the point, do you know something better?

please, accept my apologies for the pushed bugs

- Francesco

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Marcel Wiesweg
In reply to this post by Francesco Riosa

> BTW what was the rationale behind storing the directory and not a plain
> file path/name? there where already two names one for images the other
> for thumbnails.
> Could be possible to convert to use only file names? The logic for
> migration would be:
> is it a SQLITE database?
>    the path point to a directory?
>      yes, add the canonical file name and be done with it
>      no, it's already a full path

This would break backwards compatibility (cannot use stable version when
trying new etc.) which we tried to avoid. We did a config upgrade with the
large database update, but not since then.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/09/11 19:05, Marcel Wiesweg wrote:

>
>> BTW what was the rationale behind storing the directory and not a plain
>> file path/name? there where already two names one for images the other
>> for thumbnails.
>> Could be possible to convert to use only file names? The logic for
>> migration would be:
>> is it a SQLITE database?
>>     the path point to a directory?
>>       yes, add the canonical file name and be done with it
>>       no, it's already a full path
>
> This would break backwards compatibility (cannot use stable version when
> trying new etc.) which we tried to avoid. We did a config upgrade with the
> large database update, but not since then.

what about now store the file path/name for the possibility in a far
future to remove it? No hurry, just opening a possibility.

The config setting are already changing (and I've avoided to remove old
ones on purpose after reading comments in the source code)


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: SQLite broken in git

Francesco Riosa
On 09/09/11 19:15, Francesco Riosa wrote:

> On 09/09/11 19:05, Marcel Wiesweg wrote:
>>
>>> BTW what was the rationale behind storing the directory and not a plain
>>> file path/name? there where already two names one for images the other
>>> for thumbnails.
>>> Could be possible to convert to use only file names? The logic for
>>> migration would be:
>>> is it a SQLITE database?
>>> the path point to a directory?
>>> yes, add the canonical file name and be done with it
>>> no, it's already a full path
>>
>> This would break backwards compatibility (cannot use stable version when
>> trying new etc.) which we tried to avoid. We did a config upgrade with
>> the
>> large database update, but not since then.


> what about now store the file path/name for the possibility in a far
> future to remove it? No hurry, just opening a possibility.

forget about this, pandora box has already been opened.

> The config setting are already changing (and I've avoided to remove old
> ones on purpose after reading comments in the source code)
>
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel