summaryrefslogtreecommitdiffstats
path: root/storage/perfschema/pfs_digest.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:04:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:04:16 +0000
commita68fb2d8219f6bccc573009600e9f23e89226a5e (patch)
treed742d35d14ae816e99293d2b01face30e9f3a46b /storage/perfschema/pfs_digest.h
parentInitial commit. (diff)
downloadmariadb-10.6-upstream.tar.xz
mariadb-10.6-upstream.zip
Adding upstream version 1:10.6.11.upstream/1%10.6.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--storage/perfschema/pfs_digest.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
new file mode 100644
index 00000000..6611cfbf
--- /dev/null
+++ b/storage/perfschema/pfs_digest.h
@@ -0,0 +1,94 @@
+/* Copyright (c) 2011, 2022, Oracle and/or its affiliates.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ 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, version 2.0, 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,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#ifndef PFS_DIGEST_H
+#define PFS_DIGEST_H
+
+/**
+ @file storage/perfschema/pfs_digest.h
+ Statement Digest data structures (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "lf.h"
+#include "pfs_stat.h"
+#include "sql_digest.h"
+
+extern bool flag_statements_digest;
+extern size_t digest_max;
+extern ulong digest_lost;
+struct PFS_thread;
+
+/**
+ Structure to store a MD5 hash value (digest) for a statement.
+*/
+struct PFS_digest_key
+{
+ unsigned char m_md5[MD5_HASH_SIZE];
+ char m_schema_name[NAME_LEN];
+ uint m_schema_name_length;
+};
+
+/** A statement digest stat record. */
+struct PFS_ALIGNED PFS_statements_digest_stat
+{
+ /** Internal lock. */
+ pfs_lock m_lock;
+
+ /** Digest Schema + MD5 Hash. */
+ PFS_digest_key m_digest_key;
+
+ /** Digest Storage. */
+ sql_digest_storage m_digest_storage;
+
+ /** Statement stat. */
+ PFS_statement_stat m_stat;
+
+ /** First and last seen timestamps.*/
+ ulonglong m_first_seen;
+ ulonglong m_last_seen;
+
+ /** Reset data for this record. */
+ void reset_data(unsigned char* token_array, size_t length);
+ /** Reset data and remove index for this record. */
+ void reset_index(PFS_thread *thread);
+};
+
+int init_digest(const PFS_global_param *param);
+void cleanup_digest();
+
+int init_digest_hash(const PFS_global_param *param);
+void cleanup_digest_hash(void);
+PFS_statement_stat* find_or_create_digest(PFS_thread *thread,
+ const sql_digest_storage *digest_storage,
+ const char *schema_name,
+ uint schema_name_length);
+
+void reset_esms_by_digest();
+
+/* Exposing the data directly, for iterators. */
+extern PFS_statements_digest_stat *statements_digest_stat_array;
+
+extern LF_HASH digest_hash;
+
+#endif
+