crate / crate-dbal

Doctrine Database Access Layer for Crate.IO
Apache License 2.0
16 stars 10 forks source link

How to define number of shards and replicas? #75

Closed nook24 closed 4 years ago

nook24 commented 5 years ago

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 commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

seut commented 4 years ago

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

nook24 commented 4 years ago

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