Skip to content

Commit

Permalink
refactor: remove conversion step in validator (#25515)
Browse files Browse the repository at this point in the history
The write validator now builds the row data destined for the WAL
directly, vs. creating an intermediate type to hold row data.
  • Loading branch information
hiltontj authored Nov 4, 2024
1 parent ec01934 commit da294a2
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 146 deletions.
11 changes: 6 additions & 5 deletions influxdb3_write/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,14 @@ mod test_helpers {
let db_name = NamespaceName::new(db_name).unwrap();
let result = WriteValidator::initialize(db_name.clone(), catalog, 0)
.unwrap()
.v1_parse_lines_and_update_schema(lp, false)
.unwrap()
.convert_lines_to_buffer(
.v1_parse_lines_and_update_schema(
lp,
false,
Time::from_timestamp_nanos(0),
Gen1Duration::new_5m(),
Precision::Nanosecond,
);
)
.unwrap()
.convert_lines_to_buffer(Gen1Duration::new_5m());

result.valid_data
}
Expand Down
19 changes: 10 additions & 9 deletions influxdb3_write/src/write_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ impl WriteBufferImpl {
self.catalog(),
ingest_time.timestamp_nanos(),
)?
.v1_parse_lines_and_update_schema(lp, accept_partial)?
.convert_lines_to_buffer(ingest_time, self.wal_config.gen1_duration, precision);
.v1_parse_lines_and_update_schema(lp, accept_partial, ingest_time, precision)?
.convert_lines_to_buffer(self.wal_config.gen1_duration);

// if there were catalog updates, ensure they get persisted to the wal, so they're
// replayed on restart
Expand Down Expand Up @@ -267,8 +267,8 @@ impl WriteBufferImpl {
self.catalog(),
ingest_time.timestamp_nanos(),
)?
.v3_parse_lines_and_update_schema(lp, accept_partial)?
.convert_lines_to_buffer(ingest_time, self.wal_config.gen1_duration, precision);
.v3_parse_lines_and_update_schema(lp, accept_partial, ingest_time, precision)?
.convert_lines_to_buffer(self.wal_config.gen1_duration);

// if there were catalog updates, ensure they get persisted to the wal, so they're
// replayed on restart
Expand Down Expand Up @@ -560,13 +560,14 @@ mod tests {
let lp = "cpu,region=west user=23.2 100\nfoo f1=1i";
WriteValidator::initialize(db_name, Arc::clone(&catalog), 0)
.unwrap()
.v1_parse_lines_and_update_schema(lp, false)
.unwrap()
.convert_lines_to_buffer(
.v1_parse_lines_and_update_schema(
lp,
false,
Time::from_timestamp_nanos(0),
Gen1Duration::new_5m(),
Precision::Nanosecond,
);
)
.unwrap()
.convert_lines_to_buffer(Gen1Duration::new_5m());

let db = catalog.db_schema_by_id(DbId::from(0)).unwrap();

Expand Down
Loading

0 comments on commit da294a2

Please sign in to comment.