Skip to content

Commit c7f9cb3

Browse files
jeffhostetlerdscho
authored andcommitted
gvfs:trace2: add region/data events for status deserialization
Add trace2 region and data events describing attempts to deserialize status data using a status cache. A category:status, label:deserialize region is pushed around the deserialize code. Deserialization results when reading from a file are: category:status, path = <path> category:status, polled = <number_of_attempts> category:status, result = "ok" | "reject" When reading from STDIN are: category:status, path = "STDIN" category:status, result = "ok" | "reject" Status will fallback and run a normal status scan when a "reject" is reported (unless "--deserialize-wait=fail"). If "ok" is reported, status was able to use the status cache and avoid scanning the workdir. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 918f51b commit c7f9cb3

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

wt-status-deserialize.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,18 @@ static int try_deserialize_read_from_file(const struct wt_status *cmd_s,
725725
enum wt_status_deserialize_wait dw,
726726
struct wt_status *des_s)
727727
{
728-
int k, limit;
728+
int k = 0;
729+
int limit;
729730
int result = DESERIALIZE_ERR;
730731

731732
/*
732733
* For "fail" or "no", try exactly once to read the status cache.
733734
* Return an error if the file is stale.
734735
*/
735-
if (dw == DESERIALIZE_WAIT__FAIL || dw == DESERIALIZE_WAIT__NO)
736-
return try_deserialize_read_from_file_1(cmd_s, path, des_s);
736+
if (dw == DESERIALIZE_WAIT__FAIL || dw == DESERIALIZE_WAIT__NO) {
737+
result = try_deserialize_read_from_file_1(cmd_s, path, des_s);
738+
goto done;
739+
}
737740

738741
/*
739742
* Wait for the status cache file to refresh. Wait duration can
@@ -758,6 +761,12 @@ static int try_deserialize_read_from_file(const struct wt_status *cmd_s,
758761
sleep_millisec(100);
759762
}
760763

764+
done:
765+
trace2_data_string("status", the_repository, "deserialize/path", path);
766+
trace2_data_intmax("status", the_repository, "deserialize/polled", k);
767+
trace2_data_string("status", the_repository, "deserialize/result",
768+
((result == DESERIALIZE_OK) ? "ok" : "reject"));
769+
761770
trace_printf_key(&trace_deserialize,
762771
"wait polled=%d result=%d '%s'",
763772
k, result, path);
@@ -783,6 +792,8 @@ int wt_status_deserialize(const struct wt_status *cmd_s,
783792
struct wt_status des_s;
784793
int result;
785794

795+
trace2_region_enter("status", "deserialize", the_repository);
796+
786797
if (path && *path && strcmp(path, "0")) {
787798
result = try_deserialize_read_from_file(cmd_s, path, dw, &des_s);
788799
} else {
@@ -793,8 +804,14 @@ int wt_status_deserialize(const struct wt_status *cmd_s,
793804
* term, since we cannot read stdin multiple times.
794805
*/
795806
result = wt_deserialize_fd(cmd_s, &des_s, 0);
807+
808+
trace2_data_string("status", the_repository, "deserialize/path", "STDIN");
809+
trace2_data_string("status", the_repository, "deserialize/result",
810+
((result == DESERIALIZE_OK) ? "ok" : "reject"));
796811
}
797812

813+
trace2_region_leave("status", "deserialize", the_repository);
814+
798815
if (result == DESERIALIZE_OK) {
799816
wt_status_get_state(&des_s.state, des_s.branch &&
800817
!strcmp(des_s.branch, "HEAD"));

0 commit comments

Comments
 (0)