{"record":{"id":"5acec77dc0de4a8c","repo":"apache/iceberg","slug":"failed-to-update-d-of-d-succeeded","errorCode":null,"errorMessage":"Failed to update: %d of %d succeeded","messagePattern":"Failed to update: (.+?) of (.+?) succeeded","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java","lineNumber":878,"sourceCode":"  }\n\n  private boolean updateProperties(Namespace namespace, Map<String, String> properties) {\n    String namespaceName = JdbcUtil.namespaceToString(namespace);\n    Stream<String> caseArgs =\n        properties.entrySet().stream()\n            .flatMap(entry -> Stream.of(entry.getKey(), entry.getValue()));\n    Stream<String> whereArgs =\n        Stream.concat(Stream.of(catalogName, namespaceName), properties.keySet().stream());\n\n    String[] args = Stream.concat(caseArgs, whereArgs).toArray(String[]::new);\n\n    int updatedRecords = execute(JdbcUtil.updatePropertiesStatement(properties.size()), args);\n\n    if (updatedRecords == properties.size()) {\n      return true;\n    }\n\n    throw new IllegalStateException(\n        String.format(\n            Locale.ROOT,\n            \"Failed to update: %d of %d succeeded\",\n            updatedRecords,\n            properties.size()));\n  }\n\n  private boolean deleteProperties(Namespace namespace, Set<String> properties) {\n    String namespaceName = JdbcUtil.namespaceToString(namespace);\n    String[] args =\n        Stream.concat(Stream.of(catalogName, namespaceName), properties.stream())\n            .toArray(String[]::new);\n\n    return execute(JdbcUtil.deletePropertiesStatement(properties), args) > 0;\n  }\n\n  @Override\n  protected Map<String, String> properties() {","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L860-L896","documentation":"updateProperties() executes JdbcUtil.updatePropertiesStatement expecting one updated row per property. If fewer rows are updated it throws IllegalStateException \"Failed to update: %d of %d succeeded\" — the UPDATE affected fewer rows than properties supplied, indicating inconsistent catalog rows (e.g., a property row was deleted concurrently).","triggerScenarios":"setProperties where some property keys are missing from the catalog table (deleted concurrently or partially inserted earlier), or the catalog schema's key constraints differ; the UPDATE then matches fewer rows than requested.","commonSituations":"Race with another client dropping the same namespace properties; recovery from a prior partial insert; databases where update counts don't match row matches (depending on driver settings).","solutions":["Retry setProperties; missing keys may need insertProperties instead of update","Reconcile by reading loadNamespaceMetadata and setting only keys that exist for update","Avoid concurrent writers to the same namespace properties","Check for earlier \"Failed to insert\" failures leaving partial state and repair those rows"],"exampleFix":"// before\ncatalog.setProperties(ns, props);\n// after\nMap<String, String> existing = catalog.loadNamespaceMetadata(ns);\nif (existing.keySet().containsAll(props.keySet())) {\n  catalog.setProperties(ns, props);\n} else {\n  throw new IllegalStateException(\"Cannot update missing properties: \" + props.keySet());\n}","handlingStrategy":"validation","validationCode":"Map<String, String> existing = catalog.loadNamespaceMetadata(ns);\nif (!existing.keySet().containsAll(props.keySet())) {\n  throw new IllegalStateException(\"Cannot update: some keys missing in catalog\");\n}\ncatalog.setProperties(ns, props);","typeGuard":null,"tryCatchPattern":"try {\n  catalog.setProperties(ns, props);\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Failed to update\")) {\n    LOG.error(\"Partial property update; re-reading catalog state\");\n    throw e;\n  } else throw e;\n}","preventionTips":["Only update keys that already exist; insert missing keys first","Serialize property updates per namespace across clients","Repair partial state left by earlier insert failures before updating","Be aware some JDBC drivers report update counts differently"],"tags":["jdbc","properties","invariant","concurrency"],"backgroundTag":"internal-invariant-violation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}