Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
194caa78
Commit
194caa78
authored
Oct 10, 2025
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: use the same serialization method for lookup as for storing
parent
0d975ec0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
kv_backing_storage.rs
...pack/crates/turbo-tasks-backend/src/kv_backing_storage.rs
+24
-12
No files found.
turbopack/crates/turbo-tasks-backend/src/kv_backing_storage.rs
View file @
194caa78
...
@@ -357,8 +357,12 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
...
@@ -357,8 +357,12 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
let
mut
task_type_bytes
=
Vec
::
new
();
let
mut
task_type_bytes
=
Vec
::
new
();
for
(
task_type
,
task_id
)
in
updates
{
for
(
task_type
,
task_id
)
in
updates
{
serialize_task_type
(
&
task_type
,
&
mut
task_type_bytes
,
Some
(
task_id
),
)
?
;
let
task_id
:
u32
=
*
task_id
;
let
task_id
:
u32
=
*
task_id
;
serialize_task_type
(
&
task_type
,
&
mut
task_type_bytes
,
task_id
)
?
;
if
task_type
.get_name
()
.contains
(
"with_modules"
)
{
if
task_type
.get_name
()
.contains
(
"with_modules"
)
{
println!
(
println!
(
"Stored task type: {task_type:?} => {task_id}
\
"Stored task type: {task_type:?} => {task_id}
\
...
@@ -447,8 +451,8 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
...
@@ -447,8 +451,8 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
.entered
();
.entered
();
let
mut
task_type_bytes
=
Vec
::
new
();
let
mut
task_type_bytes
=
Vec
::
new
();
for
(
task_type
,
task_id
)
in
task_cache_updates
.into_iter
()
.flatten
()
{
for
(
task_type
,
task_id
)
in
task_cache_updates
.into_iter
()
.flatten
()
{
serialize_task_type
(
&
task_type
,
&
mut
task_type_bytes
,
Some
(
task_id
))
?
;
let
task_id
=
*
task_id
;
let
task_id
=
*
task_id
;
serialize_task_type
(
&
task_type
,
&
mut
task_type_bytes
,
task_id
)
?
;
batch
batch
.put
(
.put
(
...
@@ -511,7 +515,8 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
...
@@ -511,7 +515,8 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
success
=
tracing
::
field
::
Empty
success
=
tracing
::
field
::
Empty
)
)
.entered
();
.entered
();
let
task_type_bytes
=
POT_CONFIG
.serialize
(
task_type
)
?
;
let
mut
task_type_bytes
=
Vec
::
new
();
serialize_task_type
(
&
task_type
,
&
mut
task_type_bytes
,
None
)
?
;
let
result
=
database
.get
(
tx
,
KeySpace
::
ForwardTaskCache
,
&
task_type_bytes
)
?
;
let
result
=
database
.get
(
tx
,
KeySpace
::
ForwardTaskCache
,
&
task_type_bytes
)
?
;
let
Some
(
bytes
)
=
result
else
{
let
Some
(
bytes
)
=
result
else
{
if
task_type
.get_name
()
.contains
(
"with_modules"
)
{
if
task_type
.get_name
()
.contains
(
"with_modules"
)
{
...
@@ -666,15 +671,22 @@ where
...
@@ -666,15 +671,22 @@ where
Ok
(())
Ok
(())
}
}
#[inline(never)]
fn
serialize_task_type
(
fn
serialize_task_type
(
task_type
:
&
Arc
<
CachedTaskType
>
,
task_type
:
&
CachedTaskType
,
mut
task_type_bytes
:
&
mut
Vec
<
u8
>
,
mut
task_type_bytes
:
&
mut
Vec
<
u8
>
,
task_id
:
u32
,
task_id
:
Option
<
TaskId
>
,
)
->
Result
<
()
>
{
)
->
Result
<
()
>
{
task_type_bytes
.clear
();
task_type_bytes
.clear
();
POT_CONFIG
POT_CONFIG
.serialize_into
(
&**
task_type
,
&
mut
task_type_bytes
)
.serialize_into
(
&*
task_type
,
&
mut
task_type_bytes
)
.with_context
(||
anyhow!
(
"Unable to serialize task {task_id} cache key {task_type:?}"
))
?
;
.with_context
(||
{
if
let
Some
(
task_id
)
=
task_id
{
anyhow!
(
"Unable to serialize task {task_id} cache key {task_type:?}"
)
}
else
{
anyhow!
(
"Unable to serialize task cache key {task_type:?}"
)
}
})
?
;
#[cfg(feature
=
"verify_serialization3"
)]
#[cfg(feature
=
"verify_serialization3"
)]
{
{
let
deserialize
:
Result
<
CachedTaskType
,
_
>
=
serde_path_to_error
::
deserialize
(
let
deserialize
:
Result
<
CachedTaskType
,
_
>
=
serde_path_to_error
::
deserialize
(
...
@@ -682,19 +694,19 @@ fn serialize_task_type(
...
@@ -682,19 +694,19 @@ fn serialize_task_type(
);
);
match
deserialize
{
match
deserialize
{
Ok
(
value
)
=>
{
Ok
(
value
)
=>
{
if
value
!=
*
*
task_type
{
if
value
!=
*
task_type
{
println!
(
println!
(
"Task type would not round-trip {task_id}:
\n
Original:
\
"Task type would not round-trip {task_id
:?
}:
\n
Original:
\
{task_type:#?}
\n
Round-tripped: {value:#?}"
{task_type:#?}
\n
Round-tripped: {value:#?}"
);
);
panic!
(
"Task type would not round-trip {task_id}"
);
panic!
(
"Task type would not round-trip {task_id
:?
}"
);
}
}
}
}
Err
(
err
)
=>
{
Err
(
err
)
=>
{
println!
(
println!
(
"Task type would not be deserializable {task_id}: {err:?}
\n
{task_type:#?}"
"Task type would not be deserializable {task_id
:?
}: {err:?}
\n
{task_type:#?}"
);
);
panic!
(
"Task type would not be deserializable {task_id}: {err:?}"
);
panic!
(
"Task type would not be deserializable {task_id
:?
}: {err:?}"
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment