You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Stephen Danauskas <sd...@factset.com> on 2019/10/02 21:07:27 UTC

Can't create non PUBLIC cache

I'm attempting to create a table and I'm setting the cache name according to the examples in the documentation.

CREATE TABLE IF NOT EXISTS batch_test (x varchar(10), y int, z float, PRIMARY KEY (y)) WITH "CACHE_NAME=foo_1234_test_test";

I've run this query through sqlline and a C++ executable using the ODBC driver. I'm using Ignite 2.7.6. In both cases I'm not seeing the cache being created

+--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+
|           TABLE_CAT            |          TABLE_SCHEM           |           TABLE_NAME           |           TABLE_TYPE  |            REMARKS             | |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+
|                                            | PUBLIC                             | BATCH_TEST                     | TABLE                             |                                              | |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+


Any help is appreciated.


Re: Can't create non PUBLIC cache

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Cache name is independent of schema. Indeed you can set any schema for
cache by using ccfg.setSchema().

CREATE TABLE sets schema for cache to PUBLIC. You still get the cache that
you want.

Regards,
-- 
Ilya Kasnacheev


вт, 15 окт. 2019 г. в 00:18, Stephen <sd...@factset.com>:

> Thanks. I'm confused as to the choice to allow me to create a cache in a
> SQL
> statement using the WITH clause, but not populate the table in that same
> clause. The statement
>
> create table batch_test (x varchar(10), y int, z float, PRIMARY KEY (y))
> with "CACHE_NAME=foo";
>
> seems to clearly indicate that I would like to create the table
> *batch_test*
> in cache *foo*. It even creates the cache for me. I would have at least
> expected cache creation to fail.
>
> How do I create a table in the cache I want (foo or bar)? Given that I'm
> unable to use the thick client, what would that syntax look like?
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Can't create non PUBLIC cache

Posted by Stephen <sd...@factset.com>.
Thanks. I'm confused as to the choice to allow me to create a cache in a SQL
statement using the WITH clause, but not populate the table in that same
clause. The statement 

create table batch_test (x varchar(10), y int, z float, PRIMARY KEY (y))
with "CACHE_NAME=foo";

seems to clearly indicate that I would like to create the table *batch_test*
in cache *foo*. It even creates the cache for me. I would have at least
expected cache creation to fail.

How do I create a table in the cache I want (foo or bar)? Given that I'm
unable to use the thick client, what would that syntax look like? 





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Can't create non PUBLIC cache

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

CREATE TABLE will create table in PUBLIC schema. Hence the conflict.

Regards,
-- 
Ilya Kasnacheev


пн, 14 окт. 2019 г. в 22:59, Stephen <sd...@factset.com>:

> I'm seeing the same thing in Visor. However, I'm not seeing the behavior I
> would expect. For instance (using sqlline)
>
> create table batch_test (x varchar(10), y int, z float, PRIMARY KEY (y))
> with "CACHE_NAME=foo";
> insert into "foo".batch_test (x, y, z) VALUES ('FOO', 6, 5.1);
>
> *Error: Failed to parse query. Schema "foo" not found; SQL statement:*
>
> Typing -
>
> insert into batch_test (x, y, z) VALUES ('FOO', 6, 5.1);
>
> does insert the values. With a cache being essentially equal to a schema, I
> would expect to be able to have the same table name in different caches.
> The
> clearest example of this unexpected behavior is the following
>
> 0: jdbc:ignite:thin://127.0.0.1:10800> create table batch_test (x
> varchar(10), y int, z float, PRIMARY KEY (y)) with "CACHE_NAME=foo";
> No rows affected (0.039 seconds)
>
> 0: jdbc:ignite:thin://127.0.0.1:10800> create table batch_test (x
> varchar(10), y int, z float, PRIMARY KEY (y)) with "CACHE_NAME=bar";
>
> *Error: Table already exists: BATCH_TEST (state=42000,code=3007)*
>
> I can only create
> foo.batch_test
>
> I'm unable to create bar.batch_test if foo.batch_test already exists. The
> behavior I would expect is that both of these succeed. If I'm not
> understanding the data model here, can you clarify?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Can't create non PUBLIC cache

Posted by Stephen <sd...@factset.com>.
I'm seeing the same thing in Visor. However, I'm not seeing the behavior I
would expect. For instance (using sqlline)

create table batch_test (x varchar(10), y int, z float, PRIMARY KEY (y))
with "CACHE_NAME=foo";
insert into "foo".batch_test (x, y, z) VALUES ('FOO', 6, 5.1);

*Error: Failed to parse query. Schema "foo" not found; SQL statement:*

Typing -

insert into batch_test (x, y, z) VALUES ('FOO', 6, 5.1);

does insert the values. With a cache being essentially equal to a schema, I
would expect to be able to have the same table name in different caches. The
clearest example of this unexpected behavior is the following

0: jdbc:ignite:thin://127.0.0.1:10800> create table batch_test (x
varchar(10), y int, z float, PRIMARY KEY (y)) with "CACHE_NAME=foo";
No rows affected (0.039 seconds)

0: jdbc:ignite:thin://127.0.0.1:10800> create table batch_test (x
varchar(10), y int, z float, PRIMARY KEY (y)) with "CACHE_NAME=bar";

*Error: Table already exists: BATCH_TEST (state=42000,code=3007)*

I can only create 
foo.batch_test

I'm unable to create bar.batch_test if foo.batch_test already exists. The
behavior I would expect is that both of these succeed. If I'm not
understanding the data model here, can you clarify?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Can't create non PUBLIC cache

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Are you sure the cache was not created? Did you check it in Visor?

After running this DML I can see the following:

visor> cache -a
Time of the snapshot: 2019-10-03 18:09:13
+=====================================================================================================================================================================+
|         Name(@)         |    Mode     | Nodes | Total entries (Heap /
Off-heap) | Primary entries (Heap / Off-heap) |   Hits    |  Misses   |
Reads   |  Writes   |
+=====================================================================================================================================================================+
| foo_1234_test_test(@c0) | PARTITIONED | 1     | 0 (0 / 0)
      | min: 0 (0 / 0)                    | min: 0    | min: 0    | min: 0
   | min: 0    |

Regards,
-- 
Ilya Kasnacheev


чт, 3 окт. 2019 г. в 00:07, Stephen Danauskas <sd...@factset.com>:

> I’m attempting to create a table and I’m setting the cache name according
> to the examples in the documentation.
>
>
>
> CREATE TABLE IF NOT EXISTS batch_test (x varchar(10), y int, z float,
> PRIMARY KEY (y)) WITH "CACHE_NAME=foo_1234_test_test";
>
>
>
> I’ve run this query through sqlline and a C++ executable using the ODBC
> driver. I’m using Ignite 2.7.6. In both cases I’m not seeing the cache
> being created
>
>
>
>
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+
>
> |           TABLE_CAT            |          TABLE_SCHEM
> |           TABLE_NAME           |           TABLE_TYPE  |
> REMARKS             | |
>
>
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+
>
> |                                            |
> PUBLIC                             | BATCH_TEST                     |
> TABLE                             |
>                         | |
>
>
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+
>
>
>
>
>
> Any help is appreciated.
>
>
>