-
Notifications
You must be signed in to change notification settings - Fork 2.1k
OC7: Problems converting from SQLite3 to PostgresQL #9891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@PVince81 Possible inconsistency in schemas across DBMSes. @DeepDiver1975 might be able to help. |
I've hit that problem too. Seems like sqlite is somehow (perhaps due to migrations?) not checking the length of varchar fields:
I've fixed this by changing the database.xml for
|
I've got the same problem too with the bookmarks.
I fixed this by editing the sqlite database before the conversion. I only had 1 bookmark that was a problem. |
Same for errors on oc_jobs and oc_activities, the fix was expand the character fields from 255 to 1024 in either db_structure.xml or appinfo/database.xml depending on the table. Looks like the desired field lengths are overflowing the definition in the database.xml files, which SQLite doesn't enforce a length limit on varchar fields. As per SQLite documentation, "Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings" (http://www.sqlite.org/datatype3.html) |
I have the same issue, but I had PostgresQL before, just tried to upgrade from 6.0.x to 7.0.2... Does anyone of the developers test migrations before the final release of a new owncloud- version using other DBMS dann sqllite/mysql? |
Same issue.
If someone has an understanding key to help me decrypting this error message it'll be appreciated. It's my first use of PostgreSQL Coming back to the initial issue. All of these brings me some wonderings.
Second : any side effect for future OC updates/upgrade ?? |
Well, didn't find how to get rid of my previous error messsage (index limitation). May be was it due to a pgsql process parameter I prefer not to tune.
Got another migration error with oc_bookmarks
Migration process went till the end Finally Everything's running for now. Your comments are welcome concerning the choice of TEXT vs CLOB |
Thanks for all the feedback. That prompted me to try again and it actually helped me do the migration in the end even if there was quite a bit of manual editing of database.xml was required. Hopefully not with any downsides with future upgrades. |
The database does uses file ids for shares and in the future "favorites". If the conversion code isn't able to keep file ids then this is a major bug! @bantu can you comment on this ? |
well - because we use autoincrement/sequences this will be really interesting to solve - we did not think about this .... tooo bad |
@bantu please have a look at this as soon as time permits - THX |
scheduling for 8.0 for at least analysis - let's see if we can come up with a solution ..... |
From reading the code (https://github.com/owncloud/core/blob/master/core/command/db/converttype.php#L242), all data is copied including autoincrement / sequence values. For PostgreSQL we additionally resynchronise sequences to their expected value (https://github.com/owncloud/core/blob/master/core/command/db/converttype.php#L271 https://github.com/owncloud/core/blob/master/lib/private/db/pgsqltools.php#L50) |
moving to 8.1 - time is up for 8.0 |
@DeepDiver1975 Not sure what to do with this further. Based on #9891 (comment) I don't think an accidental change of primary key columns as suggested by #9891 (comment) is possible. In my opinion, the root cause of most migration issues is insufficient validation of input data (in the first place). E.g., if you're writing into a varchar 100 column, validate that the data actually is 100 characters or less before attempting to write into the DB. (There has to be a proper error message saying that the data is too long anyway; instead of a SQL error or another generic message.) The above combined with the fact that SQLite accepts arbitrary length data (as per #9891 (comment)) leads migrations to fail with "data too long" errors. Since the data is already in the database, users will have to cleanup their DBs before migration manually in any case. |
On second thought:
|
On the other hand, my sqlite does not seem to reproduce.
|
@karlitschek @cmonteroluque this is the famous 3byte vs 4byte mysql char set issue - not really a solution at hand - suggest to move this to the backlog |
Yes unfortunately. This needs a lot more thinking later. |
Nod. |
The column in the new dav app is clob, so should be fine? |
yes - woth exception of the mysql utf8 issue - but this a total different topic. For all the other issues I don't see much we can do -> closing |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
(Move here from http://forum.owncloud.org/viewtopic.php?f=29&t=22446)
I've just upgraded to OwnCloud 7 and the upgrade went well. It's currently running on SQLite and I would like to migrate to PostgresQL since I've run into concurrency problems due to the usage of multiple devices.
Steps to reproduce
So, after finding #9526 I adjusted the call to the following:
sudo php occ db:convert-type --password="wonttell" --all-apps pgsql owncloud localhost owncloud
Expected behaviour
Well, just a regular migration from SQLite to PostgresQL.
Actual behaviour
The first issue was:
I've replaced some content with [..] above to obfuscate the actual data. Anyway, the Postgres database is set up as described in the manual. It says "UTF-8" as encoding, but I suspect this is coming from the reading side somehow.
I read somewhere that it is possible to reset the file cache, so I ran "sqlite3 owncloud.db" and "DELETE FROM oc_filecache;" and that actually brought me past this first issue.
But then I ran into the following:
"value" is quite big, surely more than 255 characters. Given that the parameter is called "PHOTO" I assume a base64-encoded JPEG image associated with a contact. But on the PostgresQL table created the column "value" is just "value character varying(255) DEFAULT NULL::character varying" which explains the problem. Should this maybe be a "text" or blob?
Server configuration
Operating system: Linux 3.10.25+ armv6l (RaspberryPi)
Web server: Apache HTTPD 2.2.22
Database: SQLite3 3.7.13, PostgresQL 9.1.13
PHP version: 5.4.4-14+deb7u12
ownCloud version: 7.0.0
Updated from an older ownCloud or fresh install: Updated from latest OC 6.x
List of activated apps: Standard apps + Mozilla Sync
The content of config/config.php:
Are you using external storage, if yes which one: local (external USB drive)
Are you using encryption: yes
Client configuration
n/a here
Logs
Web server error log
n/a here
ownCloud log (data/owncloud.log)
I've got quite a few of these in the logs even before the upgrade to OC7 which could be relevant:
Otherwise, I don't see anything in the logs that could be applicable to this problem.
Browser log
n/a here
The text was updated successfully, but these errors were encountered: