private void appendBlock() { final ByteBuffer rawBuffer = blockPeek.getRawBuffer(); final MutableDirectBuffer buffer = blockPeek.getBuffer(); final long address = logStorage.append(rawBuffer); if (address >= 0) { blockPeek.markCompleted(); logStorageAppendConditions.signalConsumers(); } else { isFailed.set(true); final long positionOfFirstEventInBlock = LogEntryDescriptor.getPosition(buffer, 0); LOG.error( "Failed to append log storage on position '{}'. Stop writing to log storage until recovered.", positionOfFirstEventInBlock); // recover log storage from failure - see zeebe-io/zeebe#500 peekedBlockHandler = this::discardBlock; discardBlock(); } }
private void discardBlock() { blockPeek.markFailed(); // continue with next block actor.yield(); }
/** Finish reading and consume the fragments (i.e. update the subscription position). */ public void markCompleted() { updatePosition(); }
final int absoluteOffset = bufferOffset + firstFragmentOffset; availableBlock.setBlock( rawDispatcherBufferView, position,
final int absoluteOffset = bufferOffset + firstFragmentOffset; availableBlock.setBlock( rawDispatcherBufferView, position,
private void appendBlock() { final ByteBuffer rawBuffer = blockPeek.getRawBuffer(); final MutableDirectBuffer buffer = blockPeek.getBuffer(); final long address = logStorage.append(rawBuffer); if (address >= 0) { blockPeek.markCompleted(); logStorageAppendConditions.signalConsumers(); } else { isFailed.set(true); final long positionOfFirstEventInBlock = LogEntryDescriptor.getPosition(buffer, 0); LOG.error( "Failed to append log storage on position '{}'. Stop writing to log storage until recovered.", positionOfFirstEventInBlock); // recover log storage from failure - see zeebe-io/zeebe#500 peekedBlockHandler = this::discardBlock; discardBlock(); } }
/** Finish reading and consume the fragments (i.e. update the subscription position). */ public void markCompleted() { updatePosition(); }
private void discardBlock() { blockPeek.markFailed(); // continue with next block actor.yield(); }
/** * Finish reading and consume the fragments (i.e. update the subscription position). Mark all * fragments as failed. */ public void markFailed() { int fragmentOffset = 0; while (fragmentOffset < blockLength) { int framedFragmentLength = bufferView.getInt(DataFrameDescriptor.lengthOffset(fragmentOffset)); if (framedFragmentLength < 0) { framedFragmentLength = -framedFragmentLength; } final int frameLength = DataFrameDescriptor.alignedLength(framedFragmentLength); final int flagsOffset = DataFrameDescriptor.flagsOffset(fragmentOffset); final byte flags = bufferView.getByte(flagsOffset); bufferView.putByte(flagsOffset, DataFrameDescriptor.enableFlagFailed(flags)); fragmentOffset += frameLength; } updatePosition(); }
/** * Finish reading and consume the fragments (i.e. update the subscription position). Mark all * fragments as failed. */ public void markFailed() { int fragmentOffset = 0; while (fragmentOffset < blockLength) { int framedFragmentLength = bufferView.getInt(DataFrameDescriptor.lengthOffset(fragmentOffset)); if (framedFragmentLength < 0) { framedFragmentLength = -framedFragmentLength; } final int frameLength = DataFrameDescriptor.alignedLength(framedFragmentLength); final int flagsOffset = DataFrameDescriptor.flagsOffset(fragmentOffset); final byte flags = bufferView.getByte(flagsOffset); bufferView.putByte(flagsOffset, DataFrameDescriptor.enableFlagFailed(flags)); fragmentOffset += frameLength; } updatePosition(); }