TEST_F(TransactionTests, read_own_writes) { auto writeCtx = hyrise::tx::TransactionManager::getInstance().buildContext(); auto& mod = hyrise::tx::TransactionManager::getInstance()[writeCtx.tid]; ASSERT_EQ(0u, mod.inserted.size()); size_t before = linxxxs->size(); // Add One read all InsertScan is; is.setTXContext(writeCtx); is.addInput(linxxxs); is.setInputData(one_row); is.execute(); ASSERT_EQ(1u, mod.inserted.size()); ASSERT_EQ(1u, mod.inserted[linxxxs].size()); ProjectionScan ps; ps.addField(0); ps.setTXContext(writeCtx); ps.addInput(is.getResultTable()); ps.execute(); ValidatePositions vp; vp.setTXContext(writeCtx); vp.addInput(ps.getResultTable()); vp.execute(); auto r1 = vp.getResultTable(); ASSERT_EQ(before + 1, r1->size()); }
TEST_F(SelectTests, select_after_insert_simple) { auto ctx = tx::TransactionManager::getInstance().buildContext(); hyrise::storage::atable_ptr_t s = io::Loader::shortcuts::load("test/lin_xxs.tbl"); auto initial_size = s->size(); hyrise::storage::atable_ptr_t data = s->copy_structure_modifiable(nullptr, s->size()); data->resize(1); for (std::size_t i=0; i <= 9; ++i) { data->setValue<hyrise_int_t>(i, 0, 1000+i); } // insert data InsertScan isc; isc.setTXContext(ctx); isc.addInput(s); isc.setInputData(data); isc.execute(); ASSERT_EQ(initial_size + 1, isc.getResultTable(0)->size()); }