Skip to content

Commit

Permalink
fixed a bunch of bugs that crept in, including not calling the rest o…
Browse files Browse the repository at this point in the history
…f the checkpoint logic ;)
  • Loading branch information
Tishj committed Jan 6, 2025
1 parent c82f24d commit 0c6db17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 14 additions & 3 deletions src/storage/table/column_data_checkpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ CompressionType ForceCompression(vector<optional_ptr<CompressionFunction>> &comp
}

void ColumnDataCheckpointer::InitAnalyze() {
analyze_states.resize(checkpoint_states.size());
for (idx_t i = 0; i < checkpoint_states.size(); i++) {
if (!has_changes[i]) {
continue;
Expand All @@ -138,8 +139,13 @@ void ColumnDataCheckpointer::InitAnalyze() {
auto &states = analyze_states[i];
auto &checkpoint_state = checkpoint_states[i];
auto &coldata = checkpoint_state.get().column_data;
for (auto &func : functions) {
states.push_back(func->init_analyze(coldata, coldata.type.InternalType()));
states.resize(functions.size());
for (idx_t j = 0; j < functions.size(); j++) {
auto &func = functions[j];
if (!func) {
continue;
}
states[j] = func->init_analyze(coldata, coldata.type.InternalType());
}
}
}
Expand Down Expand Up @@ -191,6 +197,9 @@ vector<CheckpointAnalyzeResult> ColumnDataCheckpointer::DetectBestCompressionMet
result.resize(checkpoint_states.size());

for (idx_t i = 0; i < checkpoint_states.size(); i++) {
if (!has_changes[i]) {
continue;
}
auto &functions = compression_functions[i];
auto &states = analyze_states[i];
auto &forced_method = forced_methods[i];
Expand Down Expand Up @@ -236,7 +245,7 @@ vector<CheckpointAnalyzeResult> ColumnDataCheckpointer::DetectBestCompressionMet
throw FatalException("No suitable compression/storage method found to store column of type %s",
col_data.type.ToString());
}
D_ASSERT(compression_idx == DConstants::INVALID_INDEX);
D_ASSERT(compression_idx != DConstants::INVALID_INDEX);
result[i] = CheckpointAnalyzeResult(std::move(chosen_state), *functions[compression_idx]);
}
return result;
Expand Down Expand Up @@ -371,6 +380,8 @@ void ColumnDataCheckpointer::Checkpoint() {
// just move on to finalizing
return;
}

WriteToDisk();
}

void ColumnDataCheckpointer::FinalizeCheckpoint() {
Expand Down
3 changes: 1 addition & 2 deletions src/storage/table/standard_column_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ void StandardColumnData::CheckpointScan(ColumnSegment &segment, ColumnScanState
ColumnData::CheckpointScan(segment, state, row_group_start, count, scan_vector);

idx_t offset_in_row_group = state.row_index - row_group_start;
validity.CheckpointScan(*state.child_states[0].current, state.child_states[0], offset_in_row_group, count,
scan_vector);
validity.ScanCommittedRange(row_group_start, offset_in_row_group, count, scan_vector);
}

bool StandardColumnData::IsPersistent() {
Expand Down

0 comments on commit 0c6db17

Please sign in to comment.