ret = relay_index_try_flush(index);
if (ret == 0) {
tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
- tracefile_array_commit_seq(stream->tfa);
+ tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
stream->index_received_seqcount++;
LTTNG_OPTIONAL_SET(&stream->received_packet_seq_num,
be64toh(index->index_data.packet_seq_num));
ret = relay_index_try_flush(index);
if (ret == 0) {
tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
- tracefile_array_commit_seq(stream->tfa);
+ tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
stream->index_received_seqcount++;
stream->pos_after_last_complete_data_index += index->total_size;
stream->prev_index_seq = index_info->net_seq_num;
}
}
-void tracefile_array_commit_seq(struct tracefile_array *tfa)
+void tracefile_array_commit_seq(struct tracefile_array *tfa,
+ uint64_t new_seq_head)
{
uint64_t *headp, *tailp;
/* Increment overall head. */
- tfa->seq_head++;
- /* If we are committing our first index overall, set tail to 0. */
+ tfa->seq_head = new_seq_head;
+ /* If we are committing our first index overall, set tail to head. */
if (tfa->seq_tail == -1ULL) {
- tfa->seq_tail = 0;
+ tfa->seq_tail = new_seq_head;
}
if (!tfa->count) {
/* Not in tracefile rotation mode. */
void tracefile_array_destroy(struct tracefile_array *tfa);
void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type);
-void tracefile_array_commit_seq(struct tracefile_array *tfa);
+void tracefile_array_commit_seq(struct tracefile_array *tfa,
+ uint64_t new_seq_head);
void tracefile_array_reset(struct tracefile_array *tfa);
uint64_t tracefile_array_get_read_file_index_head(struct tracefile_array *tfa);