This repository was archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 618
/
Copy pathmanager_test.cpp
72 lines (56 loc) · 2.18 KB
/
manager_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//===----------------------------------------------------------------------===//
//
// Peloton
//
// manager_test.cpp
//
// Identification: test/catalog/manager_test.cpp
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#include "common/harness.h"
#include "catalog/manager.h"
#include "catalog/schema.h"
#include "common/macros.h"
#include "storage/layout.h"
#include "storage/tile_group.h"
#include "storage/tile_group_factory.h"
namespace peloton {
namespace test {
//===--------------------------------------------------------------------===//
// Manager Tests
//===--------------------------------------------------------------------===//
class ManagerTests : public PelotonTests {};
void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
// TILES
std::vector<std::string> tile_column_names;
std::vector<std::vector<std::string>> column_names;
tile_column_names.push_back("INTEGER COL");
column_names.push_back(tile_column_names);
std::vector<catalog::Schema> schemas;
std::vector<catalog::Column> columns;
// SCHEMA
catalog::Column column1(type::TypeId::INTEGER,
type::Type::GetTypeSize(type::TypeId::INTEGER), "A",
true);
columns.push_back(column1);
std::unique_ptr<catalog::Schema> schema1(new catalog::Schema(columns));
schemas.push_back(*schema1);
std::shared_ptr<const storage::Layout> layout =
std::make_shared<const storage::Layout>(columns.size());
for (oid_t txn_itr = 0; txn_itr < 100; txn_itr++) {
std::unique_ptr<storage::TileGroup> tile_group(
storage::TileGroupFactory::GetTileGroup(INVALID_OID, INVALID_OID,
INVALID_OID, nullptr, schemas,
layout, 3));
}
}
TEST_F(ManagerTests, TransactionTest) {
LaunchParallelTest(8, AddTileGroup);
LOG_INFO("Catalog allocations :: %u",
catalog::Manager::GetInstance().GetCurrentTileGroupId());
// EXPECT_EQ(catalog::Manager::GetInstance().GetCurrentTileGroupId(), 800);
}
} // namespace test
} // namespace peloton