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

How to define number of shards and replicas? #75

Closed
nook24 opened this issue Oct 6, 2019 · 7 comments
Closed

How to define number of shards and replicas? #75

nook24 opened this issue Oct 6, 2019 · 7 comments

Comments

@nook24
Copy link

nook24 commented Oct 6, 2019

Hi,
I want to use DBAL to manage schema updates.
Unfortunately I don't know how pass shards and replicas.

In addition, when I run this:

$connectionParams = [
                'user'        => null,
                'password'    => null,
                'host'        => '127.0.0.1',
                'port'        => 4200,
                'driverClass' => 'Crate\DBAL\Driver\PDOCrate\Driver',
];
$connection = DriverManager::getConnection($connectionParams);
$platform = $connection->getDatabasePlatform();

$SchemaManager = $connection->getSchemaManager();

$schema = $SchemaManager->createSchema();

I get:

PHP Notice:  Undefined offset: 0 in vendor/crate/crate-dbal/src/Crate/DBAL/Schema/CrateSchemaManager.php on line 62

Looks like there is a bug with primary keys.

I'm using version crate-dbal 2.0.0 and CrateDB 4.0.4

seut added a commit that referenced this issue Nov 15, 2019
CrateDB supports some specific table options e.g. for configuring
sharding, partitioned tables or number of replicas.
Passing this configurations via DBAL `$options` is now possible.

Relates #75.
@seut
Copy link
Member

seut commented Nov 15, 2019

@nook24 Thanks for reporting the missing support for custom CrateDB table options.
I've created a PR to add this.

We'll look into the PK issue next.

seut added a commit that referenced this issue Nov 15, 2019
CrateDB supports some specific table options e.g. for configuring
sharding, partitioned tables or number of replicas.
Passing this configurations via DBAL `$options` is now possible.

Relates #75.
seut added a commit that referenced this issue Nov 15, 2019
CrateDB supports some specific table options e.g. for configuring
sharding, partitioned tables or number of replicas.
Passing this configurations via DBAL `$options` is now possible.

Relates #75.
@seut
Copy link
Member

seut commented Nov 15, 2019

@nook24 We cannot reproduce the PK issue on $SchemaManager->createSchema();, we also have a test for validating the functionality using a primary key, see https://github.com/crate/crate-dbal/blob/master/test/Crate/Test/DBAL/Functional/Schema/SchemaManagerTest.php#L117.

Could you please paste us your used table schema?

@nook24
Copy link
Author

nook24 commented Nov 17, 2019

Hi @seut, many thanks for looking into this. This is the schema I used: https://github.com/statusengine/worker/blob/master/lib/crateDB.sql

Maybe this issue is caused by the multi field primary keys

seut added a commit that referenced this issue Nov 18, 2019
CrateDB supports some specific table options e.g. for configuring
sharding, partitioned tables or number of replicas.
Passing this configurations via DBAL `$options` is now possible.

Relates #75.
@seut
Copy link
Member

seut commented Nov 18, 2019

@nook24 Thanks for the information. We've figured out that the issue is not related to tables with primary key constraints but related to tables without any.
We're working on a fix, I'll keep you updated.

seut added a commit that referenced this issue Nov 19, 2019
The SchemaManager raised an exception while reading tables *without*
any PRIMARY KEY constraints and ignored them when existing.

NOT NULL constraints were ignored completely.

Relates #75.
seut added a commit that referenced this issue Nov 20, 2019
The SchemaManager raised an exception while reading tables *without*
any PRIMARY KEY constraints and ignored them when existing.

Relates #75.
@seut
Copy link
Member

seut commented Nov 20, 2019

@nook24 We've fixed the issue which will be part of the next release.
Thanks for bringing this up.

@seut seut closed this as completed Nov 20, 2019
@seut
Copy link
Member

seut commented Nov 21, 2019

@nook24 We've released v2.1.0 including the PK fix and table options support.

@nook24
Copy link
Author

nook24 commented Nov 25, 2019

Many thanks for your fast fix! I will test it :)

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

2 participants