CUBRID Engine  latest
show_scan.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * show_scan.c - scan information for show statements
21  */
22 
23 #ident "$Id$"
24 
25 /*TODO this header (cinttypes) apparently has to be the first one included
26  *in order to compile (there's some problem with the PRIx64 macro)
27  */
28 #include <cinttypes>
29 #include "config.h"
30 
31 #include <stdio.h>
32 #include <string.h>
33 #include <assert.h>
34 
35 #include "error_manager.h"
36 #include "memory_alloc.h"
37 
38 #include "query_manager.h"
39 #include "object_primitive.h"
40 #include "object_representation.h"
41 #include "scan_manager.h"
42 #include "show_scan.h"
43 
44 #include "disk_manager.h"
45 #include "log_manager.h"
46 #include "slotted_page.h"
47 #include "heap_file.h"
48 #include "btree.h"
49 #include "connection_support.h"
50 #include "critical_section.h"
51 #include "tz_support.h"
52 #include "db_date.h"
53 #include "network.h"
54 
55 #if defined(ENABLE_SYSTEMTAP)
56 #include "probes.h"
57 #endif /* ENABLE_SYSTEMTAP */
58 
59 #include "porting.h"
60 #include "server_support.h"
61 #include "dbtype.h"
62 #include "thread_manager.hpp"
63 
64 typedef SCAN_CODE (*NEXT_SCAN_FUNC) (THREAD_ENTRY * thread_p, int cursor, DB_VALUE ** out_values, int out_cnt,
65  void *ctx);
66 typedef int (*START_SCAN_FUNC) (THREAD_ENTRY * thread_p, int show_type, DB_VALUE ** arg_values, int arg_cnt,
67  void **ctx);
68 typedef int (*END_SCAN_FUNC) (THREAD_ENTRY * thread_p, void **ctx);
69 
70 typedef struct show_request SHOW_REQUEST;
72 {
73  SHOWSTMT_TYPE show_type; /* show stmt type */
74  START_SCAN_FUNC start_func; /* start scan function */
75  NEXT_SCAN_FUNC next_func; /* next scan function */
76  END_SCAN_FUNC end_func; /* end scan function */
77 };
78 
79 const size_t THREAD_SCAN_COLUMN_COUNT = 26;
80 
81 static SCAN_CODE showstmt_array_next_scan (THREAD_ENTRY * thread_p, int cursor, DB_VALUE ** out_values, int out_cnt,
82  void *ptr);
83 static int showstmt_array_end_scan (THREAD_ENTRY * thread_p, void **ptr);
84 #if defined (SERVER_MODE)
85 static void thread_scan_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, THREAD_ENTRY * caller_thread_p,
86  SHOWSTMT_ARRAY_CONTEXT * ctx, int &error);
87 #endif // SERVER_MODE
88 
89 
90 static bool show_scan_Inited = false;
91 
93 
94 /*
95  * showstmt_scan_init () - initialize the scan functions of
96  * show statments.
97  * return: NULL
98  */
99 void
101 {
102  SHOW_REQUEST *req;
103 
104  if (show_scan_Inited)
105  {
106  return;
107  }
108 
109  memset (show_Requests, 0, SHOWSTMT_END * sizeof (SHOW_REQUEST));
110 
111  req = &show_Requests[SHOWSTMT_VOLUME_HEADER];
116 
117  req = &show_Requests[SHOWSTMT_ACCESS_STATUS];
122 
123  req = &show_Requests[SHOWSTMT_ACTIVE_LOG_HEADER];
128 
129  req = &show_Requests[SHOWSTMT_ARCHIVE_LOG_HEADER];
134 
135  req = &show_Requests[SHOWSTMT_SLOTTED_PAGE_HEADER];
140 
141  req = &show_Requests[SHOWSTMT_SLOTTED_PAGE_SLOTS];
146 
147  req = &show_Requests[SHOWSTMT_HEAP_HEADER];
152 
153  req = &show_Requests[SHOWSTMT_ALL_HEAP_HEADER];
158 
159  req = &show_Requests[SHOWSTMT_HEAP_CAPACITY];
164 
165  req = &show_Requests[SHOWSTMT_ALL_HEAP_CAPACITY];
170 
171  req = &show_Requests[SHOWSTMT_INDEX_HEADER];
176 
177  req = &show_Requests[SHOWSTMT_INDEX_CAPACITY];
182 
183  req = &show_Requests[SHOWSTMT_ALL_INDEXES_HEADER];
188 
189  req = &show_Requests[SHOWSTMT_ALL_INDEXES_CAPACITY];
194 
195  req = &show_Requests[SHOWSTMT_GLOBAL_CRITICAL_SECTIONS];
200 
201  req = &show_Requests[SHOWSTMT_JOB_QUEUES];
206 
207  req = &show_Requests[SHOWSTMT_TIMEZONES];
212 
213  req = &show_Requests[SHOWSTMT_FULL_TIMEZONES];
218 
219  req = &show_Requests[SHOWSTMT_TRAN_TABLES];
224 
225  req = &show_Requests[SHOWSTMT_THREADS];
230 
231  req = &show_Requests[SHOWSTMT_PAGE_BUFFER_STATUS];
236 
237  /* append to init other show statement scan function here */
238 
239 
240  show_scan_Inited = true;
241 }
242 
243 /*
244  * showstmt_next_scan () - scan values from different show statment.
245  * return: NO_ERROR, or ER_code
246  * thread_p(in):
247  * s_id(in):
248  */
249 SCAN_CODE
251 {
252  SHOWSTMT_SCAN_ID *stsidp = &s_id->s.stsid;
255  SCAN_CODE code;
256  int i;
257 
258  assert (show_type == show_Requests[show_type].show_type);
259 
260  next_func = show_Requests[show_type].next_func;
261  if (next_func == NULL)
262  {
263  return S_END;
264  }
265 
266  /* free values which need be cleared */
267  for (i = 0; i < stsidp->out_cnt; i++)
268  {
269  pr_clear_value (stsidp->out_values[i]);
270  }
271 
272  code = (*next_func) (thread_p, stsidp->cursor++, stsidp->out_values, stsidp->out_cnt, stsidp->ctx);
273  return code;
274 }
275 
276 /*
277  * showstmt_start_scan () - before scan.
278  * return: NO_ERROR, or ER_code
279  * thread_p(in):
280  * s_id(in):
281  */
282 int
284 {
285  SHOWSTMT_SCAN_ID *stsidp = &s_id->s.stsid;
288  int error;
289 
290  assert (show_type == show_Requests[show_type].show_type);
291 
292  start_func = show_Requests[show_type].start_func;
293  if (start_func == NULL)
294  {
295  return NO_ERROR;
296  }
297 
298  error = (*start_func) (thread_p, (int) show_type, stsidp->arg_values, stsidp->arg_cnt, &stsidp->ctx);
299  return error;
300 }
301 
302 /*
303  * showstmt_end_scan () - after scan.
304  * return: NO_ERROR, or ER_code
305  * thread_p(in):
306  * s_id(in):
307  */
308 int
310 {
311  SHOWSTMT_SCAN_ID *stsidp = &s_id->s.stsid;
314  int error;
315 
316  assert (show_type == show_Requests[show_type].show_type);
317 
318  end_func = show_Requests[show_type].end_func;
319  if (end_func == NULL)
320  {
321  return NO_ERROR;
322  }
323 
324  error = (*end_func) (thread_p, &stsidp->ctx);
325  return error;
326 }
327 
328 /*
329  * showstmt_alloc_array_context () - init context for db_values arrays
330  * return: NO_ERROR, or ER_code
331  * thread_p(in):
332  * num_total(in):
333  * num_col(in):
334  */
336 showstmt_alloc_array_context (THREAD_ENTRY * thread_p, int num_total, int num_cols)
337 {
339 
340  ctx = (SHOWSTMT_ARRAY_CONTEXT *) db_private_alloc (thread_p, sizeof (SHOWSTMT_ARRAY_CONTEXT));
341  if (ctx == NULL)
342  {
343  return NULL;
344  }
345 
346  ctx->num_used = 0;
347  ctx->num_cols = num_cols;
348  ctx->num_total = num_total;
349  ctx->tuples = (DB_VALUE **) db_private_alloc (thread_p, sizeof (DB_VALUE *) * num_total);
350  if (ctx->tuples == NULL)
351  {
352  goto on_error;
353  }
354 
355  memset (ctx->tuples, 0, sizeof (DB_VALUE *) * num_total);
356  return ctx;
357 
358 on_error:
359  if (ctx != NULL)
360  {
361  db_private_free (thread_p, ctx);
362  }
363  return NULL;
364 }
365 
366 /*
367  * showstmt_free_array_context () - free context for db_values arrays
368  * return: NO_ERROR, or ER_code
369  * thread_p(in):
370  * ctx(in):
371  */
372 void
374 {
375  int i, j;
376  DB_VALUE *vals;
377 
378  assert (ctx != NULL);
379 
380  for (i = 0; i < ctx->num_used; i++)
381  {
382  vals = ctx->tuples[i];
383  for (j = 0; j < ctx->num_cols; j++)
384  {
385  pr_clear_value (&vals[j]);
386  }
387 
388  db_private_free (thread_p, vals);
389  }
390 
391  db_private_free (thread_p, ctx->tuples);
392  db_private_free (thread_p, ctx);
393 }
394 
395 /*
396  * showstmt_alloc_tuple_in_context () - alloc and return next tuple from context
397  * return: tuple pointer
398  * thread_p(in):
399  * ctx(in):
400  */
401 DB_VALUE *
403 {
404  int i, num_new_total;
405  DB_VALUE **new_tuples = NULL;
406  DB_VALUE *vals = NULL;
407 
408  if (ctx->num_used == ctx->num_total)
409  {
410  num_new_total = (int) (ctx->num_total * 1.5 + 1);
411  new_tuples = (DB_VALUE **) db_private_realloc (thread_p, ctx->tuples, sizeof (DB_VALUE *) * num_new_total);
412  if (new_tuples == NULL)
413  {
414  return NULL;
415  }
416 
417  memset (new_tuples + ctx->num_total, 0, sizeof (DB_VALUE *) * (num_new_total - ctx->num_total));
418 
419  ctx->tuples = new_tuples;
420  ctx->num_total = num_new_total;
421  }
422 
423  vals = (DB_VALUE *) db_private_alloc (thread_p, sizeof (DB_VALUE) * ctx->num_cols);
424  if (vals == NULL)
425  {
426  return NULL;
427  }
428  for (i = 0; i < ctx->num_cols; i++)
429  {
430  db_make_null (&vals[i]);
431  }
432 
433  ctx->tuples[ctx->num_used++] = vals;
434  return vals;
435 }
436 
437 /*
438  * showstmt_array_next_scan () - next scan function for array
439  * return: NO_ERROR, or ER_code
440  * thread_p(in):
441  * cursor(in):
442  * out_values(in/out):
443  * out_cnt(in):
444  * ptr(in):
445  */
446 static SCAN_CODE
447 showstmt_array_next_scan (THREAD_ENTRY * thread_p, int cursor, DB_VALUE ** out_values, int out_cnt, void *ptr)
448 {
450  DB_VALUE *vals = NULL;
451  int i;
452 
453  if (ctx == NULL || cursor < 0 || cursor >= ctx->num_used)
454  {
455  return S_END;
456  }
457 
458  assert (out_cnt == ctx->num_cols);
459 
460  vals = ctx->tuples[cursor];
461 
462  for (i = 0; i < ctx->num_cols; i++)
463  {
464  pr_clone_value (&vals[i], out_values[i]);
465  }
466 
467  return S_SUCCESS;
468 }
469 
470 /*
471  * showstmt_array_end_scan () - end scan function for array
472  * return: NO_ERROR, or ER_code
473  * thread_p(in):
474  * ptr(in/out):
475  */
476 static int
477 showstmt_array_end_scan (THREAD_ENTRY * thread_p, void **ptr)
478 {
479  if (*ptr != NULL)
480  {
482  *ptr = NULL;
483  }
484  return NO_ERROR;
485 }
486 
487 #if defined (SERVER_MODE)
488 //
489 // thread_scan_mapfunc () - mapper function to get information from thread entry for scanner
490 //
491 // thread_ref (in) : mapped thread entry
492 // stop_mapper (out) : output true to stop mapping
493 // caller_thread_p (in) : thread entry of show scan thread
494 // ctx (out) : show scan array context
495 // error (out) : output NO_ERROR or error code
496 //
497 static void
498 thread_scan_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, THREAD_ENTRY * caller_thread_p,
499  SHOWSTMT_ARRAY_CONTEXT * ctx, int &error)
500 {
501  DB_VALUE *vals = NULL;
502  THREAD_ENTRY *thrd = &thread_ref;
503  THREAD_ENTRY *next_thrd = NULL;
504  size_t idx = 0;
505  int ival;
506  INT64 i64val;
507  CSS_CONN_ENTRY *conn_entry = NULL;
508  OR_ALIGNED_BUF (1024) a_buffer;
509  char *buffer;
510  char *area;
511  int buf_len;
512  HL_HEAPID private_heap_id;
513  void *query_entry;
514  LK_ENTRY *lockwait;
515  time_t stime;
516  int msecs;
517  DB_DATETIME time_val;
518 
519  vals = showstmt_alloc_tuple_in_context (caller_thread_p, ctx);
520  if (vals == NULL)
521  {
522  ASSERT_ERROR_AND_SET (error);
523  stop_mapper = true;
524  return;
525  }
526 
527  /* Index */
528  db_make_int (&vals[idx], thrd->index);
529  idx++;
530 
531  /* Jobq_index */// it is obsolete
532  db_make_null (&vals[idx]);
533  idx++;
534 
535  /* Thread_id */
536  db_make_bigint (&vals[idx], (DB_BIGINT) thrd->get_posix_id ());
537  idx++;
538 
539  /* Tran_index */
540  ival = thrd->tran_index;
541  if (ival >= 0)
542  {
543  db_make_int (&vals[idx], ival);
544  }
545  else
546  {
547  db_make_null (&vals[idx]);
548  }
549  idx++;
550 
551  /* Type */
552  db_make_string (&vals[idx], thread_type_to_string (thrd->type));
553  idx++;
554 
555  /* Status */
556  db_make_string (&vals[idx], thread_status_to_string (thrd->m_status));
557  idx++;
558 
559  /* Resume_status */
560  db_make_string (&vals[idx], thread_resume_status_to_string (thrd->resume_status));
561  idx++;
562 
563  /* Net_request */
564  ival = thrd->net_request_index;
565  if (ival != -1)
566  {
567  db_make_string (&vals[idx], net_server_request_name (ival));
568  }
569  else
570  {
571  db_make_null (&vals[idx]);
572  }
573  idx++;
574 
575  /* Conn_client_id */
576  ival = thrd->client_id;
577  if (ival != -1)
578  {
579  db_make_int (&vals[idx], ival);
580  }
581  else
582  {
583  db_make_null (&vals[idx]);
584  }
585  idx++;
586 
587  /* Conn_request_id */
588  ival = thrd->rid;
589  if (ival != 0)
590  {
591  db_make_int (&vals[idx], ival);
592  }
593  else
594  {
595  db_make_null (&vals[idx]);
596  }
597  idx++;
598 
599  /* Conn_index */
600  conn_entry = thrd->conn_entry;
601  if (conn_entry != NULL)
602  {
603  db_make_int (&vals[idx], conn_entry->idx);
604  }
605  else
606  {
607  db_make_null (&vals[idx]);
608  }
609  idx++;
610 
611  /* Last_error_code */
612  ival = er_errid ();
613  db_make_int (&vals[idx], ival);
614  idx++;
615 
616  /* Last_error_msg */
617  buffer = OR_ALIGNED_BUF_START (a_buffer);
618  buf_len = 1024;
619 
620  if (ival != NO_ERROR)
621  {
622  char *ermsg;
623 
624  area = er_get_area_error (buffer, &buf_len);
625  ermsg = er_get_ermsg_from_area_error (area);
626  ermsg[255] = '\0'; /* truncate msg */
627 
628  error = db_make_string_copy (&vals[idx], ermsg);
629  if (error != NO_ERROR)
630  {
631  ASSERT_ERROR ();
632  stop_mapper = true;
633  return;
634  }
635  }
636  else
637  {
638  db_make_null (&vals[idx]);
639  }
640  idx++;
641 
642  /* Private_heap_id */
643  buffer = OR_ALIGNED_BUF_START (a_buffer);
644  buf_len = 1024;
645 
646  private_heap_id = thrd->private_heap_id;
647  if (private_heap_id != 0)
648  {
649  snprintf (buffer, buf_len, "0x%08" PRIx64, (UINT64) private_heap_id);
650  error = db_make_string_copy (&vals[idx], buffer);
651  if (error != NO_ERROR)
652  {
653  ASSERT_ERROR ();
654  stop_mapper = true;
655  return;
656  }
657  }
658  else
659  {
660  db_make_null (&vals[idx]);
661  }
662  idx++;
663 
664  /* Query_entry */
665  buffer = OR_ALIGNED_BUF_START (a_buffer);
666  buf_len = 1024;
667 
668  query_entry = thrd->query_entry;
669  if (query_entry != NULL)
670  {
671  snprintf (buffer, buf_len, "0x%08" PRIx64, (UINT64) query_entry);
672  error = db_make_string_copy (&vals[idx], buffer);
673  if (error != NO_ERROR)
674  {
675  ASSERT_ERROR ();
676  stop_mapper = true;
677  return;
678  }
679  }
680  else
681  {
682  db_make_null (&vals[idx]);
683  }
684  idx++;
685 
686  /* Interrupted */
687  db_make_int (&vals[idx], thrd->interrupted);
688  idx++;
689 
690  /* Shutdown */
691  db_make_int (&vals[idx], thrd->shutdown);
692  idx++;
693 
694  /* Check_interrupt */
695  db_make_int (&vals[idx], thrd->check_interrupt);
696  idx++;
697 
698  /* Wait_for_latch_promote */
699  db_make_int (&vals[idx], thrd->wait_for_latch_promote);
700  idx++;
701 
702  buffer = OR_ALIGNED_BUF_START (a_buffer);
703  buf_len = 1024;
704 
705  lockwait = (LK_ENTRY *) thrd->lockwait;
706  if (lockwait != NULL)
707  {
708  /* lockwait_blocked_mode */
709  strncpy (buffer, LOCK_TO_LOCKMODE_STRING (lockwait->blocked_mode), buf_len);
710  buffer[buf_len - 1] = '\0';
711  trim (buffer);
712  error = db_make_string_copy (&vals[idx], buffer);
713  if (error != NO_ERROR)
714  {
715  ASSERT_ERROR ();
716  stop_mapper = true;
717  return;
718  }
719  idx++;
720 
721  /* Lockwait_start_time */
722  i64val = thrd->lockwait_stime;
723  stime = (time_t) (i64val / 1000LL);
724  msecs = i64val % 1000;
725  db_localdatetime_msec (&stime, msecs, &time_val);
726  error = db_make_datetime (&vals[idx], &time_val);
727  if (error != NO_ERROR)
728  {
729  ASSERT_ERROR ();
730  stop_mapper = true;
731  return;
732  }
733  idx++;
734 
735  /* Lockwait_msecs */
736  db_make_int (&vals[idx], thrd->lockwait_msecs);
737  idx++;
738 
739  /* Lockwait_state */
740  db_make_string (&vals[idx], lock_wait_state_to_string (thrd->lockwait_state));
741  idx++;
742  }
743  else
744  {
745  /* lockwait_blocked_mode */
746  db_make_null (&vals[idx]);
747  idx++;
748 
749  /* Lockwait_start_time */
750  db_make_null (&vals[idx]);
751  idx++;
752 
753  /* Lockwait_msecs */
754  db_make_null (&vals[idx]);
755  idx++;
756 
757  /* Lockwait_state */
758  db_make_null (&vals[idx]);
759  idx++;
760  }
761 
762  /* Next_wait_thread_index */
763  next_thrd = thrd->next_wait_thrd;
764  if (next_thrd != NULL)
765  {
766  db_make_int (&vals[idx], next_thrd->index);
767  }
768  else
769  {
770  db_make_null (&vals[idx]);
771  }
772  idx++;
773 
774  /* Next_tran_wait_thread_index */
775  next_thrd = thrd->tran_next_wait;
776  if (next_thrd != NULL)
777  {
778  db_make_int (&vals[idx], next_thrd->index);
779  }
780  else
781  {
782  db_make_null (&vals[idx]);
783  }
784  idx++;
785 
786  /* Next_worker_thread_index */
787  next_thrd = thrd->worker_thrd_list;
788  if (next_thrd != NULL)
789  {
790  db_make_int (&vals[idx], next_thrd->index);
791  }
792  else
793  {
794  db_make_null (&vals[idx]);
795  }
796  idx++;
797 
799 }
800 #endif // SERVER_MODE
801 
802 /*
803  * thread_start_scan () - start scan function for show threads
804  * return: NO_ERROR, or ER_code
805  *
806  * thread_p(in):
807  * type (in):
808  * arg_values(in):
809  * arg_cnt(in):
810  * ptr(in/out):
811  */
812 int
813 thread_start_scan (THREAD_ENTRY * thread_p, int type, DB_VALUE ** arg_values, int arg_cnt, void **ptr)
814 {
815 #if defined(SERVER_MODE)
817  int error = NO_ERROR;
818 
819  *ptr = NULL;
820 
822  if (ctx == NULL)
823  {
824  ASSERT_ERROR_AND_SET (error);
825  return error;
826  }
827 
828  // scan all threads
829  thread_get_manager ()->map_entries (thread_scan_mapfunc, thread_p, ctx, error);
830 
831  if (error == NO_ERROR)
832  {
833  *ptr = ctx;
834  }
835  else
836  {
837  ASSERT_ERROR ();
838  showstmt_free_array_context (thread_p, ctx);
839  }
840 
841  return error;
842 #else // not SERVER_MODE
843  return NO_ERROR;
844 #endif // not SERVER_MODE
845 }
SCAN_CODE heap_capacity_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: heap_file.c:18014
int db_make_datetime(DB_VALUE *value, const DB_DATETIME *datetime)
SCAN_CODE showstmt_next_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:250
char * trim(char *str)
Definition: porting.c:2260
#define NO_ERROR
Definition: error_code.h:46
int heap_header_capacity_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: heap_file.c:17661
END_SCAN_FUNC end_func
Definition: show_scan.c:76
SHOWSTMT_SCAN_ID stsid
Definition: scan_manager.h:361
#define ASSERT_ERROR()
SCAN_CODE
void showstmt_free_array_context(THREAD_ENTRY *thread_p, SHOWSTMT_ARRAY_CONTEXT *ctx)
Definition: show_scan.c:373
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
DB_VALUE ** tuples
Definition: show_scan.h:34
int pgbuf_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
SCAN_CODE spage_slots_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
static bool show_scan_Inited
Definition: show_scan.c:90
#define ASSERT_ERROR_AND_SET(error_code)
char * er_get_area_error(char *buffer, int *length)
cubthread::manager * thread_get_manager(void)
#define OR_ALIGNED_BUF(size)
int log_archive_log_header_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: log_manager.c:9175
int er_errid(void)
SHOWSTMT_TYPE
SHOWSTMT_ARRAY_CONTEXT * showstmt_alloc_array_context(THREAD_ENTRY *thread_p, int num_total, int num_cols)
Definition: show_scan.c:336
int btree_index_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: btree.c:20523
int spage_header_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
void THREAD_ENTRY
int btree_index_end_scan(THREAD_ENTRY *thread_p, void **ptr)
Definition: btree.c:20769
int spage_slots_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
const char * net_server_request_name(int request)
Definition: network_sr.c:1441
int showstmt_end_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:309
#define OR_ALIGNED_BUF_START(abuf)
int disk_volume_header_end_scan(THREAD_ENTRY *thread_p, void **ptr)
int db_make_string(DB_VALUE *value, DB_CONST_C_CHAR str)
SHOWSTMT_TYPE show_type
Definition: show_scan.c:73
int(* END_SCAN_FUNC)(THREAD_ENTRY *thread_p, void **ctx)
Definition: show_scan.c:68
SCAN_CODE disk_volume_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
#define assert(x)
SCAN_CODE btree_index_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: btree.c:20669
int tz_full_timezones_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: tz_support.c:4775
HL_HEAPID private_heap_id
Definition: memory_alloc.c:55
int disk_volume_header_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
int thread_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: show_scan.c:813
int spage_slots_end_scan(THREAD_ENTRY *thread_p, void **ptr)
SCAN_CODE log_archive_log_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: log_manager.c:9252
SCAN_CODE spage_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
#define LOCK_TO_LOCKMODE_STRING(lock)
#define NULL
Definition: freelistheap.h:34
if(extra_options)
Definition: dynamic_load.c:958
void showstmt_scan_init(void)
Definition: show_scan.c:100
SCAN_CODE(* NEXT_SCAN_FUNC)(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ctx)
Definition: show_scan.c:64
char * er_get_ermsg_from_area_error(char *buffer)
static int showstmt_array_end_scan(THREAD_ENTRY *thread_p, void **ptr)
Definition: show_scan.c:477
#define db_private_free(thrd, ptr)
Definition: memory_alloc.h:229
DB_VALUE * showstmt_alloc_tuple_in_context(THREAD_ENTRY *thread_p, SHOWSTMT_ARRAY_CONTEXT *ctx)
Definition: show_scan.c:402
#define db_private_alloc(thrd, size)
Definition: memory_alloc.h:227
SHOWSTMT_TYPE show_type
Definition: scan_manager.h:260
int pr_clear_value(DB_VALUE *value)
int log_active_log_header_end_scan(THREAD_ENTRY *thread_p, void **ptr)
Definition: log_manager.c:9154
START_SCAN_FUNC start_func
Definition: show_scan.c:74
int64_t DB_BIGINT
Definition: dbtype_def.h:751
SCAN_CODE log_active_log_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: log_manager.c:8913
void map_entries(Func &&func, Args &&...args)
static void error(const char *msg)
Definition: gencat.c:331
int tz_timezones_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: tz_support.c:4716
const char * thread_resume_status_to_string(thread_resume_suspend_status resume_status)
int(* START_SCAN_FUNC)(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ctx)
Definition: show_scan.c:66
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
static SHOW_REQUEST show_Requests[SHOWSTMT_END]
Definition: show_scan.c:92
int db_make_string_copy(DB_VALUE *value, DB_CONST_C_CHAR str)
int css_job_queues_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
union scan_id_struct::@153 s
int log_archive_log_header_end_scan(THREAD_ENTRY *thread_p, void **ptr)
Definition: log_manager.c:9316
std::size_t thread_num_total_threads(void)
#define csect_start_scan
int i
Definition: dynamic_load.c:954
int log_active_log_header_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
Definition: log_manager.c:8817
int db_make_null(DB_VALUE *value)
static WHEN_DESC on_error
int css_user_access_status_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
SCAN_CODE heap_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: heap_file.c:17780
int db_make_int(DB_VALUE *value, const int num)
const char * thread_status_to_string(cubthread::entry::status status)
int spage_header_end_scan(THREAD_ENTRY *thread_p, void **ptr)
DB_VALUE ** arg_values
Definition: scan_manager.h:261
int heap_header_capacity_end_scan(THREAD_ENTRY *thread_p, void **ptr)
Definition: heap_file.c:18181
#define db_private_realloc(thrd, ptr, size)
Definition: memory_alloc.h:231
int showstmt_start_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:283
Definition: lock_manager.h:79
void db_localdatetime_msec(time_t *epoch_time, int millisecond, DB_DATETIME *datetime)
Definition: db_date.c:1044
static SCAN_CODE showstmt_array_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
Definition: show_scan.c:447
int logtb_descriptors_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ctx)
DB_VALUE ** out_values
Definition: scan_manager.h:263
NEXT_SCAN_FUNC next_func
Definition: show_scan.c:75
const char * lock_wait_state_to_string(int state)
const char * thread_type_to_string(thread_type type)
const size_t THREAD_SCAN_COLUMN_COUNT
Definition: show_scan.c:79