Can't create non PUBLIC cache

classic Classic list List threaded Threaded
6 messages Options
Stephen Stephen
Reply | Threaded
Open this post in threaded view
|

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.

 

ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Can't create non PUBLIC cache

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 <[hidden email]>:

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.

 

Stephen Stephen
Reply | Threaded
Open this post in threaded view
|

Re: Can't create non PUBLIC cache

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/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Can't create non PUBLIC cache

Hello!

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

Regards,
--
Ilya Kasnacheev


пн, 14 окт. 2019 г. в 22:59, Stephen <[hidden email]>:
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/
Stephen Stephen
Reply | Threaded
Open this post in threaded view
|

Re: Can't create non PUBLIC cache

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/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Can't create non PUBLIC cache

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 <[hidden email]>:
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/