Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 6d75cf9

Browse files
merge: #3502
3502: Revert "feat(dal,si-events): Move node weights off the graph" r=zacharyhamm a=zacharyhamm Reverts #3483 Had a serious negative perf impact which needs to be solved first Co-authored-by: Zachary Hamm <zsh@imipolexg.org>
2 parents ee2408a + 65660b2 commit 6d75cf9

60 files changed

Lines changed: 8493 additions & 6955 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 68 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ directories = "5.0.1"
9494
docker-api = "0.14.0"
9595
dyn-clone = "1.0.17"
9696
flate2 = "1.0.28"
97-
futures = {version = "0.3.30", features = ["executor"]}
97+
futures = "0.3.30"
9898
futures-lite = "2.3.0"
9999
hex = "0.4.3"
100100
http = "0.2.12" # todo: upgrade this alongside hyper/axum/tokio-tungstenite/tower-http

lib/dal-test/BUCK

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ rust_library(
55
deps = [
66
"//lib/buck2-resources:buck2-resources",
77
"//lib/council-server:council-server",
8-
"//lib/dal:dal-integration-test",
8+
"//lib/dal:dal",
99
"//lib/module-index-client:module-index-client",
10-
"//lib/pinga-server:pinga-server-integration-test",
11-
"//lib/rebaser-server:rebaser-server-integration-test",
10+
"//lib/pinga-server:pinga-server",
11+
"//lib/rebaser-server:rebaser-server",
1212
"//lib/si-crypto:si-crypto",
1313
"//lib/si-data-nats:si-data-nats",
1414
"//lib/si-data-pg:si-data-pg",

lib/dal-test/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ impl Config {
138138
config.pg.port = env::var(ENV_VAR_PG_PORT)
139139
.unwrap_or_else(|_| DEFAULT_TEST_PG_PORT_STR.to_string())
140140
.parse()?;
141-
142-
config.pg.pool_max_size = 4;
141+
config.pg.pool_max_size *= 32;
143142
config.pg.certificate_path = Some(config.postgres_key_path.clone().try_into()?);
144143

145144
if let Ok(value) = env::var(ENV_VAR_PG_HOSTNAME) {
@@ -152,7 +151,7 @@ impl Config {
152151
config.layer_cache_pg_pool.port = env::var(ENV_VAR_PG_PORT)
153152
.unwrap_or_else(|_| DEFAULT_TEST_PG_PORT_STR.to_string())
154153
.parse()?;
155-
config.layer_cache_pg_pool.pool_max_size = 4;
154+
config.layer_cache_pg_pool.pool_max_size *= 32;
156155
config.layer_cache_pg_pool.certificate_path =
157156
Some(config.postgres_key_path.clone().try_into()?);
158157

lib/dal/BUCK

Lines changed: 2 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load(
22
"@prelude-si//:macros.bzl",
33
"rust_library",
4-
"rust_library_integration_test",
54
"rust_test",
65
)
76

@@ -76,83 +75,6 @@ rust_library(
7675
test_unit_deps = [
7776
"//third-party/rust:tempfile",
7877
],
79-
)
80-
81-
rust_library_integration_test(
82-
name = "dal-integration-test",
83-
crate = "dal",
84-
deps = [
85-
"//lib/si-cbor:si-cbor",
86-
"//lib/council-server:council-server",
87-
"//lib/nats-subscriber:nats-subscriber",
88-
"//lib/object-tree:object-tree",
89-
"//lib/si-crypto:si-crypto",
90-
"//lib/si-data-nats:si-data-nats",
91-
"//lib/si-data-pg:si-data-pg",
92-
"//lib/si-events-rs:si-events",
93-
"//lib/si-hash:si-hash",
94-
"//lib/si-layer-cache:si-layer-cache",
95-
"//lib/si-pkg:si-pkg",
96-
"//lib/si-std:si-std",
97-
"//lib/telemetry-rs:telemetry",
98-
"//lib/telemetry-nats-rs:telemetry-nats",
99-
"//lib/veritech-client:veritech-client",
100-
"//third-party/rust:async-recursion",
101-
"//third-party/rust:async-trait",
102-
"//third-party/rust:base64",
103-
"//third-party/rust:blake3",
104-
"//third-party/rust:chrono",
105-
"//third-party/rust:ciborium",
106-
"//third-party/rust:convert_case",
107-
"//third-party/rust:derive_more",
108-
"//third-party/rust:diff",
109-
"//third-party/rust:dyn-clone",
110-
"//third-party/rust:futures",
111-
"//third-party/rust:hex",
112-
"//third-party/rust:iftree",
113-
"//third-party/rust:itertools",
114-
"//third-party/rust:jwt-simple",
115-
"//third-party/rust:lazy_static",
116-
"//third-party/rust:once_cell",
117-
"//third-party/rust:paste",
118-
"//third-party/rust:petgraph",
119-
"//third-party/rust:postcard",
120-
"//third-party/rust:postgres-types",
121-
"//third-party/rust:pretty_assertions_sorted",
122-
"//third-party/rust:rand",
123-
"//third-party/rust:refinery",
124-
"//third-party/rust:regex",
125-
"//third-party/rust:remain",
126-
"//third-party/rust:serde",
127-
"//third-party/rust:serde-aux",
128-
"//third-party/rust:serde_json",
129-
"//third-party/rust:serde_with",
130-
"//third-party/rust:sled",
131-
"//third-party/rust:sodiumoxide",
132-
"//third-party/rust:strum",
133-
"//third-party/rust:thiserror",
134-
"//third-party/rust:tokio",
135-
"//third-party/rust:tokio-stream",
136-
"//third-party/rust:ulid",
137-
"//third-party/rust:url",
138-
],
139-
rustc_flags = [
140-
"--cfg=integration_test",
141-
],
142-
srcs = glob([
143-
"src/**/*.rs",
144-
"src/builtins/func/**",
145-
"src/builtins/schema/data/**/*.json",
146-
"src/builtins/schema/definitions/**/*.json",
147-
"src/migrations/**/*.sql",
148-
"src/queries/**/*.sql",
149-
]),
150-
env = {
151-
"CARGO_MANIFEST_DIR": ".",
152-
},
153-
test_unit_deps = [
154-
"//third-party/rust:tempfile",
155-
],
15678
extra_test_targets = [":test-integration"],
15779
)
15880

@@ -161,8 +83,7 @@ rust_test(
16183
deps = [
16284
"//lib/dal-test:dal-test",
16385
"//lib/rebaser-core:rebaser-core",
164-
"//lib/rebaser-server:rebaser-server-integration-test",
165-
"//lib/si-events-rs:si-events",
86+
"//lib/rebaser-server:rebaser-server",
16687
"//lib/si-pkg:si-pkg",
16788
"//lib/veritech-client:veritech-client",
16889
"//third-party/rust:base64",
@@ -177,7 +98,7 @@ rust_test(
17798
"//third-party/rust:tokio",
17899
"//third-party/rust:tokio-util",
179100
"//third-party/rust:ulid",
180-
":dal-integration-test",
101+
":dal",
181102
],
182103
crate_root = "tests/integration.rs",
183104
srcs = glob([

lib/dal/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,5 @@ veritech-client = { path = "../../lib/veritech-client" }
7070

7171
itertools = { workspace = true }
7272
pretty_assertions_sorted = { workspace = true }
73-
si-events = { path = "../../lib/si-events-rs" }
7473
tempfile = { workspace = true }
7574
tokio-util = { workspace = true }

lib/dal/src/action/prototype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl ActionPrototype {
282282
{
283283
let node_weight = workspace_snapshot.get_node_weight(node_index).await?;
284284
let id = node_weight.id();
285-
if NodeWeightDiscriminants::Func == node_weight.as_ref().into() {
285+
if NodeWeightDiscriminants::Func == node_weight.into() {
286286
return Ok(id.into());
287287
}
288288
}

lib/dal/src/attribute/prototype.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl AttributePrototype {
157157
{
158158
let node_weight = workspace_snapshot.get_node_weight(node_index).await?;
159159
let node_weight_id = node_weight.id();
160-
if NodeWeightDiscriminants::Func == node_weight.as_ref().into() {
160+
if NodeWeightDiscriminants::Func == node_weight.into() {
161161
return Ok(node_weight_id.into());
162162
}
163163
}
@@ -356,7 +356,6 @@ impl AttributePrototype {
356356
let (target_id, edge_weight_discrim) = match workspace_snapshot
357357
.get_node_weight(prototype_edge_source)
358358
.await?
359-
.as_ref()
360359
{
361360
NodeWeight::Prop(prop_inner) => {
362361
(prop_inner.id(), EdgeWeightKindDiscriminants::Prop)
@@ -391,7 +390,6 @@ impl AttributePrototype {
391390
if let NodeWeight::AttributeValue(av_node_weight) = workspace_snapshot
392391
.get_node_weight(attribute_value_target)
393392
.await?
394-
.as_ref()
395393
{
396394
attribute_value_ids.push(av_node_weight.id().into())
397395
}
@@ -428,10 +426,8 @@ impl AttributePrototype {
428426

429427
Ok(match maybe_value_idxs.first().copied() {
430428
Some(value_idx) => {
431-
if let NodeWeight::AttributeValue(av_node_weight) = workspace_snapshot
432-
.get_node_weight(value_idx)
433-
.await?
434-
.as_ref()
429+
if let NodeWeight::AttributeValue(av_node_weight) =
430+
workspace_snapshot.get_node_weight(value_idx).await?
435431
{
436432
Some(av_node_weight.id().into())
437433
} else {

lib/dal/src/attribute/prototype/argument.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl AttributePrototypeArgument {
134134
)
135135
.await?
136136
{
137-
match workspace_snapshot.get_node_weight(node_idx).await?.as_ref() {
137+
match workspace_snapshot.get_node_weight(node_idx).await? {
138138
NodeWeight::Content(inner) => {
139139
let inner_addr_discrim: ContentAddressDiscriminants =
140140
inner.content_address().into();
@@ -318,7 +318,7 @@ impl AttributePrototypeArgument {
318318
.into_iter()
319319
.next()
320320
{
321-
match workspace_snapshot.get_node_weight(target).await?.as_ref() {
321+
match workspace_snapshot.get_node_weight(target).await? {
322322
NodeWeight::Prop(inner) => {
323323
return Ok(Some(ValueSource::Prop(inner.id().into())));
324324
}
@@ -513,7 +513,7 @@ impl AttributePrototypeArgument {
513513

514514
for idx in apa_node_idxs {
515515
let node_weight = workspace_snapshot.get_node_weight(idx).await?;
516-
if let NodeWeight::AttributePrototypeArgument(apa_weight) = node_weight.as_ref() {
516+
if let NodeWeight::AttributePrototypeArgument(apa_weight) = &node_weight {
517517
if let Some(ArgumentTargets {
518518
destination_component_id,
519519
..

lib/dal/src/attribute/value.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -946,10 +946,8 @@ impl AttributeValue {
946946
let workspace_snapshot = ctx.workspace_snapshot()?;
947947

948948
let prop_node_index = workspace_snapshot.get_node_index_by_id(prop_id).await?;
949-
if let NodeWeight::Prop(prop_inner) = workspace_snapshot
950-
.get_node_weight(prop_node_index)
951-
.await?
952-
.as_ref()
949+
if let NodeWeight::Prop(prop_inner) =
950+
workspace_snapshot.get_node_weight(prop_node_index).await?
953951
{
954952
prop_inner.kind()
955953
} else {
@@ -1277,7 +1275,6 @@ impl AttributeValue {
12771275
.workspace_snapshot()?
12781276
.get_node_weight(node_index)
12791277
.await?
1280-
.as_ref()
12811278
{
12821279
prop_map.insert(
12831280
prop_inner.name().to_string(),
@@ -1375,7 +1372,6 @@ impl AttributeValue {
13751372
match workspace_snapshot
13761373
.get_node_weight(element_prop_index)
13771374
.await?
1378-
.as_ref()
13791375
{
13801376
NodeWeight::Prop(prop_inner) => (prop_inner.id(), prop_inner.kind()),
13811377
_ => {
@@ -1620,7 +1616,6 @@ impl AttributeValue {
16201616
match workspace_snapshot
16211617
.get_node_weight(element_prop_index)
16221618
.await?
1623-
.as_ref()
16241619
{
16251620
NodeWeight::Prop(prop_inner) => (prop_inner.id(), prop_inner.kind()),
16261621
_ => {
@@ -1822,7 +1817,7 @@ impl AttributeValue {
18221817
view: Option<serde_json::Value>,
18231818
) -> AttributeValueResult<()> {
18241819
let workspace_snapshot = ctx.workspace_snapshot()?;
1825-
let (_, av_node_weight) = {
1820+
let (av_idx, av_node_weight) = {
18261821
let av_idx = workspace_snapshot
18271822
.get_node_index_by_id(attribute_value_id)
18281823
.await?;
@@ -1867,6 +1862,7 @@ impl AttributeValue {
18671862
workspace_snapshot
18681863
.add_node(NodeWeight::AttributeValue(new_av_node_weight))
18691864
.await?;
1865+
workspace_snapshot.replace_references(av_idx).await?;
18701866

18711867
Ok(())
18721868
}
@@ -1881,7 +1877,7 @@ impl AttributeValue {
18811877
func_execution_pk: FuncExecutionPk,
18821878
) -> AttributeValueResult<()> {
18831879
let workspace_snapshot = ctx.workspace_snapshot()?;
1884-
let (_av_idx, av_node_weight) = {
1880+
let (av_idx, av_node_weight) = {
18851881
let av_idx = workspace_snapshot
18861882
.get_node_index_by_id(attribute_value_id)
18871883
.await?;
@@ -1942,6 +1938,7 @@ impl AttributeValue {
19421938
workspace_snapshot
19431939
.add_node(NodeWeight::AttributeValue(new_av_node_weight))
19441940
.await?;
1941+
workspace_snapshot.replace_references(av_idx).await?;
19451942

19461943
Ok(())
19471944
}
@@ -1978,7 +1975,7 @@ impl AttributeValue {
19781975
.await?
19791976
{
19801977
let target_node_weight = workspace_snapshot.get_node_weight(target).await?;
1981-
if let NodeWeight::Prop(prop_node_weight) = target_node_weight.as_ref() {
1978+
if let NodeWeight::Prop(prop_node_weight) = &target_node_weight {
19821979
maybe_prop_id = match maybe_prop_id {
19831980
Some(already_found_prop_id) => {
19841981
return Err(AttributeValueError::MultiplePropsFound(
@@ -2097,7 +2094,7 @@ impl AttributeValue {
20972094
.pop()
20982095
{
20992096
let node_weight = workspace_snapshot.get_node_weight(ordering).await?;
2100-
if let NodeWeight::Ordering(ordering_weight) = node_weight.as_ref() {
2097+
if let NodeWeight::Ordering(ordering_weight) = node_weight {
21012098
Ok(ordering_weight
21022099
.order()
21032100
.clone()

0 commit comments

Comments
 (0)