Skip to content

Commit

Permalink
Fixed exceptions in C# SDK when someone disconnects or when a transac…
Browse files Browse the repository at this point in the history
…tion originates from CLI (#1461)

Co-authored-by: Steve Boytsun <[email protected]>
  • Loading branch information
SteveBoytsun and Steve Boytsun authored Jun 26, 2024
1 parent 8be8fc1 commit 81085b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/cli/src/subcommands/generate/csharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,9 @@ pub fn autogen_csharp_globals(items: &[GenItem], namespace: &str) -> Vec<(String
);
}
writeln!(output, "\"<none>\" => null,");
writeln!(output, "\"__identity_connected__\" => null,");
writeln!(output, "\"__identity_disconnected__\" => null,");
writeln!(output, "\"\" => null,"); //Transaction from CLI command
writeln!(
output,
r#"var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {{reducer}}")"#
Expand Down
3 changes: 3 additions & 0 deletions crates/cli/tests/snapshots/codegen__codegen_csharp.snap
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,9 @@ namespace SpacetimeDB
"repeating_test" => BSATNHelpers.FromProtoBytes<RepeatingTestArgsStruct>(argBytes),
"test" => BSATNHelpers.FromProtoBytes<TestArgsStruct>(argBytes),
"<none>" => null,
"__identity_connected__" => null,
"__identity_disconnected__" => null,
"" => null,
var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}")
};
return new ReducerEvent(dbEvent, args);
Expand Down

3 comments on commit 81085b0

@github-actions
Copy link

@github-actions github-actions bot commented on 81085b0 Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot test results

Test results are stored on DO Spaces here. You'll need to log in
(we keep these secret).

The results of this test are named pr--81085b0817ad9648df59257061bedecb1051617f.zip.

@github-actions
Copy link

@github-actions github-actions bot commented on 81085b0 Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarking failed. Please check the workflow run for details.

@github-actions
Copy link

@github-actions github-actions bot commented on 81085b0 Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callgrind benchmark results

Callgrind Benchmark Report

These benchmarks were run using callgrind,
an instruction-level profiler. They allow comparisons between sqlite (sqlite), SpacetimeDB running through a module (stdb_module), and the underlying SpacetimeDB data storage engine (stdb_raw). Callgrind emulates a CPU to collect the below estimates.

Measurement changes larger than five percent are in bold.

In-memory benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5139 5139 0.00% 5207 5207 0.00%
sqlite 5518 5518 0.00% 6016 6016 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 77842 77842 0.00% 78288 78288 0.00%
stdb_raw u32_u64_str no_index 64 128 2 string 120512 120512 0.00% 121162 121162 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23073 23073 0.00% 23331 23327 0.02%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24111 24112 -0.00% 24453 24458 -0.02%
sqlite u32_u64_str no_index 64 128 2 string 143491 143491 0.00% 144995 144995 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 122842 122842 0.00% 124176 124172 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 133290 133290 0.00% 134854 134858 -0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 130149 130149 0.00% 131553 131561 -0.01%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 872215 871963 0.03% 888565 888341 0.03%
stdb_raw u32_u64_str btree_each_column 64 128 1008052 1011516 -0.34% 1035024 1038852 -0.37%
sqlite u32_u64_str unique_0 64 128 396145 396139 0.00% 410833 410827 0.00%
sqlite u32_u64_str btree_each_column 64 128 981456 981456 0.00% 1008092 1008092 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 151334 151334 0.00% 151406 151406 0.00%
stdb_raw u32_u64_str unique_0 64 15319 15311 0.05% 15387 15379 0.05%
sqlite u32_u64_str unique_0 1024 1046680 1046680 0.00% 1049902 1049902 0.00%
sqlite u32_u64_str unique_0 64 74826 74826 0.00% 75752 75752 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47438 47438 0.00% 50056 50056 0.00%
64 bsatn 25716 25716 0.00% 27926 27926 0.00%
16 bsatn 8117 8117 0.00% 9409 9409 0.00%
16 json 12142 12142 0.00% 14012 14012 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 20424934 20425452 -0.00% 20966874 20966774 0.00%
stdb_raw u32_u64_str unique_0 64 128 1275718 1275958 -0.02% 1313722 1313922 -0.02%
sqlite u32_u64_str unique_0 1024 1024 1802040 1802040 0.00% 1811070 1811070 0.00%
sqlite u32_u64_str unique_0 64 128 128386 128386 0.00% 131262 131262 0.00%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5149 5149 0.00% 5217 5217 0.00%
sqlite 5560 5560 0.00% 6102 6102 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 77852 77852 0.00% 78294 78294 0.00%
stdb_raw u32_u64_str no_index 64 128 2 string 120522 120522 0.00% 121160 121160 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23083 23083 0.00% 23337 23337 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24121 24479 -1.46% 24463 24865 -1.62%
sqlite u32_u64_str no_index 64 128 2 string 145412 145412 0.00% 147264 147264 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124753 124753 0.00% 126357 126357 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 135412 135412 0.00% 137570 137570 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 132245 132245 0.00% 134083 134083 0.00%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 821005 820920 0.01% 837783 837642 0.02%
stdb_raw u32_u64_str btree_each_column 64 128 956685 958723 -0.21% 984767 986725 -0.20%
sqlite u32_u64_str unique_0 64 128 413676 413676 0.00% 427702 427702 0.00%
sqlite u32_u64_str btree_each_column 64 128 1019717 1019717 0.00% 1045667 1045647 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 151344 151344 0.00% 151412 151412 0.00%
stdb_raw u32_u64_str unique_0 64 15321 15321 0.00% 15389 15389 0.00%
sqlite u32_u64_str unique_0 1024 1049748 1049748 0.00% 1053394 1053394 0.00%
sqlite u32_u64_str unique_0 64 76598 76598 0.00% 77792 77792 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47438 47438 0.00% 50056 50056 0.00%
64 bsatn 25716 25716 0.00% 27926 27926 0.00%
16 bsatn 8117 8117 0.00% 9409 9409 0.00%
16 json 12142 12142 0.00% 14012 14012 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 18963814 18965198 -0.01% 19600968 19602404 -0.01%
stdb_raw u32_u64_str unique_0 64 128 1232753 1232826 -0.01% 1302829 1302914 -0.01%
sqlite u32_u64_str unique_0 1024 1024 1809601 1809601 0.00% 1818237 1818237 0.00%
sqlite u32_u64_str unique_0 64 128 132512 132512 0.00% 135500 135500 0.00%

Please sign in to comment.