-
Notifications
You must be signed in to change notification settings - Fork 123
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-25312] Modify diagdb utility to accept a class-name parameter #5141
Conversation
src/executables/util_sa.c
Outdated
class_name = utility_get_option_string_value (arg_map, DIAG_CLASS_NAME_S, 0); | ||
if (class_name == NULL) | ||
{ | ||
/* this dumps the contents of all heaps */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* this dumps the contents of all heaps */ |
The DUMP OF ALL HEAPS
in the next line has enough information.
src/executables/util_sa.c
Outdated
} | ||
else | ||
{ | ||
/* this dumps the contents of a specific heap for given class name */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* this dumps the contents of a specific heap for given class name */ |
src/executables/util_sa.c
Outdated
/* this dumps the contents of a specific heap for given class name */ | ||
if (!sm_check_system_class_by_name (class_name)) | ||
{ | ||
/* check if the format of class name is valid */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* check if the format of class name is valid */ |
You don't always need to leave a comment about what it does. This should be fully explained, mainly through the function name.
src/storage/file_manager.h
Outdated
@@ -215,6 +215,8 @@ extern DISK_ISVALID file_tracker_check (THREAD_ENTRY * thread_p); | |||
extern int file_tracker_dump (THREAD_ENTRY * thread_p, FILE * fp); | |||
extern int file_tracker_dump_all_capacities (THREAD_ENTRY * thread_p, FILE * fp); | |||
extern int file_tracker_dump_all_heap (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records); | |||
extern void file_class_dump_specific_heap_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the determined processing method, this function should be defined in heap_file.c/h. And this function might call the following functions to convert class name into hfid.
- xlocator_find_class_oid()
- heap_hfid_cache_get()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the function to heap_file.c and change its name to heap_dump_specific_file
.
msg/en_US/utils.msg
Outdated
@@ -834,7 +834,11 @@ valid options:\n\ | |||
6 dump disk bitmaps\n\ | |||
7 dump catalog\n\ | |||
8 dump log\n\ | |||
9 dump heap\n | |||
9 dump heap / class\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This revision is not a final edition and should remain a hidden option until the final version is released. There is even a possibility of changing the specifications as follows to compatible with other utilies.
cubrid diagdb [OPTION] database-name [class_name1 class_name2 ...]
One option is to separate the issue of usage output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rollback usage message to original diagdb
usage message.
src/executables/util_sa.c
Outdated
goto error_exit; | ||
} | ||
} | ||
fprintf (outfp, "\n*** DUMP OF SPECIFIC HEAP(S) ***\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be kinder, it would be better to include the class name entered with the --class-name option in the heading.
*** DUMP HEAP OF user_name.class_name ***
… exists on DIAGDUMP_ALL option
Co-authored-by: Jooho Kim <[email protected]>
Co-authored-by: Jooho Kim <[email protected]>
Co-authored-by: Jooho Kim <[email protected]>
if (diag == DIAGDUMP_ALL && class_name != NULL) | ||
{ | ||
goto print_diag_usage; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (diag == DIAGDUMP_ALL && class_name != NULL) | |
{ | |
goto print_diag_usage; | |
} | |
if (diag == DIAGDUMP_ALL && class_name != NULL) | |
{ | |
goto print_diag_usage; | |
} | |
src/executables/util_sa.c
Outdated
} | ||
else | ||
{ | ||
assert (diag != DIAGDUMP_ALL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already checked.
assert (diag != DIAGDUMP_ALL); |
src/storage/heap_file.h
Outdated
@@ -554,6 +554,7 @@ extern int heap_set_autoincrement_value (THREAD_ENTRY * thread_p, HEAP_CACHE_ATT | |||
HEAP_SCANCACHE * scan_cache, int *is_set); | |||
|
|||
extern void heap_dump (THREAD_ENTRY * thread_p, FILE * fp, HFID * hfid, bool dump_records); | |||
extern void heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern void heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name); | |
#if defined (SA_MODE) | |
extern void heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name); | |
#endif |
src/storage/heap_file.c
Outdated
/* | ||
* heap_dump_specific_file () - dump a specific heap file with class name | ||
* | ||
* return : | ||
* thread_p (in) : thread entry | ||
* fp (in) : output file | ||
* dump_records (in) : true to dump records | ||
* class_name (in) : name of class to dump | ||
*/ | ||
void | ||
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) | ||
{ | ||
/* TODO: Fetch HFID of class which corresponds to class_name, and dump heap file by HFID. Will be handled at CBRD-25313 and CBRD-25314. */ | ||
fprintf (fp, "\n\n*** DUMP A CLASS NAMED %s ***\n\n", class_name); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
* heap_dump_specific_file () - dump a specific heap file with class name | |
* | |
* return : | |
* thread_p (in) : thread entry | |
* fp (in) : output file | |
* dump_records (in) : true to dump records | |
* class_name (in) : name of class to dump | |
*/ | |
void | |
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) | |
{ | |
/* TODO: Fetch HFID of class which corresponds to class_name, and dump heap file by HFID. Will be handled at CBRD-25313 and CBRD-25314. */ | |
fprintf (fp, "\n\n*** DUMP A CLASS NAMED %s ***\n\n", class_name); | |
} | |
#if defined (SA_MODE) | |
/* | |
* heap_dump_specific_file () - dump a specific heap file with class name | |
* | |
* return : | |
* thread_p (in) : thread entry | |
* fp (in) : output file | |
* dump_records (in) : true to dump records | |
* class_name (in) : name of class to dump | |
*/ | |
void | |
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) | |
{ | |
/* TODO: Fetch HFID of class which corresponds to class_name, and dump heap file by HFID. Will be handled at CBRD-25313 and CBRD-25314. */ | |
fprintf (fp, "\n\n*** DUMP A CLASS NAMED %s ***\n\n", class_name); | |
} | |
#endif | |
src/storage/heap_file.c
Outdated
* class_name (in) : name of class to dump | ||
*/ | ||
void | ||
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) | |
heap_dump_heap_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) |
src/storage/heap_file.c
Outdated
heap_dump_specific_file (THREAD_ENTRY * thread_p, FILE * fp, bool dump_records, const char *class_name) | ||
{ | ||
/* TODO: Fetch HFID of class which corresponds to class_name, and dump heap file by HFID. Will be handled at CBRD-25313 and CBRD-25314. */ | ||
fprintf (fp, "\n\n*** DUMP A CLASS NAMED %s ***\n\n", class_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to print out this message? This information is already included in the heading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's duplicated information. It's been deleted.
http://jira.cubrid.org/browse/CBRD-25312
Modify heap dump of
diagdb
utility to acceptclass-name
parameter.-c
and--class-name
flag atdiagdb
option table and option map.diagdb
to provide information ofclass-name
parameter.diagdb
main function to fetch class-name parameterfile_class_dump_specific_heap_file()
function, which dumps a specific heap file with class name.