The rotation and data pending checks are only performed on the
sequence number of the received data. However, it is expected
that the index of the stream (when applicable) has been written
to disk when those checks say that their respective operations
have completed.
This patch only introduces a new 'prev_index_seq' position that
is updated when an index is flushed to disk.
A follow-up fix addresses the issue mentioned above.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tracefile_array_commit_seq(stream->tfa);
stream->index_received_seqcount++;
stream->pos_after_last_complete_data_index += index->total_size;
+ stream->prev_index_seq = index_info.net_seq_num;
} else if (ret > 0) {
/* no flush. */
ret = 0;
if (index_flushed) {
stream->pos_after_last_complete_data_index =
stream->tracefile_size_current;
+ stream->prev_index_seq = state->header.net_seq_num;
}
stream->prev_seq = state->header.net_seq_num;
stream->stream_handle = stream_handle;
stream->prev_seq = -1ULL;
+ stream->prev_index_seq = -1ULL;
stream->last_net_seq_num = -1ULL;
stream->ctf_stream_id = -1ULL;
stream->tracefile_size = tracefile_size;
*/
pthread_mutex_t lock;
uint64_t prev_seq; /* previous data sequence number encountered. */
+ /* previous index sequence number written to disk. */
+ uint64_t prev_index_seq;
uint64_t last_net_seq_num; /* seq num to encounter before closing. */
/* FD on which to write the stream data. */