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

Slaves setup for sharding #2737

Closed
matteomoretti opened this Issue Jun 7, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@matteomoretti

matteomoretti commented Jun 7, 2017

Hi,

at the moment (dbal 2.5.12) doesn't seem to be possible to configure slaves for a sharding configuration. With sharding the connection will use PoolingShardConnection and with slaves MasterSlaveConnection.

Is there a way to configure slaves for each shard?

Thanks a lot

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius Jun 7, 2017

Member

So you'd want to have each shard connection as a MasterSlaveConnection?

I think one possible solution would be to deprecate the existing sharding/master-slave code, and allow passing in lazy connection instances for everything: then each connection object decides what to do.

Member

Ocramius commented Jun 7, 2017

So you'd want to have each shard connection as a MasterSlaveConnection?

I think one possible solution would be to deprecate the existing sharding/master-slave code, and allow passing in lazy connection instances for everything: then each connection object decides what to do.

@matteomoretti

This comment has been minimized.

Show comment
Hide comment
@matteomoretti

matteomoretti Jun 7, 2017

Yes, exactly. I would configure slaves for each shard connection.

Are there any workaround to do that?

Thanks a lot for your reply and your help!

matteomoretti commented Jun 7, 2017

Yes, exactly. I would configure slaves for each shard connection.

Are there any workaround to do that?

Thanks a lot for your reply and your help!

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius Jun 7, 2017

Member

@matteomoretti not currently, no: you'd have to implement it yourself and see if it works first.

Member

Ocramius commented Jun 7, 2017

@matteomoretti not currently, no: you'd have to implement it yourself and see if it works first.

@matteomoretti

This comment has been minimized.

Show comment
Hide comment
@matteomoretti

matteomoretti Jun 9, 2017

@Ocramius thanks for your reply. If you want you can close the issue for now. If I have any updates I'll let you know.

matteomoretti commented Jun 9, 2017

@Ocramius thanks for your reply. If you want you can close the issue for now. If I have any updates I'll let you know.

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius Jun 9, 2017

Member

@matteomoretti closing then.

As noted above, ideally we could just have something like:

class ReadWriteSelectingConnection implements Connection
{
    public function __construct(Connection ...$selectableConnections) { ... }
}

class ShardSelectingConnection implements Connection
{
    public function __construct(Connection ...$selectableConnections) { ... }
}

That would remove the need for explicitly/statically coupled code between a selector class and the connection objects, as the connection objects would be "lazy" and passed in via Dependency Injection.

Member

Ocramius commented Jun 9, 2017

@matteomoretti closing then.

As noted above, ideally we could just have something like:

class ReadWriteSelectingConnection implements Connection
{
    public function __construct(Connection ...$selectableConnections) { ... }
}

class ShardSelectingConnection implements Connection
{
    public function __construct(Connection ...$selectableConnections) { ... }
}

That would remove the need for explicitly/statically coupled code between a selector class and the connection objects, as the connection objects would be "lazy" and passed in via Dependency Injection.

@Ocramius Ocramius closed this Jun 9, 2017

@Ocramius Ocramius added the Incomplete label Jun 9, 2017

@Ocramius Ocramius self-assigned this Jun 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment