Skip to content

Commit 6ce8c6a

Browse files
author
Xiangyao Yu
committed
[DBx1000] added Hekaton, Silo and TicToc.
1 parent 16dd93c commit 6ce8c6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2614
-1333
lines changed

Makefile

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,29 @@ CFLAGS=-Wall -g -std=c++0x
44
.SUFFIXES: .o .cpp .h
55

66
SRC_DIRS = ./ ./benchmarks/ ./concurrency_control/ ./storage/ ./system/
7-
DEPS = -I. -I./benchmarks -I./concurrency_control -I./storage -I./system
7+
INCLUDE = -I. -I./benchmarks -I./concurrency_control -I./storage -I./system
88

9-
CFLAGS += $(DEPS) -D NOGRAPHITE=1 -Werror
10-
LDFLAGS = -Wall -L. -pthread -g -lrt -std=c++0x
9+
CFLAGS += $(INCLUDE) -D NOGRAPHITE=1 -Werror -O3
10+
LDFLAGS = -Wall -L. -pthread -g -lrt -std=c++0x -O3 -ljemalloc
1111
LDFLAGS += $(CFLAGS)
1212

13-
CPPS = $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)*.cpp))
14-
15-
#CPPS = $(wildcard *.cpp)
16-
OBJS = $(addprefix obj/, $(notdir $(CPPS:.cpp=.o)))
17-
18-
#NOGRAPHITE=1
13+
CPPS = $(foreach dir, $(SRC_DIRS), $(wildcard $(dir)*.cpp))
14+
OBJS = $(CPPS:.cpp=.o)
15+
DEPS = $(CPPS:.cpp=.d)
1916

2017
all:rundb
2118

22-
.PHONY: deps
23-
deps:$(CPPS)
24-
$(CC) $(CFLAGS) -MM $^ > obj/deps
25-
sed '/^[^ ]/s/^/obj\//g' obj/deps > obj/deps.tmp
26-
mv obj/deps.tmp obj/deps
27-
-include obj/deps
28-
2919
rundb : $(OBJS)
3020
$(CC) -o $@ $^ $(LDFLAGS)
31-
#./deps/%.d: %.cpp
32-
# $(CC) -MM -MT $*.o -MF $@ $(CFLAGS) $<
33-
./obj/%.o: benchmarks/%.cpp
34-
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
35-
./obj/%.o: storage/%.cpp
36-
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
37-
./obj/%.o: system/%.cpp
38-
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
39-
./obj/%.o: concurrency_control/%.cpp
40-
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
41-
./obj/%.o: %.cpp
42-
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
21+
22+
-include $(OBJS:%.o=%.d)
23+
24+
%.d: %.cpp
25+
$(CC) -MM -MT $*.o -MF $@ $(CFLAGS) $<
26+
27+
%.o: %.cpp
28+
$(CC) -c $(CFLAGS) -o $@ $<
4329

4430
.PHONY: clean
4531
clean:
46-
rm -f obj/*.o obj/.depend rundb
32+
rm -f rundb $(OBJS) $(DEPS)

README

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ dbms benchmark has the following parameters in the config file. Parameters with
3737
PAGE_SIZE : memory page size
3838
CL_SIZE : cache line size
3939
WARMUP : number of transactions to run for warmup
40-
HW_MIGRATE : enable execution migration
4140

4241
WORKLOAD : workload supported (TPCC or YCSB)
4342

benchmarks/TPCC_full_schema.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,19 @@ TABLE=STOCK
110110
50,string,S_DATA
111111

112112
INDEX=ITEM_IDX
113-
ITEM,0
113+
ITEM,400000
114114

115115
INDEX=WAREHOUSE_IDX
116-
WAREHOUSE,0
116+
WAREHOUSE,100
117117

118118
INDEX=DISTRICT_IDX
119-
DISTRICT,0
119+
DISTRICT,1000
120120

121121
INDEX=CUSTOMER_ID_IDX
122-
CUSTOMER,0
122+
CUSTOMER,120000
123123

124124
INDEX=CUSTOMER_LAST_IDX
125-
CUSTOMER,0
125+
CUSTOMER,120000
126126

127127
INDEX=STOCK_IDX
128-
STOCK,0
129-
130-
INDEX=ORDER_IDX
131-
ORDER,0
132-
133-
INDEX=ORDER-LINE_IDX
134-
ORDER-LINE,0
128+
STOCK,400000

benchmarks/TPCC_short_schema.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,19 @@ TABLE=STOCK
8181
8,int64_t,S_REMOTE_CNT
8282

8383
INDEX=ITEM_IDX
84-
ITEM,0
84+
ITEM,10000
8585

8686
INDEX=WAREHOUSE_IDX
87-
WAREHOUSE,0
87+
WAREHOUSE,1
8888

8989
INDEX=DISTRICT_IDX
90-
DISTRICT,0
90+
DISTRICT,10
9191

9292
INDEX=CUSTOMER_ID_IDX
93-
CUSTOMER,0
93+
CUSTOMER,40000
9494

9595
INDEX=CUSTOMER_LAST_IDX
96-
CUSTOMER,0
96+
CUSTOMER,40000
9797

9898
INDEX=STOCK_IDX
99-
STOCK,0
100-
99+
STOCK,10000

benchmarks/YCSB_schema.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//size, type, name
22
TABLE=MAIN_TABLE
3-
100,string,F0
4-
100,string,F1
5-
100,string,F2
6-
100,string,F3
7-
100,string,F4
8-
100,string,F5
9-
100,string,F6
10-
100,string,F7
11-
100,string,F8
12-
100,string,F9
3+
10,string,F0
4+
10,string,F1
5+
10,string,F2
6+
10,string,F3
7+
10,string,F4
8+
10,string,F5
9+
10,string,F6
10+
10,string,F7
11+
10,string,F8
12+
10,string,F9
1313

1414
INDEX=MAIN_INDEX
1515
MAIN_TABLE,0

benchmarks/tpcc.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,22 @@ class tpcc_wl : public workload {
3131
INDEX * i_customer_last;
3232
INDEX * i_stock;
3333
INDEX * i_order; // key = (w_id, d_id, o_id)
34-
// INDEX * i_order_wdo; // key = (w_id, d_id, o_id)
35-
// INDEX * i_order_wdc; // key = (w_id, d_id, c_id)
3634
INDEX * i_orderline; // key = (w_id, d_id, o_id)
3735
INDEX * i_orderline_wd; // key = (w_id, d_id).
3836

39-
// XXX HACK
40-
// For delivary. Only one txn can be delivering a warehouse at a time.
41-
// *_delivering[warehouse_id] -> the warehouse is delivering.
4237
bool ** delivering;
43-
// bool volatile ** delivering;
44-
38+
uint32_t next_tid;
4539
private:
4640
uint64_t num_wh;
4741
void init_tab_item();
48-
void init_tab_wh();
42+
void init_tab_wh(uint32_t wid);
4943
void init_tab_dist(uint64_t w_id);
5044
void init_tab_stock(uint64_t w_id);
51-
// init_tab_cust initializes both tab_cust and tab_hist.
5245
void init_tab_cust(uint64_t d_id, uint64_t w_id);
5346
void init_tab_hist(uint64_t c_id, uint64_t d_id, uint64_t w_id);
5447
void init_tab_order(uint64_t d_id, uint64_t w_id);
5548

56-
UInt32 perm_count;
57-
uint64_t * perm_c_id;
58-
void init_permutation();
59-
uint64_t get_permutation();
49+
void init_permutation(uint64_t * perm_c_id, uint64_t wid);
6050

6151
static void * threadInitItem(void * This);
6252
static void * threadInitWh(void * This);
@@ -65,6 +55,8 @@ class tpcc_wl : public workload {
6555
static void * threadInitCust(void * This);
6656
static void * threadInitHist(void * This);
6757
static void * threadInitOrder(void * This);
58+
59+
static void * threadInitWarehouse(void * This);
6860
};
6961

7062
class tpcc_txn_man : public txn_man

benchmarks/tpcc_helper.cpp

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "tpcc_helper.h"
22

3+
drand48_data ** tpcc_buffer;
4+
35
uint64_t distKey(uint64_t d_id, uint64_t d_w_id) {
46
return d_w_id * DIST_PER_WARE + d_id;
57
}
@@ -20,26 +22,16 @@ uint64_t custNPKey(char * c_last, uint64_t c_d_id, uint64_t c_w_id) {
2022
uint64_t key = 0;
2123
char offset = 'A';
2224
for (uint32_t i = 0; i < strlen(c_last); i++)
23-
key = (key << 1) + (c_last[i] - offset);
24-
key = key << 10;
25+
key = (key << 2) + (c_last[i] - offset);
26+
key = key << 3;
2527
key += c_w_id * DIST_PER_WARE + c_d_id;
2628
return key;
2729
}
2830

2931
uint64_t stockKey(uint64_t s_i_id, uint64_t s_w_id) {
3032
return s_w_id * g_max_items + s_i_id;
3133
}
32-
/*
33-
uint64_t orderKey(uint64_t o_id, uint64_t o_d_id, uint64_t o_w_id) {
34-
return ((o_w_id * DIST_PER_WARE + o_d_id) * ORD_PER_DIST + o_id);
35-
}
36-
// the max of ol_number is 15. That's why there is a 15 here
37-
uint64_t olKey(uint64_t ol_o_id, uint64_t ol_d_id,
38-
uint64_t ol_w_id, uint64_t ol_number) {
39-
return ((ol_w_id * DIST_PER_WARE + ol_d_id) * ORD_PER_DIST + ol_o_id) * 15
40-
+ ol_number;
41-
}
42-
*/
34+
4335
uint64_t Lastname(uint64_t num, char* name) {
4436
static const char *n[] =
4537
{"BAR", "OUGHT", "ABLE", "PRI", "PRES",
@@ -50,15 +42,17 @@ uint64_t Lastname(uint64_t num, char* name) {
5042
return strlen(name);
5143
}
5244

53-
uint64_t RAND(uint64_t max) {
54-
return rand() % max;
45+
uint64_t RAND(uint64_t max, uint64_t thd_id) {
46+
int64_t rint64 = 0;
47+
lrand48_r(tpcc_buffer[thd_id], &rint64);
48+
return rint64 % max;
5549
}
5650

57-
uint64_t URand(uint64_t x, uint64_t y) {
58-
return x + RAND(y - x + 1);
51+
uint64_t URand(uint64_t x, uint64_t y, uint64_t thd_id) {
52+
return x + RAND(y - x + 1, thd_id);
5953
}
6054

61-
uint64_t NURand(uint64_t A, uint64_t x, uint64_t y) {
55+
uint64_t NURand(uint64_t A, uint64_t x, uint64_t y, uint64_t thd_id) {
6256
static bool C_255_init = false;
6357
static bool C_1023_init = false;
6458
static bool C_8191_init = false;
@@ -67,21 +61,21 @@ uint64_t NURand(uint64_t A, uint64_t x, uint64_t y) {
6761
switch(A) {
6862
case 255:
6963
if(!C_255_init) {
70-
C_255 = (uint64_t) URand(0,255);
64+
C_255 = (uint64_t) URand(0,255, thd_id);
7165
C_255_init = true;
7266
}
7367
C = C_255;
7468
break;
7569
case 1023:
7670
if(!C_1023_init) {
77-
C_1023 = (uint64_t) URand(0,1023);
71+
C_1023 = (uint64_t) URand(0,1023, thd_id);
7872
C_1023_init = true;
7973
}
8074
C = C_1023;
8175
break;
8276
case 8191:
8377
if(!C_8191_init) {
84-
C_8191 = (uint64_t) URand(0,8191);
78+
C_8191 = (uint64_t) URand(0,8191, thd_id);
8579
C_8191_init = true;
8680
}
8781
C = C_8191;
@@ -90,29 +84,29 @@ uint64_t NURand(uint64_t A, uint64_t x, uint64_t y) {
9084
M_ASSERT(false, "Error! NURand\n");
9185
exit(-1);
9286
}
93-
return(((URand(0,A) | URand(x,y))+C)%(y-x+1))+x;
87+
return(((URand(0,A, thd_id) | URand(x,y, thd_id))+C)%(y-x+1))+x;
9488
}
9589

96-
uint64_t MakeAlphaString(int min, int max, char* str) {
90+
uint64_t MakeAlphaString(int min, int max, char* str, uint64_t thd_id) {
9791
char char_list[] = {'1','2','3','4','5','6','7','8','9','a','b','c',
9892
'd','e','f','g','h','i','j','k','l','m','n','o',
9993
'p','q','r','s','t','u','v','w','x','y','z','A',
10094
'B','C','D','E','F','G','H','I','J','K','L','M',
10195
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
102-
uint64_t cnt = URand(min, max);
96+
uint64_t cnt = URand(min, max, thd_id);
10397
for (uint32_t i = 0; i < cnt; i++)
104-
str[i] = char_list[URand(0L, 60L)];
98+
str[i] = char_list[URand(0L, 60L, thd_id)];
10599
for (int i = cnt; i < max; i++)
106100
str[i] = '\0';
107101

108102
return cnt;
109103
}
110104

111-
uint64_t MakeNumberString(int min, int max, char* str) {
105+
uint64_t MakeNumberString(int min, int max, char* str, uint64_t thd_id) {
112106

113-
uint64_t cnt = URand(min, max);
107+
uint64_t cnt = URand(min, max, thd_id);
114108
for (UInt32 i = 0; i < cnt; i++) {
115-
uint64_t r = URand(0L,9L);
109+
uint64_t r = URand(0L,9L, thd_id);
116110
str[i] = '0' + r;
117111
}
118112
return cnt;

benchmarks/tpcc_helper.h

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#ifndef _TPCC_HELPER_H_
2-
#define _TPCC_HELPER_H_
3-
1+
#pragma once
42
#include "global.h"
53
#include "helper.h"
64

@@ -12,23 +10,17 @@ uint64_t orderPrimaryKey(uint64_t w_id, uint64_t d_id, uint64_t o_id);
1210
uint64_t custNPKey(char * c_last, uint64_t c_d_id, uint64_t c_w_id);
1311
uint64_t stockKey(uint64_t s_i_id, uint64_t s_w_id);
1412

15-
//uint64_t orderKey(uint64_t o_id, uint64_t o_d_id, uint64_t o_w_id);
16-
// the max of ol_number is 15. That's why there is a 15 here
17-
//uint64_t olKey(uint64_t ol_o_id, uint64_t ol_d_id,
18-
// uint64_t ol_w_id, uint64_t ol_number);
19-
2013
uint64_t Lastname(uint64_t num, char* name);
2114

15+
extern drand48_data ** tpcc_buffer;
2216
// return random data from [0, max-1]
23-
uint64_t RAND(uint64_t max);
17+
uint64_t RAND(uint64_t max, uint64_t thd_id);
2418
// random number from [x, y]
25-
uint64_t URand(uint64_t x, uint64_t y);
19+
uint64_t URand(uint64_t x, uint64_t y, uint64_t thd_id);
2620
// non-uniform random number
27-
uint64_t NURand(uint64_t A, uint64_t x, uint64_t y);
21+
uint64_t NURand(uint64_t A, uint64_t x, uint64_t y, uint64_t thd_id);
2822
// random string with random length beteen min and max.
29-
uint64_t MakeAlphaString(int min, int max, char * str);
30-
uint64_t MakeNumberString(int min, int max, char* str);
23+
uint64_t MakeAlphaString(int min, int max, char * str, uint64_t thd_id);
24+
uint64_t MakeNumberString(int min, int max, char* str, uint64_t thd_id);
3125

3226
uint64_t wh_to_part(uint64_t wid);
33-
34-
#endif

0 commit comments

Comments
 (0)