Kouhei Sutou
null+****@clear*****
Tue Aug 15 22:02:44 JST 2017
Kouhei Sutou 2017-08-15 22:02:44 +0900 (Tue, 15 Aug 2017) New Revision: 58e97b7473361fea40793490e382aeb11b792f70 https://github.com/groonga/groonga/commit/58e97b7473361fea40793490e382aeb11b792f70 Message: object_inspect: show disk usage Modified files: lib/proc/proc_object_inspect.c test/command/suite/object_inspect/column/index.expected test/command/suite/object_inspect/column/scalar_fix.expected test/command/suite/object_inspect/column/scalar_var.expected test/command/suite/object_inspect/column/vector.expected test/command/suite/object_inspect/db.expected test/command/suite/object_inspect/table/have_records/dat_key.expected test/command/suite/object_inspect/table/have_records/hash_key.expected test/command/suite/object_inspect/table/have_records/no_key.expected test/command/suite/object_inspect/table/have_records/pat_key.expected test/command/suite/object_inspect/table/no_record/dat_key.expected test/command/suite/object_inspect/table/no_record/hash_key.expected test/command/suite/object_inspect/table/no_record/no_key.expected test/command/suite/object_inspect/table/no_record/pat_key.expected Modified: lib/proc/proc_object_inspect.c (+15 -3) =================================================================== --- lib/proc/proc_object_inspect.c 2017-08-15 22:00:37 +0900 (cd602ac47) +++ lib/proc/proc_object_inspect.c 2017-08-15 22:02:44 +0900 (3b03ccb5e) @@ -76,6 +76,12 @@ command_object_inspect_type(grn_ctx *ctx, grn_obj *type) } static void +command_object_inspect_disk_usage(grn_ctx *ctx, grn_obj *obj) +{ + grn_ctx_output_uint64(ctx, grn_obj_get_disk_usage(ctx, obj)); +} + +static void command_object_inspect_table_hash_key_key(grn_ctx *ctx, grn_hash *hash) { grn_ctx_output_map_open(ctx, "key", 3); @@ -156,7 +162,7 @@ command_object_inspect_table_value(grn_ctx *ctx, grn_obj *table) static void command_object_inspect_table(grn_ctx *ctx, grn_obj *obj) { - grn_ctx_output_map_open(ctx, "table", 6); + grn_ctx_output_map_open(ctx, "table", 7); { grn_ctx_output_cstr(ctx, "id"); grn_ctx_output_uint64(ctx, grn_obj_id(ctx, obj)); @@ -170,6 +176,8 @@ command_object_inspect_table(grn_ctx *ctx, grn_obj *obj) command_object_inspect_table_value(ctx, obj); grn_ctx_output_cstr(ctx, "n_records"); grn_ctx_output_uint64(ctx, grn_table_size(ctx, obj)); + grn_ctx_output_cstr(ctx, "disk_usage"); + command_object_inspect_disk_usage(ctx, obj); } grn_ctx_output_map_close(ctx); } @@ -479,7 +487,7 @@ command_object_inspect_column_index_sources(grn_ctx *ctx, grn_obj *column) static void command_object_inspect_column(grn_ctx *ctx, grn_obj *column) { - int n_elements = 6; + int n_elements = 7; grn_bool is_index = (column->header.type == GRN_COLUMN_INDEX); if (is_index) { @@ -503,6 +511,8 @@ command_object_inspect_column(grn_ctx *ctx, grn_obj *column) grn_ctx_output_cstr(ctx, "sources"); command_object_inspect_column_index_sources(ctx, column); } + grn_ctx_output_cstr(ctx, "disk_usage"); + command_object_inspect_disk_usage(ctx, column); } grn_ctx_output_map_close(ctx); } @@ -512,12 +522,14 @@ command_object_inspect_db(grn_ctx *ctx, grn_obj *obj) { grn_db *db = (grn_db *)obj; - grn_ctx_output_map_open(ctx, "database", 2); + grn_ctx_output_map_open(ctx, "database", 3); { grn_ctx_output_cstr(ctx, "type"); command_object_inspect_obj_type(ctx, obj->header.type); grn_ctx_output_cstr(ctx, "name_table"); command_object_inspect_dispatch(ctx, db->keys); + grn_ctx_output_cstr(ctx, "disk_usage"); + command_object_inspect_disk_usage(ctx, obj); } grn_ctx_output_map_close(ctx); } Modified: test/command/suite/object_inspect/column/index.expected (+8 -4) =================================================================== --- test/command/suite/object_inspect/column/index.expected 2017-08-15 22:00:37 +0900 (e8c8ed08c) +++ test/command/suite/object_inspect/column/index.expected 2017-08-15 22:02:44 +0900 (815d7c3de) @@ -41,7 +41,8 @@ object_inspect Terms.memos_title_content "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4243456 }, "full_name": "Terms.memos_title_content", "type": { @@ -110,7 +111,8 @@ object_inspect Terms.memos_title_content "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4096 }, "full_name": "Memos.title" }, @@ -128,10 +130,12 @@ object_inspect Terms.memos_title_content "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4096 }, "full_name": "Memos.content" } - ] + ], + "disk_usage": 565248 } ] Modified: test/command/suite/object_inspect/column/scalar_fix.expected (+4 -2) =================================================================== --- test/command/suite/object_inspect/column/scalar_fix.expected 2017-08-15 22:00:37 +0900 (9e3fd378b) +++ test/command/suite/object_inspect/column/scalar_fix.expected 2017-08-15 22:02:44 +0900 (6c730bcd1) @@ -35,7 +35,8 @@ object_inspect Users.age "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 65536 }, "full_name": "Users.age", "type": { @@ -56,6 +57,7 @@ object_inspect Users.age "size": 1 }, "compress": null - } + }, + "disk_usage": 4096 } ] Modified: test/command/suite/object_inspect/column/scalar_var.expected (+4 -2) =================================================================== --- test/command/suite/object_inspect/column/scalar_var.expected 2017-08-15 22:00:37 +0900 (d8c62066d) +++ test/command/suite/object_inspect/column/scalar_var.expected 2017-08-15 22:02:44 +0900 (055fb1f4c) @@ -23,7 +23,8 @@ object_inspect Memos.title "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4096 }, "full_name": "Memos.title", "type": { @@ -44,6 +45,7 @@ object_inspect Memos.title "size": 4096 }, "compress": "zstd" - } + }, + "disk_usage": 274432 } ] Modified: test/command/suite/object_inspect/column/vector.expected (+4 -2) =================================================================== --- test/command/suite/object_inspect/column/vector.expected 2017-08-15 22:00:37 +0900 (81f42da67) +++ test/command/suite/object_inspect/column/vector.expected 2017-08-15 22:02:44 +0900 (5c7e29670) @@ -23,7 +23,8 @@ object_inspect Memos.tags "value": { "type": null }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4096 }, "full_name": "Memos.tags", "type": { @@ -44,6 +45,7 @@ object_inspect Memos.tags "size": 4096 }, "compress": null - } + }, + "disk_usage": 274432 } ] Modified: test/command/suite/object_inspect/db.expected (+4 -2) =================================================================== --- test/command/suite/object_inspect/db.expected 2017-08-15 22:00:37 +0900 (465e82780) +++ test/command/suite/object_inspect/db.expected 2017-08-15 22:02:44 +0900 (58a6a25a8) @@ -21,7 +21,9 @@ object_inspect "type": null }, "value": null, - "n_records": 255 - } + "n_records": 255, + "disk_usage": 1052672 + }, + "disk_usage": 26542080 } ] Modified: test/command/suite/object_inspect/table/have_records/dat_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/have_records/dat_key.expected 2017-08-15 22:00:37 +0900 (f10f7c338) +++ test/command/suite/object_inspect/table/have_records/dat_key.expected 2017-08-15 22:02:44 +0900 (5568cc1c3) @@ -32,6 +32,7 @@ object_inspect Users } }, "value": null, - "n_records": 2 + "n_records": 2, + "disk_usage": 1052672 } ] Modified: test/command/suite/object_inspect/table/have_records/hash_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/have_records/hash_key.expected 2017-08-15 22:00:37 +0900 (ef759d46a) +++ test/command/suite/object_inspect/table/have_records/hash_key.expected 2017-08-15 22:02:44 +0900 (2f9ecb2fd) @@ -44,6 +44,7 @@ object_inspect Users "size": 4 } }, - "n_records": 2 + "n_records": 2, + "disk_usage": 16842752 } ] Modified: test/command/suite/object_inspect/table/have_records/no_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/have_records/no_key.expected 2017-08-15 22:00:37 +0900 (a306547b1) +++ test/command/suite/object_inspect/table/have_records/no_key.expected 2017-08-15 22:02:44 +0900 (0b0c162b1) @@ -32,6 +32,7 @@ object_inspect Points "size": 8 } }, - "n_records": 2 + "n_records": 2, + "disk_usage": 8400896 } ] Modified: test/command/suite/object_inspect/table/have_records/pat_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/have_records/pat_key.expected 2017-08-15 22:00:37 +0900 (599679eb1) +++ test/command/suite/object_inspect/table/have_records/pat_key.expected 2017-08-15 22:02:44 +0900 (75b0ad5d5) @@ -44,6 +44,7 @@ object_inspect Users "size": 8 } }, - "n_records": 2 + "n_records": 2, + "disk_usage": 8445952 } ] Modified: test/command/suite/object_inspect/table/no_record/dat_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/no_record/dat_key.expected 2017-08-15 22:00:37 +0900 (86c876803) +++ test/command/suite/object_inspect/table/no_record/dat_key.expected 2017-08-15 22:02:44 +0900 (d1bf15694) @@ -26,6 +26,7 @@ object_inspect Users } }, "value": null, - "n_records": 0 + "n_records": 0, + "disk_usage": 4096 } ] Modified: test/command/suite/object_inspect/table/no_record/hash_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/no_record/hash_key.expected 2017-08-15 22:00:37 +0900 (bc37fafbc) +++ test/command/suite/object_inspect/table/no_record/hash_key.expected 2017-08-15 22:02:44 +0900 (d3eb9b768) @@ -38,6 +38,7 @@ object_inspect Users "size": 4 } }, - "n_records": 0 + "n_records": 0, + "disk_usage": 65536 } ] Modified: test/command/suite/object_inspect/table/no_record/no_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/no_record/no_key.expected 2017-08-15 22:00:37 +0900 (c5232509a) +++ test/command/suite/object_inspect/table/no_record/no_key.expected 2017-08-15 22:02:44 +0900 (5a2c19582) @@ -26,6 +26,7 @@ object_inspect Points "size": 8 } }, - "n_records": 0 + "n_records": 0, + "disk_usage": 12288 } ] Modified: test/command/suite/object_inspect/table/no_record/pat_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table/no_record/pat_key.expected 2017-08-15 22:00:37 +0900 (1c7f4f9bc) +++ test/command/suite/object_inspect/table/no_record/pat_key.expected 2017-08-15 22:02:44 +0900 (95b4ca163) @@ -38,6 +38,7 @@ object_inspect Users "size": 8 } }, - "n_records": 0 + "n_records": 0, + "disk_usage": 4251648 } ] -------------- next part -------------- HTML����������������������������...Download