ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Melnichuk <dmitry.melnic...@nobitlost.com>
Subject Re: Python thin client
Date Fri, 14 Sep 2018 01:51:42 GMT
Igor,

The commented code (lines 95-96) gives an error if executed. The error 
is stated just below, in lines 98-100. It is explained here:

https://apache-ignite-binary-protocol-client.readthedocs.io/en/latest/examples.html#create

I found out by trial and error that a cache, created with SQL DDL 
statement (`CREATE TABLE`), can be deleted only with SQL DDL statement 
(`DROP TABLE`), whereas a table, created with a binary protocol 
operation (`OP_CACHE_CREATE_*` or `OP_CACHE_GET_OR_CREATE_*`) can be 
deleted only with binary protocol operation (`OP_CACHE_DESTROY`). I miss 
this fact in Ignite documentation.

In this particular part of the example I try to stress this out with 
regard to the cache created in the beginning of the example. The cache 
behaves like an SQL table, but can not be dropped. You need to destroy 
it instead (line 102).

I would not go into such depths at all, but the examples are designed to 
be runnable in automated environments, and thus must have some cleanup 
code. And since the cleanup here is not absolutely trivial, I thought I 
must explain it.

I also could handle an error instead of commenting the erroneous code, like

```
any_error = None
try:
     DROP_QUERY = 'DROP TABLE Student'
     client.sql(DROP_QUERY)
except Exception as e:
     any_error = e
print(any_error)

# pyignite.exceptions.SQLError: class 
org.apache.ignite.IgniteCheckedException:
# Only cache created with CREATE TABLE may be removed with DROP TABLE
# [cacheName=SQL_PUBLIC_STUDENT]

but it would complicate the cleanup part of the example to the point it 
is lost any exemplariness. So I decided to simply use comments.

On 9/14/18 2:48 AM, Igor Sapego wrote:
> Ok, now everything's running.
> 
> API looks good to me. I have a single question about example code:
> What these comments are for - [1]?
> 
> [1] -
> https://github.com/nobitlost/ignite/blob/ignite-7782/modules/platforms/python/examples/create_binary.py#L95
> 
> Best Regards,
> Igor
> 
> 
> On Thu, Sep 13, 2018 at 12:52 AM Dmitry Melnichuk <
> dmitry.melnichuk@nobitlost.com> wrote:
> 
>> Igor,
>>
>> Yes, it's my bad, sorry. Just merged the Ignite master with my branch.
>>
>> On 9/12/18 8:47 PM, Igor Sapego wrote:
>>> Pavel,
>>> Yes, I did. I tried completely clean environment, followed the same
>>> steps and got the same error. Then I removed attr, and out of sudden
>>> everything started working.
>>>
>>> Dmitry,
>>> Thanks, now it's more clear:
>>> Handshake error: Unsupported version. Server expects binary protocol
>>> version 1.1.0. Client provides 1.2.0.
>>>
>>> Why do you use version 1.2.0, but have outdated server code? I
>>> propose you to merge with or rebase onto Ignite's master branch.
>>>
>>> Best Regards,
>>> Igor
>>>
>>>
>>> On Tue, Sep 11, 2018 at 11:21 PM Dmitry Melnichuk <
>>> dmitry.melnichuk@nobitlost.com> wrote:
>>>
>>>> Igor,
>>>>
>>>> I have just commited an improvment to the HandshakeError message
>>>> generation algorithm. I hope it is now easier to understand what expects
>>>> what in case of binary protocol version mismatch.
>>>>
>>>> Thank you for pointing this out.
>>>>
>>>> On 9/12/18 2:13 AM, Igor Sapego wrote:
>>>>> I managed to start tests, and now I'm getting the following message:
>>>>>
>>>>> pyignite.exceptions.HandshakeError: Handshake error: Unsupported
>>>>> version. Expected protocol version: 1.1.0.
>>>>>
>>>>> It would be useful to print "Unexpected version" itself, because I can
>>>>> not understand what is the issue.
>>>>>
>>>>> Best Regards,
>>>>> Igor
>>>>
>>>
>>
>>
> 


Mime
View raw message