-
Notifications
You must be signed in to change notification settings - Fork 75
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
Migration PostgreSQL to MariaDB: Issues with DirectBlob feature #1149
Comments
This is fairly confusing. The type LONGBLOB in scripts/database/otobo-schema.xml is translated into
My hunch is that the second case needs to be handled differently than the other cases. This is all related to the funny behavior of Kernel::System::DB::FetchrowArray that sets the UTF8-flag on whatever data it gets. Does not make much sense on numeric data and is simply wrong when the string data is not UTF-8. The latter case is rectified in the relevant modules, but still confusing. |
New findings:
This list was later removed. I gather that such a list, containing all cases relevante for DirectBlob, is still necessary. For lack of a better idea let's pult the list into |
that are relevant to the DirectBlob feature.
Only specific columns are relevant for DirectBlob.
The trick for avoiding dropping and recreating the sequence was not obvious.
Issue #1149 db direct blob columns
During testing I found out that |
Another issue. When migrating from OTRS(Pg) to OTOBO(MySQL) I see many of the following message in the logfile:
This is likely nothing to worry about, as the migrated database seems to work fine. But let's investigate. The line in question is:
Dumping the infos about
This makes sense. The source is PostgreSQL with the datatype 'character varying' and the target is MySQL with the data type 'mediumtext'. The length on the MySQL side checks out. A mediumtext holds 16777215 bytes, about 16MB. But why is there no length on the PostgreSQL side? The declaration of Checking the functions MySQL:
PostgreSQL:
This means that we have an interesting mix. There are length differences that happen basically by accident, because of differences in data types. On the other hand, there are columns that actually should be shortened. I tend to take the most simple approach. Treat an undefined length as infinite. Another question is how this plays with encodings. The LENGTH appears to be in bytes but the shortening is done by calling SUBSTRING(). How can this possibly work? |
After merging #1160 I did a test migration from OTRS (Pg) to OTOBO (MySQL). The source database was:
Some notes on the relevant datatypes. In PostgreSQL the data type text is used. The size is practically unlimited, multi-byte characters, in our case UTF-8. In MySQL we have the data type longblob. The size is practically unlimited, binary. Here are the findings from looking at source and target database. The tests should cover the relevant cases.
The output of the SQL statements used for testing is attached. ( With an incorrect year in the filename.) |
TODO:
|
Yet another finding: The user otobo cannot set the session_replication_role. She needs superuser privs for that. See https://otobo.de/de/forums/topic/otrs-6-mysql-migration-to-otobo-postgresql/. |
After giving the otobo user superadmin privileges, the migration from OTRS (pg) to OTOBO (Pg) executed find. Did the same checks as for the previous testmigration. The result look fine. See the attached file for the results of the SQL statements used for testing. |
Issue #1149: a bit of code tidying.
OTOBO => OTOBO 10.
The DB user otobo might need superuser privs.
…_superadmin Issue RotherOSS/otobo#1149 with superadmin
The tests from last week looked fine. Closing this issue. |
Hi,
In the file Kernel/System/MigrateFromOTRS/CloneDB/Driver/postgresql.pm we check the binary blob. For PostgreSQL TEXT is specified here. I just migrated a system and there was text no binary? According to my research this is also the normal case. After I then took out the function, the data was fine after the migration.
When you look at this, can you please add another check that checks if there are values with NULL and in OTOBO this is not allowed? This has happened to me several times now with PostgreSQL and it is tedious when then the migration stops completely.
Thanks a lot!
Stefan
Get all binary columns and return a lookup hash with table and column name as keys.
sub BlobColumnsList {
my ( $Self, %Param ) = @_;
SELECT COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = ?
AND TABLE_NAME = ?
AND DATA_TYPE = 'Text';
END_SQL
Bind => [ $Param{DBName}, $Param{Table} ],
) || return {};
}
The text was updated successfully, but these errors were encountered: