sedna 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGES → CHANGES.rdoc} +9 -0
- data/{README → README.rdoc} +23 -25
- data/Rakefile +32 -9
- data/ext/{extconf.rb → sedna/extconf.rb} +33 -21
- data/ext/{sedna.c → sedna/sedna.c} +48 -40
- data/test/sedna_test.rb +9 -9
- data/vendor/sedna/AUTHORS +18 -0
- data/vendor/sedna/COPYRIGHT +90 -0
- data/vendor/sedna/LICENSE +202 -0
- data/vendor/sedna/Makefile.include +423 -0
- data/vendor/sedna/Makefile.platform +31 -0
- data/vendor/sedna/depend.sed +48 -0
- data/vendor/sedna/driver/c/Makefile +98 -0
- data/vendor/sedna/driver/c/libsedna.c +1998 -0
- data/vendor/sedna/driver/c/libsedna.h +199 -0
- data/vendor/sedna/driver/c/sednamt.def +21 -0
- data/vendor/sedna/driver/c/sp_defs.h +186 -0
- data/vendor/sedna/kernel/common/FastXptrHash.cpp +101 -0
- data/vendor/sedna/kernel/common/IntHash.h +314 -0
- data/vendor/sedna/kernel/common/IntList.h +224 -0
- data/vendor/sedna/kernel/common/Makefile +30 -0
- data/vendor/sedna/kernel/common/SSMMsg.cpp +459 -0
- data/vendor/sedna/kernel/common/SSMMsg.h +142 -0
- data/vendor/sedna/kernel/common/XptrHash.h +435 -0
- data/vendor/sedna/kernel/common/argtable.c +972 -0
- data/vendor/sedna/kernel/common/argtable.h +896 -0
- data/vendor/sedna/kernel/common/base.cpp +339 -0
- data/vendor/sedna/kernel/common/base.h +226 -0
- data/vendor/sedna/kernel/common/bit_set.cpp +157 -0
- data/vendor/sedna/kernel/common/bit_set.h +55 -0
- data/vendor/sedna/kernel/common/commutil.h +67 -0
- data/vendor/sedna/kernel/common/config.h +62 -0
- data/vendor/sedna/kernel/common/counted_ptr.h +74 -0
- data/vendor/sedna/kernel/common/errdbg/ErrorCodes.java +1056 -0
- data/vendor/sedna/kernel/common/errdbg/Makefile +34 -0
- data/vendor/sedna/kernel/common/errdbg/assert.c +133 -0
- data/vendor/sedna/kernel/common/errdbg/d_printf.c +150 -0
- data/vendor/sedna/kernel/common/errdbg/d_printf.h +91 -0
- data/vendor/sedna/kernel/common/errdbg/error.codes +1743 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes.c +531 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes.h +549 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes_scm.scm +527 -0
- data/vendor/sedna/kernel/common/errdbg/event_log.c +956 -0
- data/vendor/sedna/kernel/common/errdbg/event_log.h +226 -0
- data/vendor/sedna/kernel/common/errdbg/exceptions.cpp +155 -0
- data/vendor/sedna/kernel/common/errdbg/exceptions.h +559 -0
- data/vendor/sedna/kernel/common/errdbg/gen_error_codes +0 -0
- data/vendor/sedna/kernel/common/errdbg/gen_error_codes.c +345 -0
- data/vendor/sedna/kernel/common/gmm.cpp +192 -0
- data/vendor/sedna/kernel/common/gmm.h +29 -0
- data/vendor/sedna/kernel/common/ipc_ops.cpp +435 -0
- data/vendor/sedna/kernel/common/ipc_ops.h +51 -0
- data/vendor/sedna/kernel/common/lfsGlobals.h +12 -0
- data/vendor/sedna/kernel/common/lm_base.h +90 -0
- data/vendor/sedna/kernel/common/mmgr/Makefile +11 -0
- data/vendor/sedna/kernel/common/mmgr/aset.c +1185 -0
- data/vendor/sedna/kernel/common/mmgr/mcxt.c +741 -0
- data/vendor/sedna/kernel/common/mmgr/memnodes.h +70 -0
- data/vendor/sedna/kernel/common/mmgr/memutils.h +145 -0
- data/vendor/sedna/kernel/common/mmgr/se_alloc.h +321 -0
- data/vendor/sedna/kernel/common/mmgr/track.c +214 -0
- data/vendor/sedna/kernel/common/pping.cpp +672 -0
- data/vendor/sedna/kernel/common/pping.h +119 -0
- data/vendor/sedna/kernel/common/rcv_test.cpp +273 -0
- data/vendor/sedna/kernel/common/rcv_test.h +19 -0
- data/vendor/sedna/kernel/common/sedna.c +128 -0
- data/vendor/sedna/kernel/common/sedna.h +49 -0
- data/vendor/sedna/kernel/common/sedna_ef.h +52 -0
- data/vendor/sedna/kernel/common/sm_vmm_data.h +144 -0
- data/vendor/sedna/kernel/common/sp.c +93 -0
- data/vendor/sedna/kernel/common/sp.h +36 -0
- data/vendor/sedna/kernel/common/st/Makefile +20 -0
- data/vendor/sedna/kernel/common/st/os_linux/stacktrace.c +213 -0
- data/vendor/sedna/kernel/common/st/os_nt/stacktrace.c +338 -0
- data/vendor/sedna/kernel/common/st/os_other/stacktrace.c +39 -0
- data/vendor/sedna/kernel/common/st/stacktrace.h +72 -0
- data/vendor/sedna/kernel/common/st/stacktrfmt.c +64 -0
- data/vendor/sedna/kernel/common/tr_debug.cpp +112 -0
- data/vendor/sedna/kernel/common/tr_debug.h +22 -0
- data/vendor/sedna/kernel/common/u/Makefile +14 -0
- data/vendor/sedna/kernel/common/u/u.c +268 -0
- data/vendor/sedna/kernel/common/u/u.h +715 -0
- data/vendor/sedna/kernel/common/u/uatomic.h +12 -0
- data/vendor/sedna/kernel/common/u/udl.h +31 -0
- data/vendor/sedna/kernel/common/u/uevent.c +406 -0
- data/vendor/sedna/kernel/common/u/uevent.h +71 -0
- data/vendor/sedna/kernel/common/u/ugnames.cpp +330 -0
- data/vendor/sedna/kernel/common/u/ugnames.h +134 -0
- data/vendor/sedna/kernel/common/u/uhash_map.h +77 -0
- data/vendor/sedna/kernel/common/u/uhdd.c +1018 -0
- data/vendor/sedna/kernel/common/u/uhdd.h +206 -0
- data/vendor/sedna/kernel/common/u/ummap.cpp +268 -0
- data/vendor/sedna/kernel/common/u/ummap.h +60 -0
- data/vendor/sedna/kernel/common/u/umutex.c +145 -0
- data/vendor/sedna/kernel/common/u/umutex.h +65 -0
- data/vendor/sedna/kernel/common/u/upipe.cpp +244 -0
- data/vendor/sedna/kernel/common/u/upipe.h +74 -0
- data/vendor/sedna/kernel/common/u/uprocess.c +767 -0
- data/vendor/sedna/kernel/common/u/uprocess.h +91 -0
- data/vendor/sedna/kernel/common/u/usafesync.h +41 -0
- data/vendor/sedna/kernel/common/u/usecurity.c +150 -0
- data/vendor/sedna/kernel/common/u/usecurity.h +55 -0
- data/vendor/sedna/kernel/common/u/usem.c +891 -0
- data/vendor/sedna/kernel/common/u/usem.h +83 -0
- data/vendor/sedna/kernel/common/u/ushm.c +222 -0
- data/vendor/sedna/kernel/common/u/ushm.h +46 -0
- data/vendor/sedna/kernel/common/u/usocket.c +541 -0
- data/vendor/sedna/kernel/common/u/usocket.h +118 -0
- data/vendor/sedna/kernel/common/u/usystem.c +57 -0
- data/vendor/sedna/kernel/common/u/usystem.h +46 -0
- data/vendor/sedna/kernel/common/u/uthread.c +259 -0
- data/vendor/sedna/kernel/common/u/uthread.h +95 -0
- data/vendor/sedna/kernel/common/u/utime.c +65 -0
- data/vendor/sedna/kernel/common/u/utime.h +40 -0
- data/vendor/sedna/kernel/common/u/uutils.c +142 -0
- data/vendor/sedna/kernel/common/u/uutils.h +65 -0
- data/vendor/sedna/kernel/common/ugc.cpp +156 -0
- data/vendor/sedna/kernel/common/ugc.h +15 -0
- data/vendor/sedna/kernel/common/utils.cpp +156 -0
- data/vendor/sedna/kernel/common/utils.h +133 -0
- data/vendor/sedna/kernel/common/version.c +16 -0
- data/vendor/sedna/kernel/common/version.h +21 -0
- data/vendor/sedna/kernel/common/wustructures.h +18 -0
- data/vendor/sedna/kernel/common/wutypes.h +34 -0
- data/vendor/sedna/kernel/common/xptr.cpp +17 -0
- data/vendor/sedna/kernel/common/xptr.h +211 -0
- data/vendor/sedna/ver +1 -0
- metadata +142 -14
@@ -0,0 +1,339 @@
|
|
1
|
+
/*
|
2
|
+
* File: base.cpp
|
3
|
+
* Copyright (C) 2004 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
|
4
|
+
*/
|
5
|
+
|
6
|
+
|
7
|
+
#include <fstream>
|
8
|
+
#include "common/base.h"
|
9
|
+
#include "common/u/ugnames.h"
|
10
|
+
#include "common/u/uhdd.h"
|
11
|
+
#include "common/u/uprocess.h"
|
12
|
+
#include "common/errdbg/d_printf.h"
|
13
|
+
#include "common/u/uutils.h"
|
14
|
+
|
15
|
+
using namespace std;
|
16
|
+
|
17
|
+
void *LAYER_ADDRESS_SPACE_START_ADDR = NULL;
|
18
|
+
void *LAYER_ADDRESS_SPACE_BOUNDARY = NULL;
|
19
|
+
__uint32 LAYER_ADDRESS_SPACE_START_ADDR_INT = 0;
|
20
|
+
__uint32 LAYER_ADDRESS_SPACE_BOUNDARY_INT = 0;
|
21
|
+
|
22
|
+
__uint32 LAYER_ADDRESS_SPACE_SIZE = 0;
|
23
|
+
|
24
|
+
FILE* res_os = stdout; //otput stream of transaction results (result of the user's query)
|
25
|
+
|
26
|
+
/* global names */
|
27
|
+
|
28
|
+
#define POLICY_SINGLETON() NULL,1
|
29
|
+
#define POLICY_INSTANCE_PER_DB() "DB",(MAX_DBS_NUMBER)
|
30
|
+
#define POLICY_INSTANCE_PER_SESSION() "SES",(UPPER_SESSIONS_NUM_BOUND)
|
31
|
+
|
32
|
+
/* If you want to add a new global IPC object, do it here.
|
33
|
+
We are going to extract basenames automaticly, so don't
|
34
|
+
try anything unusual below and preserve markers. */
|
35
|
+
static UGlobalNamesRegistryItem globalNamesRegistry[] =
|
36
|
+
{
|
37
|
+
/* {% GlobalNamesRegistry */
|
38
|
+
{"SHMEM_GLOBAL", POLICY_SINGLETON()}, /* vmm region info + VMM placeholder when no buffer mapped */
|
39
|
+
|
40
|
+
{"SHMEM_GOV", POLICY_SINGLETON()}, /* holding system state and config info (gov_config_struct) */
|
41
|
+
|
42
|
+
{"SHMEM_EVENT_LOG", POLICY_SINGLETON()}, /* event logger */
|
43
|
+
{"SEMAR_EVENT_LOG", POLICY_SINGLETON()}, /* event logger */
|
44
|
+
|
45
|
+
{"SHMEM_BUFFERS", POLICY_INSTANCE_PER_DB()}, /* buffer memory */
|
46
|
+
{"SEMAP_BUFMGR_EXCL_MODE", POLICY_INSTANCE_PER_DB()}, /* regulates the exclusive mode entering by TRN */
|
47
|
+
{"SHMEM_BUFFERS_LRU", POLICY_INSTANCE_PER_DB()}, /* LRU stats on buffers usage */
|
48
|
+
|
49
|
+
// {"SHMEM_SHARED_HEAP", POLICY_INSTANCE_PER_DB()}, /* shared heap */
|
50
|
+
{"SEMAP_CATALOG_NAMETABLES", POLICY_INSTANCE_PER_DB()}, /* catalog nametables lock */
|
51
|
+
{"SEMAP_CATALOG_METADATA", POLICY_INSTANCE_PER_DB()}, /* catalog metadata lock */
|
52
|
+
|
53
|
+
{"SHMEM_SM_TALK", POLICY_INSTANCE_PER_DB()}, /* used by shared memory-based SM messaging interface */
|
54
|
+
{"SEMAR_SM_TALK", POLICY_INSTANCE_PER_DB()}, /* used by shared memory-based SM messaging interface */
|
55
|
+
|
56
|
+
{"SEMAP_VMM_INIT", POLICY_INSTANCE_PER_DB()}, /* VMM initialisation is serialised with this sem */
|
57
|
+
{"SHMEM_VMM_CALLBACK_PARAMS", POLICY_INSTANCE_PER_DB()}, /* parameters passed to VMM calback */
|
58
|
+
{"EVENT_VMM_CALLBACK", POLICY_INSTANCE_PER_SESSION()}, /* VMM callback thread waits on it */
|
59
|
+
{"EVENT_VMM_CALLBACK_COMPLETED", POLICY_INSTANCE_PER_SESSION()}, /* sem for callback thread to signal call completion */
|
60
|
+
|
61
|
+
// {"SEMAP_METADATA", POLICY_INSTANCE_PER_DB()}, /* synchronises access to metadata registry in PH */
|
62
|
+
// {"SEMAP_INDICES", POLICY_INSTANCE_PER_DB()}, /* synchronises access to indices registry in PH */
|
63
|
+
// {"SEMAP_FT_INDICES", POLICY_INSTANCE_PER_DB()}, /* synchronises access to full-text indices registry in PH */
|
64
|
+
// {"SEMAP_TRIGGERS", POLICY_INSTANCE_PER_DB()}, /* synchronises access to triggers registry in PH */
|
65
|
+
|
66
|
+
{"SEMAP_LOCKMGR", POLICY_INSTANCE_PER_DB()}, /* serialises requests to lock manager (in SM) */
|
67
|
+
{"EVENT_LOCK_GRANTED", POLICY_INSTANCE_PER_SESSION()}, /* if transaction request for a lock on DB entity is not satisfied immediately trn waits until the event is signalled (hence if transaction enters the wait state, it can't become a victim for the deadlock-resolution process) */
|
68
|
+
|
69
|
+
{"SEMAP_TRN_REGULATION", POLICY_INSTANCE_PER_DB()}, /* currently if checkpoint is active no updater transactions are allowed and vice-versa (earlier mutual exclusion applied to micro-ops but not transactions) */
|
70
|
+
{"EVENT_NEW_JOB_4_CHECKPOINT_THREAD", POLICY_INSTANCE_PER_DB()}, /* signals that a checkpoint must be activated or snapshots must be advanced */
|
71
|
+
{"EVENT_READONLY_TRN_COMPLETED", POLICY_INSTANCE_PER_DB()}, /* signals read-only transaction completion */
|
72
|
+
|
73
|
+
{"SHMEM_LFS", POLICY_INSTANCE_PER_DB()}, /* lfs state & buffer in shared memory */
|
74
|
+
{"SEMAP_LFS", POLICY_INSTANCE_PER_DB()}, /* synchronises operation with lfs */
|
75
|
+
{"SEMAP_CHECKPOINT_FINISHED", POLICY_INSTANCE_PER_DB()}, /* to wait for checkpoint to finish */
|
76
|
+
|
77
|
+
{"SHMEM_LOGICAL_LOG", POLICY_INSTANCE_PER_DB()}, /* logical log state & buffer in shared memory */
|
78
|
+
{"SEMAP_LOGICAL_LOG", POLICY_INSTANCE_PER_DB()}, /* synchronises operation with logical log */
|
79
|
+
|
80
|
+
{"EVENT_SM_SHUTDOWN_COMMAND", POLICY_INSTANCE_PER_DB()}, /* signaled by SSMMsg thread in SM when shutdown command arrives via messaging interface */
|
81
|
+
|
82
|
+
{"EVENT_RECOVERY_COMPLETED", POLICY_INSTANCE_PER_DB()}, /* signaled when se_rcv completes the recovery */
|
83
|
+
|
84
|
+
{"SEMAP_TRNS_TABLE", POLICY_INSTANCE_PER_DB()}, /* synchronises access to transactions table in SM */
|
85
|
+
|
86
|
+
{"EVENT_SM_READY", POLICY_INSTANCE_PER_DB()}, /* used to signal initialisation completion when starting SM in the background mode */
|
87
|
+
|
88
|
+
{"EVENT_GOV_READY", POLICY_SINGLETON()}, /* used to signal initialisation completion when starting GOV in the background mode */
|
89
|
+
|
90
|
+
/* %} */
|
91
|
+
{NULL}
|
92
|
+
};
|
93
|
+
|
94
|
+
void InitGlobalNames(int rangeBegin, int rangeEnd)
|
95
|
+
{
|
96
|
+
UInitGlobalNamesRegistry(globalNamesRegistry, NULL, rangeBegin, rangeEnd);
|
97
|
+
}
|
98
|
+
|
99
|
+
void ReleaseGlobalNames()
|
100
|
+
{
|
101
|
+
UReleaseGlobalNamesRegistry();
|
102
|
+
}
|
103
|
+
|
104
|
+
global_name CreateNameOfSmTalk(int databaseId, char *buf, size_t bufSize)
|
105
|
+
{
|
106
|
+
const char *namesVec[2];
|
107
|
+
char bufa[128], bufb[128];
|
108
|
+
|
109
|
+
namesVec[0] = UCreateGlobalName("SHMEM_SM_TALK", databaseId, bufa, 128);
|
110
|
+
namesVec[1] = UCreateGlobalName("SEMAR_SM_TALK", databaseId, bufb, 128);
|
111
|
+
|
112
|
+
return UCreateCompoundName(namesVec, 2, buf, bufSize);
|
113
|
+
}
|
114
|
+
|
115
|
+
global_name CreateNameOfEventVmmCalback(int sessionId, char *buf, size_t bufSize)
|
116
|
+
{
|
117
|
+
return UCreateGlobalName("EVENT_VMM_CALLBACK", sessionId, buf, bufSize);
|
118
|
+
}
|
119
|
+
|
120
|
+
global_name CreateNameOfEventVmmCalbackCompleted(int sessionId, char *buf, size_t bufSize)
|
121
|
+
{
|
122
|
+
return UCreateGlobalName("EVENT_VMM_CALLBACK_COMPLETED", sessionId, buf, bufSize);
|
123
|
+
}
|
124
|
+
|
125
|
+
global_name CreateNameOfEventLockGranted(int sessionId, char *buf, size_t bufSize)
|
126
|
+
{
|
127
|
+
return UCreateGlobalName("EVENT_LOCK_GRANTED", sessionId, buf, bufSize);
|
128
|
+
}
|
129
|
+
|
130
|
+
/* empty string is invalid as a global name but NULL is valid, so we use empty string as initializer */
|
131
|
+
global_name GOVERNOR_SHARED_MEMORY_NAME = "";
|
132
|
+
global_name CHARISMA_GOVERNOR_IS_READY = "";
|
133
|
+
global_name SE_EVENT_LOG_SHARED_MEMORY_NAME = "";
|
134
|
+
global_name SE_EVENT_LOG_SEMAPHORES_NAME = "";
|
135
|
+
global_name SEDNA_GLOBAL_MEMORY_MAPPING = "";
|
136
|
+
|
137
|
+
void SetGlobalNames()
|
138
|
+
{
|
139
|
+
static char
|
140
|
+
GOVERNOR_SHARED_MEMORY_NAME__buf__ [128],
|
141
|
+
CHARISMA_GOVERNOR_IS_READY__buf__ [128],
|
142
|
+
SE_EVENT_LOG_SHARED_MEMORY_NAME__buf__ [128],
|
143
|
+
SE_EVENT_LOG_SEMAPHORES_NAME__buf__ [128],
|
144
|
+
SEDNA_GLOBAL_MEMORY_MAPPING__buf__ [128];
|
145
|
+
|
146
|
+
GOVERNOR_SHARED_MEMORY_NAME =
|
147
|
+
UCreateGlobalName("SHMEM_GOV", 0, GOVERNOR_SHARED_MEMORY_NAME__buf__, 128);
|
148
|
+
|
149
|
+
CHARISMA_GOVERNOR_IS_READY =
|
150
|
+
UCreateGlobalName("EVENT_GOV_READY", 0, CHARISMA_GOVERNOR_IS_READY__buf__, 128);
|
151
|
+
|
152
|
+
SE_EVENT_LOG_SHARED_MEMORY_NAME =
|
153
|
+
UCreateGlobalName("SHMEM_EVENT_LOG", 0, SE_EVENT_LOG_SHARED_MEMORY_NAME__buf__, 128);
|
154
|
+
|
155
|
+
SE_EVENT_LOG_SEMAPHORES_NAME =
|
156
|
+
UCreateGlobalName("SEMAR_EVENT_LOG", 0, SE_EVENT_LOG_SEMAPHORES_NAME__buf__, 128);
|
157
|
+
|
158
|
+
SEDNA_GLOBAL_MEMORY_MAPPING =
|
159
|
+
UCreateGlobalName("SHMEM_GLOBAL", 0, SEDNA_GLOBAL_MEMORY_MAPPING__buf__, 128);
|
160
|
+
}
|
161
|
+
|
162
|
+
/* empty string is invalid as a global name but NULL is valid, so we use empty string as initializer */
|
163
|
+
global_name CHARISMA_SM_CALLBACK_SHARED_MEMORY_NAME = "";
|
164
|
+
global_name CHARISMA_BUFFER_SHARED_MEMORY_NAME = "";
|
165
|
+
global_name VMM_SM_SEMAPHORE_STR = "";
|
166
|
+
global_name VMM_SM_EXCLUSIVE_MODE_SEM_STR = "";
|
167
|
+
global_name SNAPSHOT_CHECKPOINT_EVENT = "";
|
168
|
+
global_name TRY_ADVANCE_SNAPSHOT_EVENT = "";
|
169
|
+
|
170
|
+
global_name CATALOG_NAMETABLE_SEMAPHORE_STR;
|
171
|
+
global_name CATALOG_MASTER_SEMAPHORE_STR;
|
172
|
+
|
173
|
+
//global_name METADATA_SEMAPHORE_STR = "";
|
174
|
+
//global_name INDEX_SEMAPHORE_STR = "";
|
175
|
+
//global_name FT_INDEX_SEMAPHORE_STR = "";
|
176
|
+
//global_name TRIGGER_SEMAPHORE_STR = "";
|
177
|
+
|
178
|
+
global_name SEDNA_LFS_SEM_NAME = "";
|
179
|
+
global_name SEDNA_LFS_SHARED_MEM_NAME = "";
|
180
|
+
global_name CHARISMA_LOGICAL_LOG_SHARED_MEM_NAME = "";
|
181
|
+
global_name CHARISMA_LOGICAL_LOG_PROTECTION_SEM_NAME = "";
|
182
|
+
global_name CHARISMA_CHECKPOINT_SEM = "";
|
183
|
+
global_name SEDNA_CHECKPOINT_FINISHED_SEM = "";
|
184
|
+
global_name SEDNA_TRNS_FINISHED = "";
|
185
|
+
global_name CHARISMA_WAIT_FOR_CHECKPOINT = "";
|
186
|
+
global_name CHARISMA_DB_RECOVERED_BY_LOGICAL_LOG = "";
|
187
|
+
global_name CHARISMA_SYNC_TRN_IDS_TABLE = "";
|
188
|
+
global_name CHARISMA_SM_WAIT_FOR_SHUTDOWN = "";
|
189
|
+
global_name CHARISMA_LRU_STAMP_SHARED_MEMORY_NAME = "";
|
190
|
+
global_name SEDNA_LOCK_MANAGER_SEM = "";
|
191
|
+
global_name CHARISMA_SM_SMSD_ID = "";
|
192
|
+
global_name CHARISMA_SM_IS_READY = "";
|
193
|
+
|
194
|
+
void SetGlobalNamesDB(int databaseId)
|
195
|
+
{
|
196
|
+
static char
|
197
|
+
CHARISMA_SM_CALLBACK_SHARED_MEMORY_NAME__buf__ [128],
|
198
|
+
CHARISMA_BUFFER_SHARED_MEMORY_NAME__buf__ [128],
|
199
|
+
VMM_SM_SEMAPHORE_STR__buf__ [128],
|
200
|
+
VMM_SM_EXCLUSIVE_MODE_SEM_STR__buf__ [128],
|
201
|
+
SNAPSHOT_CHECKPOINT_EVENT__buf__ [128],
|
202
|
+
SEDNA_CHECKPOINT_FINISHED_SEM__buf__ [128],
|
203
|
+
// METADATA_SEMAPHORE_STR__buf__ [128],
|
204
|
+
// INDEX_SEMAPHORE_STR__buf__ [128],
|
205
|
+
// FT_INDEX_SEMAPHORE_STR__buf__ [128],
|
206
|
+
// TRIGGER_SEMAPHORE_STR__buf__ [128],
|
207
|
+
CATALOG_NAMETABLE_SEMAPHORE_STR__buf__ [128],
|
208
|
+
CATALOG_MASTER_SEMAPHORE_STR__buf__ [128],
|
209
|
+
SEDNA_LFS_SEM_NAME__buf__ [128],
|
210
|
+
SEDNA_LFS_SHARED_MEM_NAME__buf__ [128],
|
211
|
+
CHARISMA_LOGICAL_LOG_SHARED_MEM_NAME__buf__ [128],
|
212
|
+
CHARISMA_LOGICAL_LOG_PROTECTION_SEM_NAME__buf__ [128],
|
213
|
+
SEDNA_TRNS_FINISHED__buf__ [128],
|
214
|
+
TRY_ADVANCE_SNAPSHOT_EVENT__buf__ [128],
|
215
|
+
CHARISMA_DB_RECOVERED_BY_LOGICAL_LOG__buf__ [128],
|
216
|
+
CHARISMA_SYNC_TRN_IDS_TABLE__buf__ [128],
|
217
|
+
CHARISMA_SM_WAIT_FOR_SHUTDOWN__buf__ [128],
|
218
|
+
CHARISMA_LRU_STAMP_SHARED_MEMORY_NAME__buf__ [128],
|
219
|
+
SEDNA_LOCK_MANAGER_SEM__buf__ [128],
|
220
|
+
CHARISMA_SM_IS_READY__buf__ [128];
|
221
|
+
|
222
|
+
CHARISMA_SM_CALLBACK_SHARED_MEMORY_NAME =
|
223
|
+
UCreateGlobalName("SHMEM_VMM_CALLBACK_PARAMS", databaseId, CHARISMA_SM_CALLBACK_SHARED_MEMORY_NAME__buf__, 128);
|
224
|
+
|
225
|
+
CHARISMA_BUFFER_SHARED_MEMORY_NAME =
|
226
|
+
UCreateGlobalName("SHMEM_BUFFERS", databaseId, CHARISMA_BUFFER_SHARED_MEMORY_NAME__buf__, 128);
|
227
|
+
|
228
|
+
VMM_SM_SEMAPHORE_STR =
|
229
|
+
UCreateGlobalName("SEMAP_VMM_INIT", databaseId, VMM_SM_SEMAPHORE_STR__buf__, 128);
|
230
|
+
|
231
|
+
VMM_SM_EXCLUSIVE_MODE_SEM_STR =
|
232
|
+
UCreateGlobalName("SEMAP_BUFMGR_EXCL_MODE", databaseId, VMM_SM_EXCLUSIVE_MODE_SEM_STR__buf__, 128);
|
233
|
+
|
234
|
+
SNAPSHOT_CHECKPOINT_EVENT =
|
235
|
+
UCreateGlobalName("EVENT_NEW_JOB_4_CHECKPOINT_THREAD", databaseId, SNAPSHOT_CHECKPOINT_EVENT__buf__, 128);
|
236
|
+
|
237
|
+
TRY_ADVANCE_SNAPSHOT_EVENT =
|
238
|
+
UCreateGlobalName("EVENT_READONLY_TRN_COMPLETED", databaseId, TRY_ADVANCE_SNAPSHOT_EVENT__buf__, 128);
|
239
|
+
|
240
|
+
SEDNA_CHECKPOINT_FINISHED_SEM =
|
241
|
+
UCreateGlobalName("SEMAP_CHECKPOINT_FINISHED", databaseId, SEDNA_CHECKPOINT_FINISHED_SEM__buf__, 128);
|
242
|
+
/*
|
243
|
+
|
244
|
+
METADATA_SEMAPHORE_STR =
|
245
|
+
UCreateGlobalName("SEMAP_METADATA", databaseId, METADATA_SEMAPHORE_STR__buf__, 128);
|
246
|
+
|
247
|
+
INDEX_SEMAPHORE_STR =
|
248
|
+
UCreateGlobalName("SEMAP_INDICES", databaseId, INDEX_SEMAPHORE_STR__buf__, 128);
|
249
|
+
|
250
|
+
FT_INDEX_SEMAPHORE_STR =
|
251
|
+
UCreateGlobalName("SEMAP_FT_INDICES", databaseId, FT_INDEX_SEMAPHORE_STR__buf__, 128);
|
252
|
+
|
253
|
+
TRIGGER_SEMAPHORE_STR =
|
254
|
+
UCreateGlobalName("SEMAP_TRIGGERS", databaseId, TRIGGER_SEMAPHORE_STR__buf__, 128);
|
255
|
+
*/
|
256
|
+
|
257
|
+
CATALOG_NAMETABLE_SEMAPHORE_STR =
|
258
|
+
UCreateGlobalName("SEMAP_CATALOG_NAMETABLES", databaseId, CATALOG_NAMETABLE_SEMAPHORE_STR__buf__, 128);
|
259
|
+
|
260
|
+
CATALOG_MASTER_SEMAPHORE_STR =
|
261
|
+
UCreateGlobalName("SEMAP_CATALOG_METADATA", databaseId, CATALOG_MASTER_SEMAPHORE_STR__buf__, 128);
|
262
|
+
|
263
|
+
SEDNA_LFS_SEM_NAME =
|
264
|
+
UCreateGlobalName("SEMAP_LFS", databaseId, SEDNA_LFS_SEM_NAME__buf__, 128);
|
265
|
+
|
266
|
+
SEDNA_LFS_SHARED_MEM_NAME =
|
267
|
+
UCreateGlobalName("SHMEM_LFS", databaseId, SEDNA_LFS_SHARED_MEM_NAME__buf__, 128);
|
268
|
+
|
269
|
+
CHARISMA_LOGICAL_LOG_SHARED_MEM_NAME =
|
270
|
+
UCreateGlobalName("SHMEM_LOGICAL_LOG", databaseId, CHARISMA_LOGICAL_LOG_SHARED_MEM_NAME__buf__, 128);
|
271
|
+
|
272
|
+
CHARISMA_LOGICAL_LOG_PROTECTION_SEM_NAME =
|
273
|
+
UCreateGlobalName("SEMAP_LOGICAL_LOG", databaseId, CHARISMA_LOGICAL_LOG_PROTECTION_SEM_NAME__buf__, 128);
|
274
|
+
|
275
|
+
SEDNA_TRNS_FINISHED =
|
276
|
+
UCreateGlobalName("SEMAP_TRN_REGULATION", databaseId, SEDNA_TRNS_FINISHED__buf__, 128);
|
277
|
+
|
278
|
+
CHARISMA_DB_RECOVERED_BY_LOGICAL_LOG =
|
279
|
+
UCreateGlobalName("EVENT_RECOVERY_COMPLETED", databaseId, CHARISMA_DB_RECOVERED_BY_LOGICAL_LOG__buf__, 128);
|
280
|
+
|
281
|
+
CHARISMA_SYNC_TRN_IDS_TABLE =
|
282
|
+
UCreateGlobalName("SEMAP_TRNS_TABLE", databaseId, CHARISMA_SYNC_TRN_IDS_TABLE__buf__, 128);
|
283
|
+
|
284
|
+
CHARISMA_SM_WAIT_FOR_SHUTDOWN =
|
285
|
+
UCreateGlobalName("EVENT_SM_SHUTDOWN_COMMAND", databaseId, CHARISMA_SM_WAIT_FOR_SHUTDOWN__buf__, 128);
|
286
|
+
|
287
|
+
CHARISMA_LRU_STAMP_SHARED_MEMORY_NAME =
|
288
|
+
UCreateGlobalName("SHMEM_BUFFERS_LRU", databaseId, CHARISMA_LRU_STAMP_SHARED_MEMORY_NAME__buf__, 128);
|
289
|
+
|
290
|
+
SEDNA_LOCK_MANAGER_SEM =
|
291
|
+
UCreateGlobalName("SEMAP_LOCKMGR", databaseId, SEDNA_LOCK_MANAGER_SEM__buf__, 128);
|
292
|
+
|
293
|
+
CHARISMA_SM_IS_READY =
|
294
|
+
UCreateGlobalName("EVENT_SM_READY", databaseId, CHARISMA_SM_IS_READY__buf__, 128);
|
295
|
+
};
|
296
|
+
|
297
|
+
|
298
|
+
/* The following chars are allowed:
|
299
|
+
* ! (0x21), # (0x23), % (0x25), & (0x26), ( (0x28), ) (0x29),
|
300
|
+
* + (0x2B), , (0x2C), - (0x2D), . (0x2E), 0-9 (0x30 - 0x39),
|
301
|
+
* ; (0x3B), = (0x3D), @ (0x40), A-Z (0x41-0x5A), [ (5B), ] (5D),
|
302
|
+
* ^ (0x5E), _ (0x5F), ` (0x60), a-z (0x61-0x7A), { (0x7B),
|
303
|
+
* } (0x7D), ~ (0x7E) */
|
304
|
+
static const unsigned char
|
305
|
+
database_name_map[16] = {0x00, 0x00, 0x00, 0x00,
|
306
|
+
0x56, 0xDE, 0xFF, 0xD4,
|
307
|
+
0xFF, 0xFF, 0xFF, 0xF7,
|
308
|
+
0xFF, 0xFF, 0xFF, 0xF6};
|
309
|
+
|
310
|
+
|
311
|
+
/* Is char is allowed within a database name */
|
312
|
+
#define DATABASE_NAME_ALLOWED_BYTE(byte) \
|
313
|
+
((byte) & 0x80 ? 0 : (database_name_map[((byte) >> 3)] & (0x80 >> ((byte) & 7))))
|
314
|
+
|
315
|
+
|
316
|
+
void check_db_name_validness(const char* name)
|
317
|
+
{
|
318
|
+
if (NULL == name)
|
319
|
+
throw USER_EXCEPTION2(SE1003,
|
320
|
+
"database name validation failed (null database name was given)");
|
321
|
+
|
322
|
+
int len = strlen(name);
|
323
|
+
int counter = 0;
|
324
|
+
|
325
|
+
/* Name must contain at least one symbol and its length must
|
326
|
+
* be less or equal than MAX_DATABASE_NAME_LENGTH */
|
327
|
+
if (len < 1 || len > MAX_DATABASE_NAME_LENGTH)
|
328
|
+
throw USER_EXCEPTION2(SE4307, "empty or too long database name");
|
329
|
+
|
330
|
+
while(counter < len)
|
331
|
+
{
|
332
|
+
unsigned char c = name[counter];
|
333
|
+
if(DATABASE_NAME_ALLOWED_BYTE(c))
|
334
|
+
counter++;
|
335
|
+
else
|
336
|
+
throw USER_EXCEPTION2(SE4307, name);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/*
|
2
|
+
* File: base.h
|
3
|
+
* Copyright (C) 2004 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
|
4
|
+
*/
|
5
|
+
|
6
|
+
|
7
|
+
#ifndef _BASE_H
|
8
|
+
#define _BASE_H
|
9
|
+
|
10
|
+
#include <string>
|
11
|
+
#include <vector>
|
12
|
+
|
13
|
+
#include "common/sedna.h"
|
14
|
+
|
15
|
+
#include "common/utils.h"
|
16
|
+
#include "common/rcv_test.h"
|
17
|
+
#include "common/wutypes.h"
|
18
|
+
|
19
|
+
|
20
|
+
#define SEDNA_DATA_STRUCTURES_VER 9
|
21
|
+
|
22
|
+
// buffer memory offset; this type is used for addressing buffers in buffer
|
23
|
+
// memory area by defining offset of buffer from the beginning of the shared
|
24
|
+
// memory
|
25
|
+
typedef int ramoffs;
|
26
|
+
#define RAMOFFS_OUT_OFF_BOUNDS INT_MAX
|
27
|
+
|
28
|
+
//typedef __int64 LSN;
|
29
|
+
//typedef long LSN;
|
30
|
+
//typedef __int64 LONG_LSN;
|
31
|
+
typedef __uint32 CP_counter;
|
32
|
+
//#define NULL_LSN (-1)
|
33
|
+
#define NULL_FILE (-1)
|
34
|
+
|
35
|
+
#define MAX_FILE_SIZE_WITHOUT_CHECKPOINT 50*(1024*1024)
|
36
|
+
|
37
|
+
|
38
|
+
#define SEDNA_NAMESPACE_URI "http://www.modis.ispras.ru/sedna"
|
39
|
+
#define SEDNA_NAMESPACE_PREFIX "se"
|
40
|
+
|
41
|
+
typedef int session_id;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Transaction identifier
|
45
|
+
*/
|
46
|
+
typedef int transaction_id;
|
47
|
+
|
48
|
+
#define MAX_RESOURCE_NAME_LENGTH 100
|
49
|
+
#define MAX_DATABASE_NAME_LENGTH 100
|
50
|
+
|
51
|
+
|
52
|
+
/* shift in the block */
|
53
|
+
typedef unsigned short int shft;
|
54
|
+
|
55
|
+
#define PAGE_SIZE 65536
|
56
|
+
#define PAGE_BIT_SIZE 16
|
57
|
+
#define PAGE_BIT_MASK (__uint32)0xFFFF0000
|
58
|
+
#define PAGE_REVERSE_BIT_MASK (__uint32)0x0000FFFF
|
59
|
+
|
60
|
+
|
61
|
+
extern void *LAYER_ADDRESS_SPACE_START_ADDR;
|
62
|
+
extern void *LAYER_ADDRESS_SPACE_BOUNDARY;
|
63
|
+
extern uint32_t LAYER_ADDRESS_SPACE_START_ADDR_INT;
|
64
|
+
extern uint32_t LAYER_ADDRESS_SPACE_BOUNDARY_INT;
|
65
|
+
|
66
|
+
extern uint32_t LAYER_ADDRESS_SPACE_SIZE;
|
67
|
+
|
68
|
+
struct vmm_region_values
|
69
|
+
{
|
70
|
+
__uint32 LAYER_ADDRESS_SPACE_START_ADDR_INT;
|
71
|
+
__uint32 LAYER_ADDRESS_SPACE_BOUNDARY_INT;
|
72
|
+
__uint32 LAYER_ADDRESS_SPACE_SIZE;
|
73
|
+
};
|
74
|
+
|
75
|
+
#define VMM_REGION_SEARCH_MAX_SIZE ((__uint32)0x79C00000)
|
76
|
+
#define VMM_REGION_MIN_SIZE ((__uint32)0x4000000)
|
77
|
+
#define VMM_REGION_MAX_SIZE ((__uint32)0x40000000)
|
78
|
+
|
79
|
+
#define TR_AUTHENTICATION_FLAG 1
|
80
|
+
#define TR_AUTHORIZATION_FLAG 2
|
81
|
+
|
82
|
+
#ifdef _WIN32
|
83
|
+
#define SESSION_EXE "se_trn.exe"
|
84
|
+
#else
|
85
|
+
#define SESSION_EXE "se_trn"
|
86
|
+
#endif
|
87
|
+
|
88
|
+
|
89
|
+
#define MODULES_COLLECTION_NAME "$modules"
|
90
|
+
|
91
|
+
/*
|
92
|
+
Global Names section */
|
93
|
+
|
94
|
+
void InitGlobalNames(int rangeBegin, int rangeEnd);
|
95
|
+
|
96
|
+
void ReleaseGlobalNames();
|
97
|
+
|
98
|
+
global_name CreateNameOfSmTalk(int databaseId, char *buf, size_t bufSize);
|
99
|
+
|
100
|
+
global_name CreateNameOfEventVmmCalback(int sessionId, char *buf, size_t bufSize);
|
101
|
+
|
102
|
+
global_name CreateNameOfEventVmmCalbackCompleted(int sessionId, char *buf, size_t bufSize);
|
103
|
+
|
104
|
+
global_name CreateNameOfEventLockGranted(int sessionId, char *buf, size_t bufSize);
|
105
|
+
|
106
|
+
void SetGlobalNames();
|
107
|
+
|
108
|
+
void SetGlobalNamesDB(int databaseId);
|
109
|
+
|
110
|
+
#define SM_TO_VMM_CALLBACK_SEM1_BASE_STR(SID,BUF,BUFSZ) \
|
111
|
+
CreateNameOfEventVmmCalback((SID),(BUF),(BUFSZ))
|
112
|
+
|
113
|
+
#define SM_TO_VMM_CALLBACK_SEM2_BASE_STR(SID,BUF,BUFSZ) \
|
114
|
+
CreateNameOfEventVmmCalbackCompleted((SID),(BUF),(BUFSZ))
|
115
|
+
|
116
|
+
#define SEDNA_TRANSACTION_LOCK(SID,BUF,BUFSZ) \
|
117
|
+
CreateNameOfEventLockGranted((SID),(BUF),(BUFSZ))
|
118
|
+
|
119
|
+
#define CHARISMA_SSMMSG_SM_ID(DB,BUF,BUFSZ) \
|
120
|
+
CreateNameOfSmTalk((DB),(BUF),(BUFSZ))
|
121
|
+
|
122
|
+
extern global_name CHARISMA_BUFFER_SHARED_MEMORY_NAME;
|
123
|
+
extern global_name SEDNA_GLOBAL_MEMORY_MAPPING;
|
124
|
+
extern global_name CHARISMA_SM_CALLBACK_SHARED_MEMORY_NAME;
|
125
|
+
extern global_name VMM_SM_SEMAPHORE_STR;
|
126
|
+
extern global_name VMM_SM_EXCLUSIVE_MODE_SEM_STR;
|
127
|
+
extern global_name SNAPSHOT_CHECKPOINT_EVENT;
|
128
|
+
extern global_name TRY_ADVANCE_SNAPSHOT_EVENT;
|
129
|
+
|
130
|
+
extern global_name CATALOG_NAMETABLE_SEMAPHORE_STR;
|
131
|
+
extern global_name CATALOG_MASTER_SEMAPHORE_STR;
|
132
|
+
|
133
|
+
#ifdef SE_ENABLE_FTSEARCH
|
134
|
+
//extern global_name FT_INDEX_SEMAPHORE_STR;
|
135
|
+
#endif
|
136
|
+
|
137
|
+
#ifdef SE_ENABLE_TRIGGERS
|
138
|
+
//extern global_name TRIGGER_SEMAPHORE_STR;
|
139
|
+
#endif
|
140
|
+
|
141
|
+
extern global_name CHARISMA_SSMMSG_GOV_ID;
|
142
|
+
extern global_name CHARISMA_GOVERNOR_IS_READY;
|
143
|
+
extern global_name SEDNA_LFS_SEM_NAME;
|
144
|
+
extern global_name SEDNA_LFS_SHARED_MEM_NAME;
|
145
|
+
extern global_name CHARISMA_LOGICAL_LOG_SHARED_MEM_NAME;
|
146
|
+
extern global_name CHARISMA_LOGICAL_LOG_PROTECTION_SEM_NAME;
|
147
|
+
extern global_name CHARISMA_SM_WAIT_FOR_SHUTDOWN;
|
148
|
+
extern global_name CHARISMA_CHECKPOINT_SEM;
|
149
|
+
extern global_name SEDNA_CHECKPOINT_FINISHED_SEM;
|
150
|
+
extern global_name SEDNA_TRNS_FINISHED;
|
151
|
+
extern global_name CHARISMA_WAIT_FOR_CHECKPOINT;
|
152
|
+
extern global_name CHARISMA_DB_RECOVERED_BY_LOGICAL_LOG;
|
153
|
+
extern global_name CHARISMA_SYNC_TRN_IDS_TABLE;
|
154
|
+
extern global_name CHARISMA_LRU_STAMP_SHARED_MEMORY_NAME;
|
155
|
+
extern global_name GOVERNOR_SHARED_MEMORY_NAME;
|
156
|
+
extern global_name SEDNA_LOCK_MANAGER_SEM;
|
157
|
+
extern global_name SE_EVENT_LOG_SHARED_MEMORY_NAME;
|
158
|
+
extern global_name SE_EVENT_LOG_SEMAPHORES_NAME;
|
159
|
+
extern global_name CHARISMA_SM_SMSD_ID;
|
160
|
+
extern global_name CHARISMA_SM_IS_READY;
|
161
|
+
|
162
|
+
#define TRIGGER_MAX_CASCADING_LEVEL 10
|
163
|
+
|
164
|
+
#define SM_NUMBER_OF_SERVER_THREADS 1
|
165
|
+
|
166
|
+
#define GOV_NUMBER_OF_SERVER_THREADS 1
|
167
|
+
|
168
|
+
#define SEDNA_DETERMINE_VMM_REGION "SEDNA_DETERMINE_VMM_REGION"
|
169
|
+
#define CONNECTION_SOCKET_HANDLE "CONNECTION_SOCKET_HANDLE"
|
170
|
+
#define SEDNA_SERVER_MODE "SEDNA_SERVER_MODE"
|
171
|
+
|
172
|
+
#define SEDNA_LOAD_METADATA_TRANSACTION "SEDNA_LOAD_METADATA_TRANSACTION"
|
173
|
+
|
174
|
+
#define SEDNA_OS_PRIMITIVES_ID_MIN_BOUND "SEDNA_OS_PRIMITIVES_ID_MIN_BOUND"
|
175
|
+
|
176
|
+
#define SEDNA_RUN_RECOVERY_TRANSACTION "SEDNA_RUN_RECOVERY_TRANSACTION"
|
177
|
+
|
178
|
+
#define SECURITY_METADATA_DOCUMENT "$db_security_data"
|
179
|
+
#define INITIAL_SECURITY_METADATA_FILE_NAME "sedna_auth_md.xml"
|
180
|
+
|
181
|
+
#define CHARISMA_MAX_TRNS_NUMBER 50
|
182
|
+
#define MAX_SESSIONS_NUMBER 50
|
183
|
+
#define MAX_DBS_NUMBER 10
|
184
|
+
|
185
|
+
typedef uint64_t strsize_t;
|
186
|
+
|
187
|
+
#define STRMAXSIZE 4000000000lu
|
188
|
+
|
189
|
+
#define UPPER_SESSIONS_NUM_BOUND 100
|
190
|
+
|
191
|
+
void check_db_name_validness(const char* name);
|
192
|
+
|
193
|
+
extern FILE* res_os;
|
194
|
+
|
195
|
+
/* The following parameters are related to kernel<-->transaction protocol */
|
196
|
+
#define ERR_SYMBOL ((char)254)
|
197
|
+
#define DELIM_SYMBOL ((char)250)
|
198
|
+
#define EOD_SYMBOL ((char)253)
|
199
|
+
#define EOALL_SYMBOL ((char)252)
|
200
|
+
|
201
|
+
/* Command definitions for governor */
|
202
|
+
enum commands
|
203
|
+
{
|
204
|
+
CREATE_NEW_SESSION = 110,
|
205
|
+
STOP = 501,
|
206
|
+
REGISTER_NEW_SESSION = 121,
|
207
|
+
REGISTER_DB = 122,
|
208
|
+
RUNTIME_CONFIG = 600,
|
209
|
+
HOTBACKUP_START = 666,
|
210
|
+
IS_RUN_SM = 888
|
211
|
+
};
|
212
|
+
|
213
|
+
/* Defines variouse kinds of se_stop command */
|
214
|
+
enum stoptype
|
215
|
+
{
|
216
|
+
SE_STOP_NO = 0, /// sedna operates
|
217
|
+
SE_STOP_SOFT = 1, /// wait for transactions are completed
|
218
|
+
SE_STOP_HARD = 2 /// attempts to immediately rollback all running transactions.
|
219
|
+
};
|
220
|
+
|
221
|
+
/* The following definitions are related to gov<-->rc protocol */
|
222
|
+
#define SE_RC_VALID ((char)1)
|
223
|
+
#define SE_RC_INVALID ((char)0)
|
224
|
+
#define SE_RC_OVERFLOW ((char)2)
|
225
|
+
|
226
|
+
#endif
|