Skip to content
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

Exception on using BulkInsertQuery with a read-only & read/write database configuration #114

Open
twaurisch opened this issue Nov 4, 2024 · 0 comments

Comments

@twaurisch
Copy link

We receive an exception while using EXT:mysqlreport with a splitted database configuration. In our TYPO3 instance we have two database hosts configured. One is read-only which is the default for the frontend nodes.

For the table 'tx_mysqlreport_domain_model_profile' an exception is configured. For this table the read/write host should be used, but it seems to be ignored.

Default = read-only
Backend = read/write

$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Backend'] = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'];
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] = $readOnlyDbHost;

// create a white-list for the 'write' tables => 'Backend'
$GLOBALS['TYPO3_CONF_VARS']['DB']['TableMapping'] = [
    // EXT: mysqlreport
    'tx_mysqlreport_domain_model_profile' => 'Backend',
    ...
];

Exception while making a frontend request

Fatal error:  Uncaught mysqli_sql_exception: The MariaDB server is running with the --read-only option so it cannot execute this statement in /var/www/a/cs-content/vendor/doctrine/dbal/src/Driver/Mysqli/Statement.php:153
Stack trace:
#0 /var/www/a/cs-content/vendor/doctrine/dbal/src/Driver/Mysqli/Statement.php(153): mysqli_stmt->execute()
#1 /var/www/a/cs-content/vendor/doctrine/dbal/src/Connection.php(1207): Doctrine\DBAL\Driver\Mysqli\Statement->execute()
#2 /var/www/a/cs-content/vendor/typo3/cms-core/Classes/Database/Query/BulkInsertQuery.php(187): Doctrine\DBAL\Connection->executeStatement()
#3 /var/www/a/cs-content/vendor/typo3/cms-core/Classes/Database/Connection.php(229): TYPO3\CMS\Core\Database\Query\BulkInsertQuery->execute()
#4 /var/www/a/cs-content/vendor/stefanfroemken/mysqlreport/Classes/Helper/ConnectionHelper.php(80): TYPO3\CMS\Core\Database\Connection->bulkInsert()
#5 /var/www/a/cs-content/vendor/stefanfroemken/mysqlreport/Classes/EventListener/RegisterDatabaseLoggerEventListener.php(111): StefanFroemken\Mysqlreport\Helper\ConnectionHelper->bulkInsert()
#6 [internal function]: StefanFroemken\Mysqlreport\EventListener\RegisterDatabaseLoggerEventListener->__destruct()
#7 {main}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant