stream_put(stream);
stream = NULL;
}
- lttng_trace_chunk_put(current_trace_chunk);
+ if (acquired_reference) {
+ lttng_trace_chunk_put(current_trace_chunk);
+ }
return stream;
error_no_alloc:
stream->stream_handle,
stream->tracefile_size_current, packet_size,
stream->tracefile_current_index, new_file_index);
- tracefile_array_file_rotate(stream->tfa);
+ tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_WRITE);
stream->tracefile_current_index = new_file_index;
if (stream->stream_fd) {
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);
ret = relay_index_try_flush(index);
if (ret == 0) {
+ tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
tracefile_array_commit_seq(stream->tfa);
stream->index_received_seqcount++;
*flushed = true;
}
ret = relay_index_try_flush(index);
if (ret == 0) {
+ tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
tracefile_array_commit_seq(stream->tfa);
stream->index_received_seqcount++;
stream->pos_after_last_complete_data_index += index->total_size;