(t *testing.T)
| 392 | } |
| 393 | |
| 394 | func TestFreelist_E2E_MultiSpanOverflows(t *testing.T) { |
| 395 | f := newTestFreelist() |
| 396 | f.Init([]common.Pgid{}) |
| 397 | f.Free(common.Txid(10), common.NewPage(20, common.LeafPageFlag, 0, 1)) |
| 398 | f.Free(common.Txid(10), common.NewPage(25, common.LeafPageFlag, 0, 2)) |
| 399 | f.Free(common.Txid(10), common.NewPage(35, common.LeafPageFlag, 0, 3)) |
| 400 | f.Free(common.Txid(10), common.NewPage(39, common.LeafPageFlag, 0, 2)) |
| 401 | f.Free(common.Txid(10), common.NewPage(45, common.LeafPageFlag, 0, 4)) |
| 402 | requirePages(t, f, common.Pgids{}, common.Pgids{20, 21, 25, 26, 27, 35, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49}) |
| 403 | f.ReleasePendingPages() |
| 404 | requirePages(t, f, common.Pgids{20, 21, 25, 26, 27, 35, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49}, common.Pgids{}) |
| 405 | |
| 406 | // that sequence, regardless of implementation, should always yield the same blocks of pages |
| 407 | allocSequence := []int{7, 5, 3, 2} |
| 408 | expectedSpanStarts := []common.Pgid{35, 45, 25, 20} |
| 409 | for i, pageNums := range allocSequence { |
| 410 | allocated := f.Allocate(common.Txid(11), pageNums) |
| 411 | require.Equal(t, expectedSpanStarts[i], allocated) |
| 412 | // ensure all pages in that span are not considered free anymore |
| 413 | for i := 0; i < pageNums; i++ { |
| 414 | require.False(t, f.Freed(allocated+common.Pgid(i))) |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | func TestFreelist_E2E_Rollbacks(t *testing.T) { |
| 420 | freelist := newTestFreelist() |
nothing calls this directly
no test coverage detected