Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-25772] Implement class name extraction from input file using -i option in DIAGDB and call heap_dump_heap_file() function #5744

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions src/executables/util_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,59 @@ diagdb (UTIL_FUNCTION_ARG * arg)
goto error_exit;
}
}
else if (fname != NULL)
{
FILE *fp = fopen (fname, "r");
int len = 0, file_getc = 0;
char fget_name[SM_MAX_IDENTIFIER_LENGTH];
char name[SM_MAX_IDENTIFIER_LENGTH] = { 0 };
if (fp == NULL)
{
perror (fname);
goto error_exit;
}

while (file_getc != EOF)
{
file_getc = fgetc (fp);

if (char_isspace2 (file_getc) || file_getc == ',')
{
if (len > 0)
{
fget_name[len] = '\0';
strncpy (name, fget_name, len);
error_code = heap_dump_heap_file (thread_p, outfp, dump_records, name);
if (error_code != NO_ERROR)
{
if (error_code == ER_LC_UNKNOWN_CLASSNAME)
{
PRINT_AND_LOG_ERR_MSG (msgcat_message
(MSGCAT_CATALOG_UTILS, MSGCAT_UTIL_SET_DIAGDB,
DIAGDB_MSG_UNKNOWN_CLASS), name);
}
}
}

memset (name, '\0', sizeof (name));
len = 0;
continue;
}

fget_name[len++] = file_getc;

if (len == SM_MAX_IDENTIFIER_LENGTH)
{
/* too long table name */
if (utility_check_class_name (fget_name) != NO_ERROR)
{
fclose (fp);
/* The util_log_write_errid function is called inside the utility_check_class_name function. */
return ER_GENERIC_ERROR;
}
}
}
}
}

db_shutdown ();
Expand Down
Loading