Log message #4104471

# At Username Text
# Dec 18th 2017, 11:45 hmic *lol*
# Dec 18th 2017, 11:45 makallio85 Yes i have read abóut it, but it is not the possibility here as it would be too much to refactor now.
# Dec 18th 2017, 11:45 makallio85 But how do i set it back to connectionregistry with connectionmanager
# Dec 18th 2017, 11:44 hmic and yes, you can change the tablename in a table object, sure. Table::setTable() does
# Dec 18th 2017, 11:43 hmic you do know that mysql can handle the shards itself, yes you do
# Dec 18th 2017, 11:43 makallio85 My first question was, wouldnt it be reasonable to allow table to be switched in connection object somehow without creating new connection object
# Dec 18th 2017, 11:42 makallio85 and I need to switch table name in that connection
# Dec 18th 2017, 11:42 makallio85 I have 1 connection "shard" in cake
# Dec 18th 2017, 11:42 makallio85 And i have dynamic amount of shards
# Dec 18th 2017, 11:42 makallio85 I have sharded database design
# Dec 18th 2017, 11:41 hmic why you do that again?
# Dec 18th 2017, 11:41 hmic makallio85, yes if you create new connections that is what you end up with
# Dec 18th 2017, 11:35 makallio85 so there is no way to provide connection object to it and that is the reason i end up getting multiplied connection objects when altering table name
# Dec 18th 2017, 11:34 makallio85 Aah, yes. ConnectionManager::setConfig('name', $conf = []) creates always new connection object
# Dec 18th 2017, 11:17 makallio85 Probably it is creating new Connection objects for some reason then
# Dec 18th 2017, 11:16 makallio85 but for some reason many connections are established, when i get connection from ConnectionManager, drop connection from registry, alter table name in connection object and set it back in connection registry.
# Dec 18th 2017, 11:15 makallio85 Yes, thats what i thought about also
# Dec 18th 2017, 11:15 hmic if you use/instantiate tables that use all of them of course, so could be even less
# Dec 18th 2017, 11:14 hmic exactly
# Dec 18th 2017, 11:14 makallio85 If I have 3 connections defined in cake, shouldnt it make 3 connections also to sql server?
# Dec 18th 2017, 11:13 hmic somethings wrong, yes
# Dec 18th 2017, 11:12 makallio85 Something strange then
# Dec 18th 2017, 11:12 makallio85 Well, it seems it does :)
# Dec 18th 2017, 11:12 hmic yes
# Dec 18th 2017, 11:11 makallio85 so if i run single shell, connections should not be multiplied like that?
# Dec 18th 2017, 11:11 hmic but a *single* request/invocation would not do that
# Dec 18th 2017, 11:10 hmic but yes, every *invocation* of a script - every request cycle, initiates (a) new connection(s)
# Dec 18th 2017, 11:10 hmic makallio85: i dont get that
# Dec 18th 2017, 11:09 makallio85 This causes for me over 400 connections made to mysql server, when try just run some simple scripts :)
# Dec 18th 2017, 11:08 makallio85 I run just single php instance and i have 42 database in my setup. 3 connections defined and 40 of those share the same connection name. Connection is switched by dropping existing from ConnectionRegistry and setting it again with different table name.
# Dec 18th 2017, 11:02 neon1024 Friday 22nd
# Dec 18th 2017, 10:40 birdy247 @neon1024 when is your last day
# Dec 18th 2017, 10:29 birdy247 :+1:
# Dec 18th 2017, 10:28 neon1024 Happy Holidays!
# Dec 18th 2017, 10:28 neon1024 Morning everyone
# Dec 18th 2017, 10:22 hmic i consider that rather a hack than a solution anyways.
# Dec 18th 2017, 10:21 hmic - given we are talking mysql only
# Dec 18th 2017, 10:21 hmic but your user needs to be able to access all of them in this case.
# Dec 18th 2017, 10:20 hmic there might be another option, which is use multiple databases by just providing the database name in the table instances tablename like: database.table
# Dec 18th 2017, 10:19 hmic reduce the amount of concurrent php tasks, or up the connection limit accordingly.
# Dec 18th 2017, 10:18 hmic makallio85: if you reach the maximum connection limit on any of these databases, its the same scenario as if you are talking one database.