yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.06k stars 1.08k forks source link

[YCQL] Using DataGrip to get schema info results in - [localhost/127.0.0.1:53315] Connection has been closed. #4196

Open z0mb1ek opened 4 years ago

z0mb1ek commented 4 years ago

Jira Link: DB-4675 Hi. Cannot get schemas for database.

Screenshot 2020-04-12 at 18 37 53
z0mb1ek commented 4 years ago

Connection is ok

Screenshot 2020-04-12 at 18 38 44
kmuthukk commented 4 years ago

@z0mb1ek

1) To confirm, you are using this with YB version of drivers or Apache Cassandra drivers?

2) Looks like the yb-tserver process might have crashed. We'll need to look at the yb-tserver log files to see if there's a FATAL, .err or core file; that should give us clues.

z0mb1ek commented 4 years ago

@kmuthukk

  1. has YB jdbc driver for YCQL? Datagrip can use only jdbc Screenshot 2020-04-12 at 19 38 36
z0mb1ek commented 4 years ago

@kmuthukk

  1. log file has

E0412 16:42:52.774022 107 process_context.cc:180] SQL Error: Object Not Found SELECT FROM system.peers_v2 ^^^^^^^^^^^^^^^ E0412 16:42:52.774062 107 process_context.cc:180] SQL Error: Server Error. Unknown keyspace/cf pair (system.peers_v2) SELECT FROM system.peers_v2 ^^^^^^

psudheer21 commented 4 years ago

The error seems to be correc here: "Unknown keyspace/cf pair (system.peers_v2)"

based on the generic cassandra driver here: https://github.com/datastax/java-driver/blob/4.x/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/DefaultTopologyMonitor.java#L186

But the driver used here is the CassandraJDbc driver. Shouldn't that be done here?

z0mb1ek commented 4 years ago

I think driver is here https://github.com/DataGrip/cassandra-jdbc-driver/releases

z0mb1ek commented 4 years ago

any news? don't want to buy table plus(

psudheer21 commented 4 years ago

I didn't get time to look at this. I will get to it ASAP and get you more info..

psudheer21 commented 4 years ago

So looks like this is the issue that is happening on the Datagrip side:

[localhost/127.0.0.1:9042] Connection has been closed
The SQL statement:
SELECT keyspace_name, durable_writes, toJson(replication) as replication
FROM system_schema.keyspaces

is failing with the stack trace and the log message as:

2020-04-26 18:54:50,194 [ 400265]   WARN - lij.database.util.ErrorHandler - [localhost/127.0.0.1:9042] Connection has been closed                                                                                                             
[localhost/127.0.0.1:9042] Connection has been closed                                                                                                                                                                                         
The SQL statement:                                                                                                                                                                                                                            
SELECT keyspace_name, durable_writes, toJson(replication) as replication                                                                                                                                                                      
FROM system_schema.keyspaces                                                                                                                                                                                                                  

        at com.intellij.database.remote.jdba.jdbc.dialects.CassandraExceptionRecognizer.recognizeSpecificException(CassandraExceptionRecognizer.java:28)                                                                                      
        at com.intellij.database.remote.jdba.jdbc.BaseExceptionRecognizer.recognizeException(BaseExceptionRecognizer.java:44)                                                                                                                 
        at com.intellij.database.remote.jdba.jdbc.JdbcIntermediateSession.recognizeException(JdbcIntermediateSession.java:387)                                                                                                                
        at com.intellij.database.remote.jdba.jdbc.JdbcIntermediateSimpleSeance.<init>(JdbcIntermediateSimpleSeance.java:27)                                                                                                                   
        at com.intellij.database.remote.jdba.jdbc.JdbcIntermediateSession.openSimpleStatementSeance(JdbcIntermediateSession.java:138)                                                                                                         
        at com.intellij.database.remote.jdba.jdbc.JdbcIntermediateSession.openSeance(JdbcIntermediateSession.java:126)                                                                                                                        
        at com.intellij.database.remote.jdba.jdbc.dialects.CassandraIntermediateSession.openSeance(CassandraIntermediateSession.java:38)                                                                                                      
        at com.intellij.database.remote.jdba.jdbc.dialects.CassandraIntermediateSession.openSeance(CassandraIntermediateSession.java:16)                                                                                                      
        at com.intellij.database.remote.jdba.impl.RemoteSessionImpl.openSeance(RemoteSessionImpl.java:38)                                                                                                                                     
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                                     
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                                                   
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                           
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)                                                                                                                                                                         
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)                                                                                                                                                       
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)                                                                                                                                                                     
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)                                                                                                                                                                     
        at java.base/java.security.AccessController.doPrivileged(Native Method)                                                                                                                                                               
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)                                                                                                                                                               
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)                                                                                                                                                  
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)                                                                                                                                          
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)                                                                                                                                  
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

But when I ran the same on the cqlsh shell It worked fine:

cqlsh> SELECT keyspace_name, durable_writes, toJson(replication) as replication FROM system_schema.keyspaces;

 keyspace_name | durable_writes | replication
---------------+----------------+----------------------------------------------------------------------------------
        system |           True | {"class":"org.apache.cassandra.locator.SimpleStrategy","replication_factor":"1"}
 system_schema |           True | {"class":"org.apache.cassandra.locator.SimpleStrategy","replication_factor":"1"}
   system_auth |           True | {"class":"org.apache.cassandra.locator.SimpleStrategy","replication_factor":"1"}
psudheer21 commented 4 years ago

Going to debug this a bit more and figure out what is the format they they are expecting the data to be in.

litone01 commented 2 years ago

Hi, can I kindly check if there is an update for this issue? Many thanks!

bencurio commented 7 months ago

Interesting, I can run this query from the DataGrip console without the toJson() function:

SELECT keyspace_name, durable_writes, replication as replication FROM system_schema.keyspaces;

image

When I add toJson(), I get this error message:

image

+1:

==> yb-tserver.WARNING <==
W0503 18:54:55.304661  4896 cql_processor.cc:387] Unsupported driver option DRIVER_NAME = DataStax Java Driver
              ^^^^^^^^^^^^^^^

+2:

==> yb-tserver.WARNING <==
W0503 19:05:31.831157  4894 cql_processor.cc:387] Unsupported driver option DRIVER_NAME = DataStax Java Driver
W0503 19:05:31.841301  4554 client-internal.cc:1476] GetTableSchemaRpc(table_identifier: table_name: "peers_v2" namespace { name: "system" database_type: YQL_DATABASE_CQL }, num_attempts: 1) failed: Not found (yb/master/catalog_manager.cc:5500): Table system.peers_v2 not found: OBJECT_NOT_FOUND (master error 3)
W0503 19:05:31.841348  4896 process_context.cc:184] SQL Error: Object Not Found
SELECT * FROM system.peers_v2
              ^^^^^^^^^^^^^^^
bencurio commented 7 months ago

Hmm... I was able to get it working with this driver, but the fields still don't load.

https://mvnrepository.com/artifact/com.yugabyte/cassandra-jdbc-wrapper