bug: InMemoryCatalog skips the namespace existence check in CreateTable and RegisterTable
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Comienza en src/iceberg/catalog/memory/in_memory_catalog.cc e inspecciona CreateTable y RegisterTable; después compara el manejo de namespaces con SqlCatalog::CreateTable. Se considera terminado cuando los namespaces inexistentes se rechazan como kNoSuchNamespace antes de escribir los metadatos, sin cambiar el comportamiento de registro duplicado que queda fuera del alcance.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
InMemoryCatalog fails to validate that a table's namespace exists before acting, in two methods.
CreateTable writes the table metadata file through FileIO before it checks the namespace. Creating a table under a namespace that does not exist returns kNoSuchNamespace, but on an object-store FileIO the call first writes an orphaned 00000-<uuid>.metadata.json that nothing ever removes (DropTable's purge only touches registered tables). On the default local FileIO the stray write fails first, so the caller gets a misleading kIOError instead of kNoSuchNamespace.
RegisterTable guards with if (!root_namespace_->NamespaceExists(identifier.ns)). NamespaceExists returns Result<bool> (std::expected<bool, Error>); !result tests has_value(), not the contained bool, and a missing namespace is reported as a value false, never an error. The guard therefore never fires, so registering under a missing namespace falls through and surfaces as kUnknownError ("The registry failed.") instead of kNoSuchNamespace.
Root Cause
CreateTable (src/iceberg/catalog/memory/in_memory_catalog.cc): the namespace is only enforced inside UpdateTableMetadataLocation, which runs after TableMetadataUtil::Write has already persisted the file. TableExists(identifier).value_or(false) ahead of the write swallows the kNoSuchNamespace from the namespace lookup and reports "table absent", so control falls through to the write.
RegisterTable: if (!root_namespace_->NamespaceExists(identifier.ns)) reads as if (!result.has_value()). NamespaceExists maps a missing namespace to Ok(false), so the branch is dead code; the error later comes out of the inner RegisterTable and is rewritten to kUnknownError.
Impact
CreateTable leaks an orphan metadata file on object-store FileIO and returns the wrong error kind (kIOError) on local FileIO. InMemoryCatalog is documented as not for production use (unit tests, prototyping, demonstration), so this is a correctness and robustness issue, not a security one.
RegisterTable returns kUnknownError for a missing namespace instead of kNoSuchNamespace. SqlCatalog::RegisterTable and the REST error handler both return kNoSuchNamespace, so InMemoryCatalog is the outlier here.
Proposed Fix
Unwrap NamespaceExists and return kNoSuchNamespace before any metadata write, in both methods, mirroring SqlCatalog::CreateTable.
Out of scope
RegisterTablestill maskskAlreadyExistsaskUnknownErroron the duplicate-registration path (if (!root_namespace_->RegisterTable(...))); the clean fix isICEBERG_RETURN_UNEXPECTED(...), asRenameTablealready does. Follow-up.StageCreateTableandUpdateTable's create branch share the same write-before-validate pattern. Follow-up.
- Lenguaje dominante
- C++
- Estrellas
- 226
- Forks
- 132
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 26
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 apache/iceberg-cpp
-
bug: ReferenceVisitor::GetReferencedFieldIds dereferences null on a bound COUNT(*)Posiblemente ocupada @LuciferYang la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/iceberg-cpp#978 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
apache/iceberg-cpp#973 ·
Los mantenedores suelen responder en 2 días
-
bug: expression JSON deserialization throws an uncaught exception on a non-string "type"/"term"Posiblemente ocupada @LuciferYang la tomó hace 6 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
apache/iceberg-cpp#979 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
apache/iceberg-cpp#959 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/iceberg-cpp#946 · 5 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/iceberg-cpp
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
flashinfer-ai/flashinfer#6212 ·
Los mantenedores suelen responder en 1 día
-
bug graphics
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
FlaxEngine/FlaxEngine#4295 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Algorithmiq/monoprop#390 ·
Los mantenedores suelen responder en 1 día
-
docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
leethomason/tinyxml2#1097 ·