Skip to content

Commit

Permalink
feat(rust): Populate commit_log_offsets so they can be produced (#5086)
Browse files Browse the repository at this point in the history
Previously BytesInsertBatch.commit_log_offsets was empty so no offsets would be produced.
  • Loading branch information
lynnagara authored Nov 22, 2023
1 parent 4552a83 commit f9f6e0f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions rust_snuba/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ impl TaskRunner<KafkaPayload, BytesInsertBatch> for MessageProcessor {
payload: BytesInsertBatch::new(
broker_message.timestamp,
transformed,
// TODO: Actually implement this?
BTreeMap::new(),
BTreeMap::from([(
broker_message.partition.index,
(broker_message.offset, broker_message.timestamp),
)]),
),
partition: broker_message.partition,
offset: broker_message.offset,
Expand Down
9 changes: 7 additions & 2 deletions rust_snuba/src/strategies/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ impl PythonTransformStep {
let replacement = BytesInsertBatch::new(
original_message_meta.timestamp,
rows,
// TODO: Actually implement this
BTreeMap::new(),
BTreeMap::from([(
original_message_meta.partition.index,
(
original_message_meta.offset,
original_message_meta.timestamp,
),
)]),
);

let new_message = Message::new_broker_message(
Expand Down
1 change: 1 addition & 0 deletions rust_snuba/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ impl BytesInsertBatch {

pub fn merge(mut self, other: Self) -> Self {
self.rows.encoded_rows.extend(other.rows.encoded_rows);
self.commit_log_offsets.extend(other.commit_log_offsets);
self.rows.num_rows += other.rows.num_rows;
self.sum_message_timestamp_secs += other.sum_message_timestamp_secs;
self.max_message_timestamp_secs = max(
Expand Down

0 comments on commit f9f6e0f

Please sign in to comment.