Repository navigation
Expand file tree
/
Copy pathconfig.h
More file actions
139 lines (129 loc) · 6.81 KB
/
Copy pathconfig.h
File metadata and controls
139 lines (129 loc) · 6.81 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <atomic>
#include "common.h"
/*********************** For common **********************/
// ! pay attention: need modify this when use different workload
// Max data item size.
// 8: smallbank
// 40: tatp
// 664: tpcc
// 40: micro-benchmark
#define MAX_ITEM_SIZE 8
#define ComputeNodeBufferPageSize 262144 // 262144*4KB = 1GB
#define BufferFusionSize ComputeNodeBufferPageSize
#define PartitionDataSize (ComputeNodeBufferPageSize / ComputeNodeCount)
#define MaxComputeNodeCount 128
#define GroupPageAffinitySize 100
// 定义算法版本 0: random 1: affinity 2: single 3: perfect
extern int SYSTEM_MODE;
extern int SeronMaxDelayUs; // modes 32/33: maximum page-conflict delay, in microseconds
extern int SeronRangeHistogramBins; // mode 33 only: latency-weighted range histogram
extern bool SeronRangeUseExecutionTime; // mode 33 only: use execution-time-weighted range histogram
extern bool SeronRuleConflictDetection; // mode 33 only; false preserves page detection
extern double SeronRuleHighConflictThreshold; // estimated conflict probability, [0,1]
extern bool SmallBankPermuteKeys; // opt-in workload transform, independent of system mode
extern uint64_t SmallBankKeyPermutationSeed;
extern bool TPCCPermuteWarehouses; // opt-in warehouse-ID relabeling, independent of system mode
extern uint64_t TPCCWarehousePermutationSeed;
extern bool TPCCShuffleWarehouseLoad;
extern uint64_t TPCCWarehouseLoadSeed;
extern bool TPCCRoutingDiagnostics; // default off; mode11 observation only
extern bool HotPageWeightedAffinity; // default off; mode11 window-local hot-page scoring
inline bool uses_seron_page_delay() { return SYSTEM_MODE == 32 || SYSTEM_MODE == 33; }
// 定义数据库类型 0: PostgreSQL 1: YashanDB 2: MySQL
extern int DB_TYPE;
// 定义所跑的workload 0:smallbank 1:tpcc
#define WORKLOAD_MODE 0 // 0: ycsb 1: tpcc
#define MP_ROUTER_TPCC_LEGACY 1 // 0: current TPC-C workload; 1: July 2026 legacy TPC-C workload
#define LOG_ACCESS_KEY 0 // 0: no log 1: log
#define LOG_FRIEND_GRAPH 0 // 0: no log 1: log
#define LOG_METIS_DECISION 0 // 0: no log 1: log
#define LOG_OWNERSHIP_CHANGE 0 // 0: no log 1: log
#define LOG_PAGE_UPDATE 0 // 0: no log 1: log
#define LOG_KROUTER_SCHEDULING_DEBUG 0 // 0: no log 1: log
#define LOG_METIS_OWNERSHIP_DECISION 0 // 0: no log 1: log
#define WORKLOAD_AFFINITY_MODE 1 // 0: key affinity 1: city-key affinity
#define SMALLBANK_SHUFFLE_CITY 0 // 0: legacy contiguous cities; 1: seeded, scattered account-to-city assignment
#define SMALLBANK_CITY_SEED 42ULL // city membership only; independent of key-access permutation and load order
#define SYS_8_DECISION_TYPE_COUNT 19 // for SYSTEM_MODE 8, 17 types of ownership changes
#define MLP_PREDICTION 0 // 0: no mlp prediction, just use key-value, 1: use mlp prediction
#define LOG_BATCH_ROUTER 0 // 0: no log 1: log
#define LOG_DEPENDENCY 0 // 0: no log 1: log
#define LOG_QUEUE_STATUS 0 // 0: no log 1: log
// Mode 11 only. Both safeguards default off to preserve previous experiments.
#ifndef MP_ROUTER_REGULAR_AGING
#define MP_ROUTER_REGULAR_AGING 0
#endif
#ifndef MP_ROUTER_REGULAR_MAX_WINDOW_GAP
#define MP_ROUTER_REGULAR_MAX_WINDOW_GAP 3 // critical head window minus regular head window
#endif
#ifndef MP_ROUTER_BARRIER_TIMEOUT
#define MP_ROUTER_BARRIER_TIMEOUT 0
#endif
#ifndef MP_ROUTER_BARRIER_MAX_WAIT_MS
#define MP_ROUTER_BARRIER_MAX_WAIT_MS 10000 // milliseconds since entry into the pending set
#endif
#define LOG_TXN_EXEC 0 // 0: no log 1: log
#define LOG_LOAD_BALANCE 0 // 0: no log 1: log
#define LOG_PREDICTION_RESULT 0 // 0: no log 1: log
#define LOG_CHIMERA_PHASE_SWITCH 1 // 0: no log 1: log
// for log
extern std::string partition_log_file_;
extern int worker_threads; // 每个计算节点的执行/数据库连接线程数
extern int RouterInternalThreads; // SmartRouter内部并行线程数;<=0 表示沿用 worker_threads
extern std::vector<std::string> DBConnection; // for PostgreSQL
extern std::vector<YashanConnInfo> YashanDBConnections; // for YashanDB
extern std::vector<MySQLConnInfo> MySQLConnections; // for MySQL
extern int ComputeNodeCount; // 计算节点数量
extern uint64_t ATTEMPTED_NUM;
extern int REGION_SIZE;
extern double AffinitySampleRate;
extern double AffinityTxnRatio;
extern uint64_t PARTITION_INTERVAL;
extern int MetisWarmupRound; // 这里表示初始情况下首先要先经过多少轮的metis分区,之后分区就不动了
extern bool WarmupEnd; // 标记是否完成了warmup阶段
extern int TxnPoolMaxSize; // 事务池的最大大小
extern int TxnQueueMaxSize; // 事务队列的最大大小
extern int BatchRouterProcessSize; // 每次批量路由处理的事务数量
extern int PreprocessBatchConcurrency; // 同时允许预处理的batch数量
extern int PreparedBatchQueueLimit; // 已预处理且等待调度的batch队列上限
extern int PreprocessInternalThreads; // 单个batch内部preprocess并行度;<=0 表示沿用RouterInternalThreads
extern int BatchExecutorPOPTxnSize; // 每次批量执行pop的事务数量
extern int PreExtendPageSize; // 预分配页面大小
extern int PreExtendIndexPageSize; // 预分配索引页面大小
extern bool LOAD_DATA_ONLY; // 仅加载数据模式
extern bool SKIP_LOAD_DATA; // 跳过加载数据模式
extern bool USE_UNLOGGED_TABLES; // 是否创建非日志表
extern bool DISABLE_TABLE_AUTOVACUUM; // 建表后是否关闭 autovacuum
extern std::vector<uint64_t> hottest_keys; // for debug
extern int NumBucket;
extern bool Enable_Long_Txn; // 是否启用长事务
extern int Long_Txn_Length; // 长事务的长度
extern int Long_Txn_Write_Pct; // 长事务中每个操作为写的概率百分比
extern double Key_Page_Map_Cache_Ratio; // 能缓存key-page映射的比例, 0.0-1.0
extern bool Enable_Fill_Pipeline_Bubble; // 是否启用batch router中的流水线气泡填充优化
extern bool Enable_Important_Router_Batch_Log; // 是否启用mode 11重要逐batch调度日志
// for TPC-C
extern int TPCC_WAREHOUSE_NUM;
extern bool TPCCPartitionWarehouses;
// global variables
extern int try_count;
extern std::atomic<int> exe_count;
extern std::atomic<uint64_t> committed_xact_count;
extern std::atomic<uint64_t> aborted_xact_count;
extern std::atomic<uint64_t> concurrency_retry_count;
extern std::atomic<uint64_t> concurrency_retry_exhausted_count;
extern std::atomic<int> generated_txn_count;
extern std::atomic<uint64_t> tx_id_generator;
extern int Workload_Type;
// for dynamic workload
extern bool dynamic_workload; // 是否启用动态workload
extern bool change_friend; // 是否改变朋友关系
extern std::atomic<bool> stop_benchmark; // 停止benchmark的标志
extern bool time_based_run; // 是否按时间窗口运行
extern int warmup_seconds; // time-based 模式预热秒数
extern int run_seconds; // time-based 模式正式运行秒数
extern int concurrency_retry_limit; // 并发回滚后,除初始执行外最多重试次数