Skip to content

Commit

Permalink
history: adjust display for StructuredHistory to "request" terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Dec 24, 2024
1 parent c9575f2 commit de3c0e2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
52 changes: 26 additions & 26 deletions scylla/src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@ impl From<&HistoryCollectorData> for StructuredHistory {
/// StructuredHistory should be used for printing query history.
impl Display for StructuredHistory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "Queries History:")?;
writeln!(f, "Requests History:")?;
for (i, query) in self.requests.iter().enumerate() {
writeln!(f, "=== Query #{} ===", i)?;
writeln!(f, "=== Request #{} ===", i)?;
writeln!(f, "| start_time: {}", query.start_time)?;
writeln!(f, "| Non-speculative attempts:")?;
write_fiber_attempts(&query.non_speculative_fiber, f)?;
Expand All @@ -418,13 +418,13 @@ impl Display for StructuredHistory {
writeln!(f, "|")?;
match &query.result {
Some(RequestHistoryResult::Success(succ_time)) => {
writeln!(f, "| Query successful at {}", succ_time)?;
writeln!(f, "| Request successful at {}", succ_time)?;
}
Some(RequestHistoryResult::Error(err_time, error)) => {
writeln!(f, "| Query failed at {}", err_time)?;
writeln!(f, "| Request failed at {}", err_time)?;
writeln!(f, "| Error: {}", error)?;
}
None => writeln!(f, "| Query still running - no final result yet")?,
None => writeln!(f, "| Request still running - no final result yet")?,
};
writeln!(f, "=================")?;
}
Expand Down Expand Up @@ -550,7 +550,7 @@ mod tests {

assert!(history.requests.is_empty());

let displayed = "Queries History:
let displayed = "Requests History:
";
assert_eq!(displayed, format!("{}", history));
}
Expand All @@ -571,12 +571,12 @@ mod tests {
.is_empty());
assert!(history.requests[0].speculative_fibers.is_empty());

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
|
| Query still running - no final result yet
| Request still running - no final result yet
=================
";

Expand Down Expand Up @@ -604,15 +604,15 @@ mod tests {
Some(AttemptResult::Success(_))
);

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
assert_eq!(displayed, format!("{}", set_one_time(history)));
Expand Down Expand Up @@ -651,8 +651,8 @@ mod tests {
let history: StructuredHistory = history_collector.clone_structured_history();

let displayed =
"Queries History:
=== Query #0 ===
"Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
Expand All @@ -667,7 +667,7 @@ mod tests {
| Error: Database returned an error: Not enough nodes are alive to satisfy required consistency level (consistency: Quorum, required: 2, alive: 1), Error message: Not enough nodes to satisfy consistency
| Retry decision: DontRetry
|
| Query failed at 2022-02-22 20:22:22 UTC
| Request failed at 2022-02-22 20:22:22 UTC
| Error: Database returned an error: Not enough nodes are alive to satisfy required consistency level (consistency: Quorum, required: 2, alive: 1), Error message: Not enough nodes to satisfy consistency
=================
";
Expand Down Expand Up @@ -702,8 +702,8 @@ mod tests {
.attempts
.is_empty());

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
|
Expand All @@ -719,7 +719,7 @@ mod tests {
| > Speculative fiber #2
| fiber start time: 2022-02-22 20:22:22 UTC
|
| Query still running - no final result yet
| Request still running - no final result yet
=================
";
assert_eq!(displayed, format!("{}", set_one_time(history)));
Expand Down Expand Up @@ -778,8 +778,8 @@ mod tests {

let history: StructuredHistory = history_collector.clone_structured_history();

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
Expand Down Expand Up @@ -825,7 +825,7 @@ mod tests {
| request send time: 2022-02-22 20:22:22 UTC
| No result yet
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
assert_eq!(displayed, format!("{}", set_one_time(history)));
Expand Down Expand Up @@ -857,8 +857,8 @@ mod tests {

let history: StructuredHistory = history_collector.clone_structured_history();

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
Expand All @@ -871,16 +871,16 @@ mod tests {
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
=== Query #1 ===
=== Request #1 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
assert_eq!(displayed, format!("{}", set_one_time(history)));
Expand Down
40 changes: 20 additions & 20 deletions scylla/tests/integration/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ async fn successful_query_history() {

let history: StructuredHistory = history_collector.clone_structured_history();

let displayed = "Queries History:
=== Query #0 ===
let displayed = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
assert_eq!(
Expand All @@ -147,24 +147,24 @@ async fn successful_query_history() {

let history2: StructuredHistory = history_collector.clone_structured_history();

let displayed2 = "Queries History:
=== Query #0 ===
let displayed2 = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
=== Query #1 ===
=== Request #1 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
assert_eq!(
Expand All @@ -190,8 +190,8 @@ async fn failed_query_history() {
let history: StructuredHistory = history_collector.clone_structured_history();

let displayed =
"Queries History:
=== Query #0 ===
"Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
Expand All @@ -200,7 +200,7 @@ async fn failed_query_history() {
| Error: Database returned an error: The submitted query has a syntax error, Error message: Error message from database
| Retry decision: DontRetry
|
| Query failed at 2022-02-22 20:22:22 UTC
| Request failed at 2022-02-22 20:22:22 UTC
| Error: Database returned an error: The submitted query has a syntax error, Error message: Error message from database
=================
";
Expand Down Expand Up @@ -254,42 +254,42 @@ async fn iterator_query_history() {

assert!(history.requests.len() >= 4);

let displayed_prefix = "Queries History:
=== Query #0 ===
let displayed_prefix = "Requests History:
=== Request #0 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
=== Query #1 ===
=== Request #1 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
=== Query #2 ===
=== Request #2 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
=== Query #3 ===
=== Request #3 ===
| start_time: 2022-02-22 20:22:22 UTC
| Non-speculative attempts:
| - Attempt #0 sent to 127.0.0.1:19042
| request send time: 2022-02-22 20:22:22 UTC
| Success at 2022-02-22 20:22:22 UTC
|
| Query successful at 2022-02-22 20:22:22 UTC
| Request successful at 2022-02-22 20:22:22 UTC
=================
";
let displayed_str = format!(
Expand Down

0 comments on commit de3c0e2

Please sign in to comment.