mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
## Summary Bug fix for - https://github.com/openobserve/openobserve/issues/12247 - **Bug:** Creating a URL enrichment table with name `X`, then creating a file upload enrichment also named `X` (or vice versa), silently overwrites the first one at every storage layer. - **Fix:** Added cross-type name collision checks at the API boundary. The file upload handler now rejects if a URL enrichment already exists with the same name, and the URL handler rejects if a file upload enrichment already exists. Same-type updates (append/retry/replace) are unaffected. ## Root Cause Enrichment tables are uniquely identified by `(org_id, table_name)` across all storage layers — database, caches, object store, and coordinator keys. Both URL-based and file-upload enrichments share the same `StreamType::EnrichmentTables` and the same key space, so creating one with the same name as another silently clobbers the previous one. ## Changes **1 file changed** — [src/handler/http/request/enrichment_table/mod.rs](src/handler/http/request/enrichment_table/mod.rs) ### `save_enrichment_table` (file upload handler) Added check after input validation: if the table name already exists in `ENRICHMENT_TABLES` and has URL jobs, return `400` — "already exists as a URL enrichment." ### `save_enrichment_table_from_url` (URL handler) Added check after fetching existing jobs: if the table name exists in `ENRICHMENT_TABLES` but has no URL jobs, return `400` — "already exists as a file upload enrichment." ### Behavior matrix | | Existing: URL | Existing: File Upload | Existing: None | |---|---|---|---| | **Create File Upload** | ❌ Reject (400) | ✅ Allow (update) | ✅ Allow | | **Create URL** | ✅ Allow (update) | ❌ Reject (400) | ✅ Allow | ## Test Plan - [ ] Manually verify: create a URL enrichment named `test_cross_type` → attempt file upload with same name → should get 400 error - [ ] Manually verify: create a file upload enrichment named `test_cross_type2` → attempt URL creation with same name → should get 400 error - [ ] Manually verify: same-type updates still work (file→file append, URL→URL retry/replace) - [ ] Playwright automation will be added in a follow-up PR in the `RegressionSet` folder 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>