apache/incubator-seata · warning · NotSupportYetException

not support atomic operation putConfigIfAbsent

Error message

not support atomic operation putConfigIfAbsent

What it means

ApolloConfiguration.putConfigIfAbsent throws NotSupportYetException('not support atomic operation putConfigIfAbsent'). Atomic check-and-set publish is not implemented because Apollo's client API used by seata exposes no atomic putIfAbsent; Apollo namespaces are edited via its portal. The exception makes the missing capability explicit rather than faking it with a non-atomic sequence.

Source

Thrown at config/seata-config-apollo/src/main/java/org/apache/seata/config/apollo/ApolloConfiguration.java:142

    @Override
    public String getLatestConfig(String dataId, String defaultValue, long timeoutMills) {
        ConfigFuture configFuture =
                new ConfigFuture(dataId, defaultValue, ConfigFuture.ConfigOperation.GET, timeoutMills);
        configOperateExecutor.submit(() -> {
            String result = config.getProperty(dataId, defaultValue);
            configFuture.setResult(result);
        });
        return (String) configFuture.get();
    }

    @Override
    public boolean putConfig(String dataId, String content, long timeoutMills) {
        throw new NotSupportYetException("not support putConfig");
    }

    @Override
    public boolean putConfigIfAbsent(String dataId, String content, long timeoutMills) {
        throw new NotSupportYetException("not support atomic operation putConfigIfAbsent");
    }

    @Override
    public boolean removeConfig(String dataId, long timeoutMills) {
        throw new NotSupportYetException("not support removeConfig");
    }

    @Override
    public void addConfigListener(String dataId, ConfigurationChangeListener listener) {
        if (StringUtils.isBlank(dataId) || listener == null) {
            return;
        }
        LISTENER_SERVICE_MAP
                .computeIfAbsent(dataId, key -> ConcurrentHashMap.newKeySet())
                .add(listener);
    }

    @Override

View on GitHub (pinned to e01f97c6db)

Solutions

  1. Pre-create the config keys in Apollo via portal/OpenAPI before starting seata.
  2. Guard the call with a check of getTypeName()/backend capability before invoking putConfigIfAbsent.
  3. Switch to nacos/consul/etcd3 if atomic publish is required at runtime.
  4. Catch NotSupportYetException where the write is best-effort.

Example fix

// before
boolean created = configuration.putConfigIfAbsent(dataId, content, timeoutMills);

// after
boolean created;
try {
    created = configuration.putConfigIfAbsent(dataId, content, timeoutMills);
} catch (NotSupportYetException e) {
    LOGGER.warn("putConfigIfAbsent unsupported on apollo; pre-create {} in the Apollo portal", dataId);
    created = false;
}
Defensive patterns

Strategy: try-catch

Validate before calling

"apollo".equals(configuration.getTypeName()) // avoid putConfigIfAbsent on read-only backends

Try / catch

try {
    configuration.putConfigIfAbsent(dataId, content, timeoutMills);
} catch (NotSupportYetException e) {
    LOGGER.warn("atomic put unsupported on {}; pre-create the key out-of-band", configuration.getTypeName());
}

Prevention

When it happens

Trigger: Calling putConfigIfAbsent on a Configuration whose type is apollo — typically initialization code that tries to register default config values if absent (works on Nacos, throws here).

Common situations: Porting bootstrap/init logic from Nacos-backed seata to Apollo; shared config- provisioning utilities assuming all backends support CAS writes.

Related errors


AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14). Data as JSON: /api/errors/ff543d712a75aca4. Report an issue: GitHub.