1#include "duckdb/transaction/rollback_state.hpp"
2#include "duckdb/transaction/delete_info.hpp"
3#include "duckdb/transaction/update_info.hpp"
4
5#include "duckdb/storage/uncompressed_segment.hpp"
6#include "duckdb/storage/table/chunk_info.hpp"
7
8#include "duckdb/catalog/catalog_entry.hpp"
9#include "duckdb/catalog/catalog_set.hpp"
10
11using namespace duckdb;
12using namespace std;
13
14void RollbackState::RollbackEntry(UndoFlags type, data_ptr_t data) {
15 switch (type) {
16 case UndoFlags::CATALOG_ENTRY: {
17 // undo this catalog entry
18 CatalogEntry *catalog_entry = *((CatalogEntry **)data);
19 assert(catalog_entry->set);
20 catalog_entry->set->Undo(catalog_entry);
21 break;
22 }
23 case UndoFlags::DELETE_TUPLE: {
24 auto info = (DeleteInfo *)data;
25 // reset the deleted flag on rollback
26 info->vinfo->CommitDelete(NOT_DELETED_ID, info->rows, info->count);
27 break;
28 }
29 case UndoFlags::UPDATE_TUPLE: {
30 auto info = (UpdateInfo *)data;
31 info->segment->RollbackUpdate(info);
32 break;
33 }
34 default:
35 assert(type == UndoFlags::EMPTY_ENTRY);
36 break;
37 }
38}
39