You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

IDIEP-76
Author
Sponsor
Created

  

Status
DRAFT


Motivation

Thin client protocol will be the primary way to interact with Ignite 3.0 from code.

Description

Adapt Ignite 2.x protocol for Ignite 3.0. Main differences are:

TCP Socket

  • Every Ignite node listens on a TCP port. Thin client implementations connect to any node in the cluster (possibly multiple nodes) through a TCP socket and perform Ignite operations using a well-defined binary protocol.
  • Server-side connection parameters are defined in ClientConnectorConfiguration class.
    • Default port is 10800.
    • Connector is enabled by default, no configuration changes needed.
  • Netty is used on the server for network IO.

Data Format

MsgPack is used for data serialization.

Data Types Mapping

Ignite data types defined in IEP-54 map to MsgPack data types the following way:

Ignite Type

Size

MsgPack TypeNotes
Bitmask(n)n/8 bytesbin8 / bin16 / bin32
IntX, UintX1-8 bytesfixint / intX / uintXInteger types are interchangeable when possible. fixint (1 byte) can be passed as a value for uint64 column.
Float4 bytesfloat32
Double8 bytesfloat64
Number([n])Variableext16 (up to 2^8 - 1 bytes)Extension 1
DecimalVariableext16 (up to 2^8 - 1 bytes)Extension 2
UUID16 bytesfixext16Extension 3
StringVariablestr
Date3 bytesfixext4Extension 4
Time4 bytesfixext4Extension 5
Datetime7 bytesfixext8Extension 6
Timestamp8 bytestimestamp 64
BinaryVariablebin32 (up to 2^32 - 1 bytes)

"Extension X" is a MsgPack extension type (up to 128 extension types are allowed).

Integer data types, varint encoding

MsgPack provides multiple data types for integer values. When encoding a value, smallest data type for that value is picked automatically.

"int" is used below to denote int format family. Values such as payload size, request ID, error codes, are encoded this way - using variable number of bytes based on the value.

Message format

All messages, request and response, except handshake, start with int message length (excluding the length itself).

  • Any MsgPack int type can be used (see varint above). Empty message will be single 0 byte.
  • Maximum message length is 2147483647 (Integer.MAX_VALUE and maximum byte array length in Java)
int Length of Payload
...Payload


Handshake


Request
4 bytesMagic number 49 47 4E 49, or "IGNI". Helps identifying misconfigured SSL or other apps probing the port.
intPayload length
intVersion major
intVersion minor
intVersion patch
intClient code (1 for JDBC, 2 for general-purpose client)
binFeatures (bitmask)
map (string → any)Extensions (auth, attributes, etc). Server can skip unknown extension data (when client is newer).


Response
4 bytesMagic number 49 47 4E 49, or "IGNI". Helps identifying misconfigured SSL or different server on the port.
intPayload length
intServer version major
intServer version minor
intServer version patch
booleanSuccess flag
stringWhen success flag is false: Error message
binWhen success flag is true: Server features (bitmask)
map (string → any)When success flag is true: Extensions (auth, attributes, etc). Client can skip unknown extension data (when server is newer).

Client Operations

 Upon successful handshake client can start performing operations by sending a request with specific op code. Each operation has it's own request and response format, with a common header.

Request
intOperation code
intRequest id, generated by client and returned as-is in response
...Operation-specific data


Response
intType = 0
intRequest id
intError code (0 for success)
stringError message (when error code is not 0)
...Operation-specific data


Clients should expect notification messages at any moment after the successful handshake.

Notification
intType = 1
intNotification code
...Notification-specific data


Operation codes and request ids are omitted everywhere below for brevity.

OP_CREATE_TABLE = 1

TODO: Schema, settings - extendable (map-based)

OP_GET_TABLE_NAMES = 2

TODO:

OP_GET_TABLE_INFO = 3

TODO

OP_DROP_TABLE = 4

TODO: by name

Risks and Assumptions

TODO

Discussion Links

  • TODO

Reference Links

Tickets

key summary type created updated due assignee reporter priority status resolution

JQL and issue key arguments for this macro require at least one Jira application link to be configured

  • No labels