Skip to content

Commit bda0a50

Browse files
authored
Merge pull request #105 from ydb-platform/fix-race-on-hb-commit-if-hb-inordered
fix race in hb commit on case if hbs are inordered
2 parents 9320a63 + b63ca8f commit bda0a50

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎internal/processor/processor.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,15 @@ func (processor *Processor) EnqueueHb(ctx context.Context, hb types.HbData) erro
390390
"enqueued just during our commit",
391391
zap.Uint64("step", hb.Step),
392392
zap.Uint64("tx_id", hb.TxId),
393+
zap.Uint32("reader_id", hb.StreamId.ReaderId),
394+
zap.Int64("partition_id", hb.StreamId.PartitionId),
393395
zap.Uint64("our_step", lastPosition.Step),
394396
zap.Uint64("our_tx_id", lastPosition.TxId))
397+
err := hb.CommitTopic()
398+
if err != nil {
399+
errMsg := fmt.Sprintf("EnqueueHb: Unable to commit topic")
400+
return types.ReturnError(ctx, err, errMsg)
401+
}
395402
return nil
396403
}
397404
return processor.hbTracker.AddHb(ctx, hb)
@@ -445,7 +452,11 @@ func (processor *Processor) EnqueueTx(ctx context.Context, tx types.TxData) erro
445452
zap.Uint64("tx_id", tx.TxId),
446453
zap.Uint64("our_step", lastPosition.Step),
447454
zap.Uint64("our_tx_id", lastPosition.TxId))
448-
return nil
455+
err := tx.CommitTopic()
456+
if err != nil {
457+
errMsg := fmt.Sprintf("EnqueueTx: Unable to commit topic")
458+
return types.ReturnError(ctx, err, errMsg)
459+
}
449460
}
450461
processor.txQueue.PushTx(tx)
451462
return nil

0 commit comments

Comments
 (0)