struct stream_fd *previous_stream_fd = NULL;
struct lttng_trace_chunk *previous_chunk = NULL;
+ if (!LTTNG_OPTIONAL_GET(&stream->ongoing_rotation)->next_trace_chunk) {
+ ERR("Protocol error encoutered in %s(): stream rotation "
+ "sequence number is before the current sequence number "
+ "and the next trace chunk is unset. Honoring this "
+ "rotation command would result in data loss",
+ __FUNCTION__);
+ ret = -1;
+ goto end;
+ }
+
ASSERT_LOCKED(stream->lock);
/*
* Acquire a reference to the current trace chunk to ensure
goto end;
}
+ assert(stream->stream_fd);
/*
* Seek the current tracefile to the position at which the rotation
* should have occurred.
uint64_t data_offset;
struct relay_index *index;
+ assert(stream->trace_chunk);
ASSERT_LOCKED(stream->lock);
/* Get data offset because we are about to update the index. */
data_offset = htobe64(stream->tracefile_size_current);
stream->prev_data_seq = sequence_number;
ret = try_rotate_stream_data(stream);
- if (ret < 0) {
- goto end;
- }
+
end:
return ret;
}