From 0cfc87bd32822e5ba22d8c2b1a26fa60f63ad7fa Mon Sep 17 00:00:00 2001
From: rudb <office@database.ru>
Date: Fri, 19 Jun 2026 15:11:53 +0000
Subject: [PATCH] СУБД RuDB - релиз 2
---
src/test/regress/regress.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index fc16b7b..0bac0ce 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -30,6 +30,7 @@
#include "executor/executor.h"
#include "executor/spi.h"
#include "funcapi.h"
+#include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/supportnodes.h"
@@ -80,6 +81,19 @@
static void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2);
+typedef struct DbmsTraceDebugSnapshot
+{
+ bool enabled;
+ int32 trace_mask;
+ int64 active_run_id;
+ int64 next_run_id;
+ int64 next_event_seq;
+ int32 trace_rows_count;
+ char last_event_type[16];
+} DbmsTraceDebugSnapshot;
+
+extern void dbms_trace_get_debug_snapshot(DbmsTraceDebugSnapshot *out);
+
PG_MODULE_MAGIC_EXT(
.name = "regress",
.version = PG_VERSION
@@ -453,6 +467,7 @@
}
PG_FUNCTION_INFO_V1(regress_setenv);
+PG_FUNCTION_INFO_V1(regress_dbms_trace_snapshot);
Datum
regress_setenv(PG_FUNCTION_ARGS)
@@ -469,6 +484,28 @@
PG_RETURN_VOID();
}
+Datum
+regress_dbms_trace_snapshot(PG_FUNCTION_ARGS)
+{
+ DbmsTraceDebugSnapshot snap;
+ StringInfoData buf;
+
+ dbms_trace_get_debug_snapshot(&snap);
+
+ initStringInfo(&buf);
+ appendStringInfo(&buf,
+ "enabled=%s trace_mask=%d active_run_id=%lld next_run_id=%lld next_event_seq=%lld trace_rows_count=%d last_event_type=%s",
+ snap.enabled ? "true" : "false",
+ snap.trace_mask,
+ (long long) snap.active_run_id,
+ (long long) snap.next_run_id,
+ (long long) snap.next_event_seq,
+ snap.trace_rows_count,
+ snap.last_event_type[0] != '\0' ? snap.last_event_type : "none");
+
+ PG_RETURN_TEXT_P(cstring_to_text(buf.data));
+}
+
/* Sleep until no process has a given PID. */
PG_FUNCTION_INFO_V1(wait_pid);
--
Gitblit v1.10.0