Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

### Bug fixes

- Fixed a bug: the timeout in IProtoBegin was being specified in milliseconds (as a `long`), but
the [protocol](https://www.tarantool.io/ru/doc/latest/reference/internals/iproto/streams/#iproto-begin)
requires the timeout to be passed in seconds (as a `double`).

## [1.7.2] - 2026-09-25

### Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
public class IProtoBegin extends IProtoBaseRequest {

// body fields
private final long timeout;
private final double timeoutS;
private final TransactionIsolationLevel level;

public IProtoBegin(Long streamId, long timeout, TransactionIsolationLevel level) {
if (timeout <= 0) {
throw new IllegalArgumentException("timeout should be greater than 0");
public IProtoBegin(Long streamId, long timeoutMs, TransactionIsolationLevel level) {
if (timeoutMs <= 0) {
throw new IllegalArgumentException("timeoutMs should be greater than 0");
}
this.timeout = timeout;
this.timeoutS = timeoutMs / 1_000d;
this.level = level;
this.setStreamId(streamId);
}
Expand All @@ -55,7 +55,7 @@ public byte[] getPacket(MessageBufferPacker packer) throws IOException {
}

packer.addPayload(RAW_IPROTO_TIMEOUT); // key
packer.packDouble(timeout); // value
packer.packDouble(timeoutS); // value

if (!level.equals(TransactionIsolationLevel.DEFAULT)) {
packer.addPayload(RAW_IPROTO_TXN_ISOLATION); // key
Expand All @@ -68,7 +68,7 @@ public byte[] getPacket(MessageBufferPacker packer) throws IOException {
@Override
public MapValue getBody() {
Map<Value, Value> map = new HashMap<>();
map.put(MP_IPROTO_TIMEOUT, ValueFactory.newInteger(timeout));
map.put(MP_IPROTO_TIMEOUT, ValueFactory.newFloat(timeoutS));

if (!level.equals(TransactionIsolationLevel.DEFAULT)) {
map.put(MP_IPROTO_TXN_ISOLATION, ValueFactory.newInteger(level.ordinal()));
Expand All @@ -94,8 +94,8 @@ public String toString() {
.append("IProtoBegin(syncId = ")
.append(getSyncId())
.append(", timeout = ")
.append(timeout)
.append(", level = ")
.append(timeoutS)
.append("s, level = ")
.append(level)
.append(")");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ public void testRequestsToString() {

// begin
final Long streamId = 1L;
long timeout = 1L;
IProtoRequest begin = new IProtoBegin(streamId, timeout, TransactionIsolationLevel.DEFAULT);
long timeoutMs = 1L;
double timeoutS = timeoutMs / 1_000d;
IProtoRequest begin = new IProtoBegin(streamId, timeoutMs, TransactionIsolationLevel.DEFAULT);
assertEquals(
"IProtoBegin(syncId = "
+ begin.getSyncId()
+ ", timeout = "
+ timeout
+ ", level = "
+ timeoutS
+ "s, level = "
+ TransactionIsolationLevel.DEFAULT
+ ")",
begin.toString());
Expand Down
Loading