Comments (11)
Yes, unfortunately. 😢 The end result is the parameters get swapped so it likely dropped the source database.
Fortunately, recovery should be a simple matter of restoring from backup (just the db portion): https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html#restore-database (or whatever other mechanism you utilize in your environment for database backup/recovery)
from server.
@Delagen Mind pushing that as PR? I know there may be additional changes needed, but it'll start things in motion.
from server.
@joshtrichards I don't mind that my changes solve the problem correctly. It only makes possible for me successful conversion from MySQL to Postgres
from server.
Would not be it the simplest solution, if the ConnectionFactory::getConnection() method would first check if the $additionalConnectionParams
argument contains explicit connection parameters and in that case simply skip that fancy primary / replica stuff? At least for the case were the explicitly specified connection differs from the "internal" database connection configured in config/config.php
. In principle this should restore the previous behaviour when using the factory for alternate database connections.
from server.
Logging the Parameter $additionalConnectionParams
in ConnectionFactory.php
on Line 166 shows the following values for the "fromDB" and the "toDB":
FromDB
Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud
[password] => *************
[host] => nextcloud-db
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
[primary] => Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud
[password] => ****************
[host] => nextcloud-db
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
)
[replica] => Array
(
[0] => Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud
[password] => *************
[host] => nextcloud-db
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
)
)
)
ToDB
Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud_app
[password] => ***************
[host] => postgres
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
[primary] => Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud
[password] => *************
[host] => nextcloud-db
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
)
[replica] => Array
(
[0] => Array
(
[adapter] => OC\DB\AdapterMySQL
[charset] => utf8mb4
[driver] => pdo_mysql
[wrapperClass] => OC\DB\Connection
[driverOptions] => Array
(
[1005] => 1
)
[user] => nextcloud
[password] => **********
[host] => nextcloud-db
[dbname] => nextcloud
[tablePrefix] => oc_
[sqlite.journal_mode] => WAL
[defaultTableOptions] => Array
(
[collate] => utf8mb4_bin
[charset] => utf8mb4
[tablePrefix] => oc_
)
)
)
[port] => 5432
)
It is notable that in the second case (which should be the postgres-database configured via the CLI arguments), the host, dbname and port in the top-level array are set correctly from the CLI, Both the primary
and the replica
fields and even some top-level fields obviously use the DB-configs from config.php
from server.
Possibly related: #45097
I don't have time to look tonight, but your analysis seems sound (and, given the added evidence from the log output, even more so).
Cc: @juliushaertl
from server.
I can verify but can't contribute logs. I used the --clear-schema option in my attempt and my original MariaDB DB got deleted. Good thing I have backups.
from server.
I modified https://github.com/nextcloud/server/blob/master/core/Command/Db/ConvertType.php#L247
to
$connectionParams = $this->connectionFactory->getDefaultConnectionParams($type);
and seems all converted
Also have to remove mysql.utf8mb4 parameter from config.php to perform conversion to remove client_encoding from params of DbFactory
from server.
Got hit by this a week ago. Is that particular Nextcloud instance completely screwed?
from server.
I have just experienced this problem on a new installation.
from server.
Hi, is this #45013 fixing the problem?
from server.
Related Issues (20)
- [Bug]: When i try to process an event i get error Parse error: Invalid Mimedir file HOT 2
- Column is type Bool and also NotNull, so it can not store "false" HOT 2
- [RFC] Files mime icons theming HOT 4
- [Bug]: Stuck at logging in HOT 1
- [Bug]: Can't share folders/files from webui, infinite load
- [Bug]: Share Expire Not Based On Default Time Zone
- Show "Edit locally" also on the folder page
- [Bug]: Extremely slow response to start loading the home page HOT 4
- [Bug]: The "Show Sharing option" and "Open details" buttons do not work HOT 6
- [Bug]: upgrade to 29.0.1 from 28.0.6 failed HOT 3
- [Bug]: Unable to access "ALBAUM" in Nextcloud 29.0.x HOT 7
- Trash/Deleted Files Search
- [Bug]: Adding Rackspace Cloud Files as external storage fails
- [Bug]: update from 28 to 29.0.1 fails due to index conflicts HOT 1
- [Bug]: Active directory accounts get blocked when you fail the login one time HOT 2
- [Bug]: Webdav HOT 6
- [Bug]: Some URI reroutes don't include the subdir (Nextcloud in a subdir) HOT 1
- Dossier as "case-collection"
- [Bug]: Missing /apps/files/img/computer.svg HOT 1
- [Bug]: AppConfigUnknownKeyException unknown config key, Error while generating metadata for fileid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from server.