File: cl_stubs.c

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (286 lines) | stat: -rw-r--r-- 5,963 bytes parent folder | download | duplicates (2)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/*
 *  $Id$
 *
 *  Cluster stubs
 *
 *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 *  project.
 *
 *  Copyright (C) 1998-2012 OpenLink Software
 *
 *  This project is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; only version 2 of the License, dated June 1991.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#include "libutil.h"
#include "sqlnode.h"
#include "sqlver.h"

#include "sqlpar.h"
#include "sqlcmps.h"
#include "sqlintrp.h"
#include "sqlbif.h"
#include "arith.h"
#include "security.h"
#include "sqlo.h"


#define NO_CLUSTER 	GPF_T1 ("This build does not include cluster support.")


/*
 *  Globals
 */
cl_listener_t local_cll;
cluster_map_t *clm_replicated;

int cluster_enable = 0;
int enable_dfg_print = 0;
int enable_dfg = 1;
int enable_setp_partition;
int enable_multistate_code = 0;

int32 c_cluster_threads;
int32 cl_batches_per_rpc;
int32 cl_con_drop_rate;
int32 cl_dead_w_interval = 12000;
int32 cl_dfg_batch_bytes = 10000000;
int32 cl_keep_alive_interval = 3000;
int32 cl_max_hosts = 100;
int32 cl_max_keep_alives_missed = 4;
int32 cl_msg_drop_rate;
int32 cl_n_hosts;
int32 cl_non_logged_write_mode;
int32 cl_req_batch_size;	/* no of request clo's per message */
int32 cl_res_buffer_bytes;	/* no of bytes before sending to client */
int32 cl_stage;
int32 cl_wait_query_delay = 20000;	/* wait 20s before requesting forced sync of cluster wait graph */
int32 cl_dead_w_interval;

int64 cl_cum_messages, cl_cum_bytes, cl_cum_txn_messages;
int64 cl_cum_wait, cl_cum_wait_msec;

resource_t *cluster_threads;

uint32 cl_last_wait_query;
uint32 cl_send_high_water;




/*
 *  Stub functions
 */

cl_op_t *
clo_allocate (char op)
{
  cl_op_t *clo = dk_alloc_box_zero (sizeof (cl_op_t), DV_CLOP);
  clo->clo_op = op;
  return clo;
}


int
clo_destroy (cl_op_t * clo)
{
  dk_set_free (clo->clo_clibs);
  switch (clo->clo_op)
    {
    case CLO_ITCL:
      if (!clo->_.itcl.itcl)
	break;
      mp_free (clo->_.itcl.itcl->itcl_pool);
      dk_free ((caddr_t) clo->_.itcl.itcl, sizeof (itc_cluster_t));
      break;

    default:
      NO_CLUSTER;
    }
  return 0;
}


cu_func_t *
cu_func (caddr_t name, int must_find)
{
  return NULL;
}


caddr_t
cl_ddl (query_instance_t * qi, lock_trx_t * lt, caddr_t name, int type, caddr_t trig_table)
{
  return NULL;
}


void
lt_send_rollbacks (lock_trx_t * lt, int sync)
{
}


void
query_frag_input (query_frag_t * qf, caddr_t * inst, caddr_t * state)
{
  NO_CLUSTER;
}


void
lt_expedite_1pc (lock_trx_t * lt)
{
  NO_CLUSTER;
}


void
cl_ts_set_context (table_source_t * ts, itc_cluster_t * itcl, caddr_t * inst, int nth_set)
{
  int inx;
  caddr_t *row = ((caddr_t **) itcl->itcl_param_rows)[nth_set];
  DO_BOX (state_slot_t *, ssl, inx, ts->clb.clb_save)
  {
    qst_set_over (inst, ssl, row[inx + 1]);
  }
  END_DO_BOX;
  if (ts->clb.clb_nth_context)
    QST_INT (inst, ts->clb.clb_nth_context) = nth_set;
}


itc_cluster_t *
itcl_allocate (lock_trx_t * lt, caddr_t * inst)
{
  NEW_VARZ (itc_cluster_t, itcl);
  itcl->itcl_qst = inst;
  itcl->itcl_pool = mem_pool_alloc ();
  return itcl;
}


#define CL_INIT_BATCH_SIZE 100


void
cl_select_save_env (table_source_t * ts, itc_cluster_t * itcl, caddr_t * inst, cl_op_t * clo, int nth)
{
  caddr_t **array = (caddr_t **) itcl->itcl_param_rows;
  caddr_t *row;
  int inx, n_save;
  if (!array)
    {
      itcl->itcl_param_rows = (cl_op_t ***) (array =
	  (caddr_t **) mp_alloc_box_ni (itcl->itcl_pool, CL_INIT_BATCH_SIZE * sizeof (caddr_t), DV_ARRAY_OF_POINTER));
    }
  else if (BOX_ELEMENTS (array) <= nth)
    {
      caddr_t new_array = mp_alloc_box_ni (itcl->itcl_pool, ts->clb.clb_batch_size * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
      memcpy (new_array, array, box_length (array));
      itcl->itcl_param_rows = (cl_op_t ***) (array = (caddr_t **) new_array);
    }
  n_save = ts->clb.clb_save ? BOX_ELEMENTS (ts->clb.clb_save) : 0;
  row = (caddr_t *) mp_alloc_box_ni (itcl->itcl_pool, sizeof (caddr_t) * (1 + n_save), DV_ARRAY_OF_POINTER);
  row[0] = (caddr_t) clo;
  if (n_save)
    {
      DO_BOX (state_slot_t *, ssl, inx, ts->clb.clb_save)
      {
	row[inx + 1] = mp_full_box_copy_tree (itcl->itcl_pool, qst_get (inst, ssl));
      }
      END_DO_BOX;
    }
  array[nth] = row;
  if (ts->clb.clb_nth_context)
    QST_INT (inst, ts->clb.clb_nth_context) = -1;
}


caddr_t
cl_id_to_iri (query_instance_t * qi, caddr_t id)
{
  NO_CLUSTER;
  return NULL;
}


dpipe_node_t *
sqlg_pre_code_dpipe (sqlo_t * so, dk_set_t * code_ret, data_source_t * qn)
{
  return NULL;
}


void
sqlg_cl_multistate_simple_agg (sql_comp_t * sc, dk_set_t * cum_code)
{
}


void
sqlg_cl_multistate_group (sql_comp_t * sc)
{
}


int
qn_seq_is_multistate (data_source_t * qn)
{
  return 0;
}


void
sqlg_cl_insert (sql_comp_t * sc, comp_context_t * cc, insert_node_t * ins, ST * tree, dk_set_t * code)
{
}


int
qr_is_multistate (query_t * qr)
{
  return 0;
}


void
clb_init (comp_context_t * cc, cl_buffer_t * clb, int is_select)
{
  clb->clb_batch_size = 1;
  clb->clb_fill = cc_new_instance_slot (cc);
  clb->clb_nth_set = cc_new_instance_slot (cc);
  clb->clb_params = ssl_new_variable (cc, "clb_params", DV_ARRAY_OF_POINTER);
  if (is_select)
    {
    }
  else
    {
      clb->clb_clrg = ssl_new_variable (cc, "clrg", DV_ANY);
    }
}


cl_host_t *
cl_name_to_host (char *name)
{
  return NULL;
}

void
cluster_init ()
{
  dk_mem_hooks (DV_CLOP, box_non_copiable, (box_destr_f) clo_destroy, 0);
}