You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Oleg Valuyskiy (Jira)" <ji...@apache.org> on 2024/12/11 09:35:00 UTC

[jira] [Updated] (IGNITE-23946) Improve clarity of 'Cache is already indexed' exception message

     [ https://issues.apache.org/jira/browse/IGNITE-23946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Valuyskiy updated IGNITE-23946:
------------------------------------
    Description: 
When a user sets an SQL schema for a cache and then attempts to execute a "CREATE TABLE" query, the "Cache is already indexed" exception is thrown. This happens because using the setSqlSchema method marks the cache as supporting SQL. However, "CREATE TABLE" queries should only be executed on caches without this marking.

It appears that for some users, the "Cache is already indexed" message isn't sufficiently informative since it's not entirely clear which user actions trigger this exception.

Therefore, it appears to be beneficial to revise the wording of this exception to ensure greater clarity for users.

A short reproducer:

 
{code:java}
private String schemaName = "PUBLIC";
private String tableName = "TABLE1";
ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration()
        .setName("SQL_" + schemaName + "_" + tableName);
ClientConfiguration ccfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
String createQuery = String.format("CREATE TABLE IF NOT EXISTS %s (id INT PRIMARY KEY, name VARCHAR) WITH \"CACHE_NAME=%s\"",
        tableName, cacheCfg.getName());
cacheCfg.setSqlSchema(schemaName);
startGrid(0);
IgniteClient cli = Ignition.startClient(ccfg);
cli.getOrCreateCache(cacheCfg);
assertThrows(log,
      () -> cli.query(new SqlFieldsQuery(createQuery)).getAll(),
      ClientException.class,
      "Cache is already indexed");
stopAllGrids();
cli.close();
{code}
 

  was:
When a user sets an SQL schema for a cache and then attempts to execute a "CREATE TABLE" query, the "Cache is already indexed" exception is thrown. This happens because using the setSqlSchema method marks the cache as supporting SQL. However, "CREATE TABLE" queries should only be executed on caches without this marking.

It appears that for some users, the "Cache is already indexed" message isn't sufficiently informative since it's not entirely clear which user actions trigger this exception.

Therefore, it appears to be beneficial to revise the wording of this exception to ensure greater clarity for users.


> Improve clarity of 'Cache is already indexed' exception message
> ---------------------------------------------------------------
>
>                 Key: IGNITE-23946
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23946
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Oleg Valuyskiy
>            Assignee: Oleg Valuyskiy
>            Priority: Minor
>              Labels: ise
>
> When a user sets an SQL schema for a cache and then attempts to execute a "CREATE TABLE" query, the "Cache is already indexed" exception is thrown. This happens because using the setSqlSchema method marks the cache as supporting SQL. However, "CREATE TABLE" queries should only be executed on caches without this marking.
> It appears that for some users, the "Cache is already indexed" message isn't sufficiently informative since it's not entirely clear which user actions trigger this exception.
> Therefore, it appears to be beneficial to revise the wording of this exception to ensure greater clarity for users.
> A short reproducer:
>  
> {code:java}
> private String schemaName = "PUBLIC";
> private String tableName = "TABLE1";
> ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration()
>         .setName("SQL_" + schemaName + "_" + tableName);
> ClientConfiguration ccfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
> String createQuery = String.format("CREATE TABLE IF NOT EXISTS %s (id INT PRIMARY KEY, name VARCHAR) WITH \"CACHE_NAME=%s\"",
>         tableName, cacheCfg.getName());
> cacheCfg.setSqlSchema(schemaName);
> startGrid(0);
> IgniteClient cli = Ignition.startClient(ccfg);
> cli.getOrCreateCache(cacheCfg);
> assertThrows(log,
>       () -> cli.query(new SqlFieldsQuery(createQuery)).getAll(),
>       ClientException.class,
>       "Cache is already indexed");
> stopAllGrids();
> cli.close();
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)