Cosmos: Handle late discriminators in materialization
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Comienza revisando la materialización de Cosmos mediante streaming introducida por #38550, centrándote en el escaneo del discriminator de Utf8JsonReader y en el orden de los discriminators del serializer. Compara el comportamiento de los discriminators tardíos con los enfoques mencionados de excepciones de STJ DOM y opt-out; se requiere haber decidido una estrategia y haber realizado la validación correspondiente de rendimiento y corrección.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What problem are you trying to solve?
Since #38550 cosmos materialization is done in a streaming fashion, using Utf8JsonReader.
This is faster and allocation light. Especially when comparing the to previous materializer that used Newtonsoft's DOM as an intermediate step.
However, when a structural type has an inheritance hierarchy, the materializer needs to know the discriminator value before it can start reading other values. Similar to STJ, the materializer will do a scan over the document to find the discriminator property and it's value. A document could be as large as 2MB and the discriminator can appear anywhere in the document. Limited benchmarking has shown that scanning the document can be slow when the discriminator appears late, to the point where STJ's DOM would be faster with very little increase in GC pressure.
The serializer has been changed to put discriminators early in the document, but using different write method or migrating from an older version of EF, we don't know the location of the discriminator
Describe the solution you'd like
To discuss.
STJ actually throws an opt-out exception when the discriminator is not the first property in a json document that has an inheritance hierarchy. We could consider the same, or even switch to DOM when we can't find the discriminator in the first (few) properties. This would mean maintaining 2 methods of materialization tho, which probably isn't worth it. Completely switching to STJ DOM could be an option, but we would be slightly slowing down the happy path materialization.
- Lenguaje dominante
- C#
- Estrellas
- 14.8k
- Forks
- 3.4k
- Merge medio
- 3 d 18 h
- PR fusionados (30 d)
- 159
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/efcore
-
customer-reported
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 2 días
-
Regression in 11.0: replacing an owned instance or re-adding an entity with the same key sets unchanged OnAdd properties to nullPosiblemente ocupada @seragAhmed la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
dotnet/efcore#39617 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
customer-reported
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 2 días
Todos los issues de dotnet/efcore
Issues similares
-
bug emitter:client:csharp
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/typespec#12572 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
needs-area-label
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area-networking
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/aspnetcore#70545 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
Los mantenedores suelen responder en 1 día