@@ -165,6 +165,9 @@ bool TransactionManager::undo_transaction(Transaction* txn) {
165165 const auto & log = *it;
166166 auto table_meta_opt = catalog_.get_table_by_name (log.table_name );
167167 if (!table_meta_opt) {
168+ std::cerr << " Rollback ERROR: Table metadata not found for '" << log.table_name
169+ << " ' during undo. Transaction: " << txn->get_id () << " \n " ;
170+ success = false ;
168171 continue ;
169172 }
170173 const auto * table_meta = table_meta_opt.value ();
@@ -187,7 +190,12 @@ bool TransactionManager::undo_transaction(Transaction* txn) {
187190 uint16_t pos = idx_info.column_positions [0 ];
188191 common::ValueType ktype = table_meta->columns [pos].type ;
189192 storage::BTreeIndex index (idx_info.name , bpm_, ktype);
190- static_cast <void >(index.remove (tuple.get (pos), log.rid ));
193+ if (!index.remove (tuple.get (pos), log.rid )) {
194+ std::cerr << " Rollback ERROR: Index remove failed for table '"
195+ << log.table_name << " ', index '" << idx_info.name
196+ << " '\n " ;
197+ success = false ;
198+ }
191199 }
192200 }
193201 }
@@ -210,7 +218,12 @@ bool TransactionManager::undo_transaction(Transaction* txn) {
210218 uint16_t pos = idx_info.column_positions [0 ];
211219 common::ValueType ktype = table_meta->columns [pos].type ;
212220 storage::BTreeIndex index (idx_info.name , bpm_, ktype);
213- static_cast <void >(index.insert (tuple.get (pos), log.rid ));
221+ if (!index.insert (tuple.get (pos), log.rid )) {
222+ std::cerr << " Rollback ERROR: Index insert failed for table '"
223+ << log.table_name << " ', index '" << idx_info.name
224+ << " '\n " ;
225+ success = false ;
226+ }
214227 }
215228 }
216229 }
@@ -227,7 +240,12 @@ bool TransactionManager::undo_transaction(Transaction* txn) {
227240 uint16_t pos = idx_info.column_positions [0 ];
228241 common::ValueType ktype = table_meta->columns [pos].type ;
229242 storage::BTreeIndex index (idx_info.name , bpm_, ktype);
230- static_cast <void >(index.remove (new_tuple.get (pos), log.rid ));
243+ if (!index.remove (new_tuple.get (pos), log.rid )) {
244+ std::cerr << " Rollback ERROR: Index remove failed for table '"
245+ << log.table_name << " ', index '" << idx_info.name
246+ << " '\n " ;
247+ success = false ;
248+ }
231249 }
232250 }
233251 }
@@ -250,8 +268,12 @@ bool TransactionManager::undo_transaction(Transaction* txn) {
250268 uint16_t pos = idx_info.column_positions [0 ];
251269 common::ValueType ktype = table_meta->columns [pos].type ;
252270 storage::BTreeIndex index (idx_info.name , bpm_, ktype);
253- static_cast <void >(
254- index.insert (old_tuple.get (pos), log.old_rid .value ()));
271+ if (!index.insert (old_tuple.get (pos), log.old_rid .value ())) {
272+ std::cerr << " Rollback ERROR: Index insert failed for table '"
273+ << log.table_name << " ', index '" << idx_info.name
274+ << " '\n " ;
275+ success = false ;
276+ }
255277 }
256278 }
257279 }
0 commit comments