ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Tupitsyn <ptupit...@apache.org>
Subject Re: Create cache using thin protocol
Date Fri, 22 Dec 2017 07:06:45 GMT
Hi Denis,

I think we can assign an id to each parameter. It is not difficult to add.

> not to tell about this operation
Hiding stuff is not a good approach. Any decent engineer will have a look
at the server code and see it.

Pavel

On Fri, Dec 22, 2017 at 3:45 AM, Denis Magda <dmagda@apache.org> wrote:

> Hi Pavel,
>
> If it’s supposed to be used this way then it’s better not to tell about
> this operation at all until it’s simplified from a user standpoint.
>
> My suggestion would be to design the operation so that I can pass only
> those configuration parameters that need to be different from the defaults.
> How difficult is this and can the improvement go into 2.4?
>
> —
> Denis
>
> > On Dec 20, 2017, at 10:48 PM, Pavel Tupitsyn <ptupitsyn@gridgain.com>
> wrote:
> >
> > Hi Prachi,
> >
> > Yes, you have to provide full configuration. The error is caused by
> > incomplete request message.
> >
> > Alternatively, define cache templates on server (configs with * in them)
> > and then use OP_CACHE_CREATE_WITH_NAME from thin client.
> >
> > Thanks,
> > Pavel
> >
> > On Thu, Dec 21, 2017 at 3:47 AM, Prachi Garg <pgarg@gridgain.com> wrote:
> >
> >> Pavel,
> >>
> >> I tried to create a cache with configuration, using the thin protocol.
> >>
> >> 1. Do I need to provide every configuration as mentioned in the wiki,
> or I
> >> can just provide a few and the rest can be default?
> >>
> >> 2. Using the below code:
> >>
> >> DataOutputStream out = new DataOutputStream(socket.getOutputStream());
> >>
> >> // Message length
> >> writeIntLittleEndian(22, out);
> >>
> >> // Op code = OP_CACHE_CREATE_WITH_CONFIGURATION
> >> writeShortLittleEndian(1053, out);
> >>
> >> // Request id (can be anything)
> >> long reqId = 1;
> >> writeLongLittleEndian(reqId, out);
> >>
> >> // CacheAtomicityMode
> >> writeIntLittleEndian(0, out);
> >>
> >> // Backups
> >> writeIntLittleEndian(2, out);
> >>
> >> // CacheMode
> >> writeIntLittleEndian(2, out);
> >>
> >> // Read result
> >> DataInputStream in = new DataInputStream(socket.getInputStream());
> >>
> >> // Response length
> >> final int len = readIntLittleEndian(in);
> >> System.out.println("len: " + len);
> >>
> >> // Request id
> >> long resReqId = readLongLittleEndian(in);
> >> System.out.println("resReqId: " + resReqId);
> >>
> >> // Success
> >> int statusCode = readIntLittleEndian(in);
> >> System.out.println("status code: " + statusCode);
> >>
> >>
> >> I get the following error:
> >>
> >> [2017-12-20 16:43:32,800][ERROR][client-connector-#45][ClientListenerNioListener]
> Failed to parse client request.
> >> class org.apache.ignite.binary.BinaryObjectException: Not enough data
> to read the value [position=22, requiredBytes=4, remainingBytes=0]
> >>      at org.apache.ignite.internal.binary.streams.
> BinaryAbstractInputStream.ensureEnoughData(BinaryAbstractInputStream.
> java:305)
> >>      at org.apache.ignite.internal.binary.streams.
> BinaryAbstractInputStream.readInt(BinaryAbstractInputStream.java:127)
> >>      at org.apache.ignite.internal.binary.BinaryReaderExImpl.
> readInt(BinaryReaderExImpl.java:743)
> >>      at org.apache.ignite.internal.processors.platform.client.cache.
> ClientCacheConfigurationSerializer.read(ClientCacheConfigurationSerial
> izer.java:125)
> >>      at org.apache.ignite.internal.processors.platform.client.cache.
> ClientCacheCreateWithConfigurationRequest.<init>(
> ClientCacheCreateWithConfigurationRequest.java:45)
> >>      at org.apache.ignite.internal.processors.platform.client.
> ClientMessageParser.decode(ClientMessageParser.java:333)
> >>      at org.apache.ignite.internal.processors.platform.client.
> ClientMessageParser.decode(ClientMessageParser.java:220)
> >>      at org.apache.ignite.internal.processors.odbc.
> ClientListenerNioListener.onMessage(ClientListenerNioListener.java:119)
> >>      at org.apache.ignite.internal.processors.odbc.
> ClientListenerNioListener.onMessage(ClientListenerNioListener.java:40)
> >>      at org.apache.ignite.internal.util.nio.GridNioFilterChain$
> TailFilter.onMessageReceived(GridNioFilterChain.java:279)
> >>      at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.
> proceedMessageReceived(GridNioFilterAdapter.java:109)
> >>      at org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.
> body(GridNioAsyncNotifyFilter.java:97)
> >>      at org.apache.ignite.internal.util.worker.GridWorker.run(
> GridWorker.java:110)
> >>      at org.apache.ignite.internal.util.worker.GridWorkerPool$1.
> run(GridWorkerPool.java:70)
> >>      at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
> >>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
> >>      at java.lang.Thread.run(Thread.java:745)
> >>
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message