alibaba/canal · error · RuntimeException
not allow to change outAdapterKey
Error message
not allow to change outAdapterKey
What it means
HbaseAdapter.updateConfig() rejects a hot-reloaded HBase mapping config whose outerAdapterKey differs from the key the adapter was registered under. The outerAdapterKey is the binding between a MappingConfig and its HbaseAdapter instance, so changing it at runtime would orphan the config.
Source
Thrown at client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/HbaseAdapter.java:244
configMap.put(configName, mappingConfig);
}
public boolean addConfig(String fileName, MappingConfig config) {
if (match(config)) {
hbaseMapping.put(fileName, config);
addSyncConfigToCache(fileName, config);
FileName2KeyMapping.register(getClass().getAnnotation(SPI.class).value(), fileName,
configuration.getKey());
return true;
}
return false;
}
public void updateConfig(String fileName, MappingConfig config) {
if (config.getOuterAdapterKey() != null && !config.getOuterAdapterKey()
.equals(configuration.getKey())) {
// 理论上不允许改这个 因为本身就是通过这个关联起Adapter和Config的
throw new RuntimeException("not allow to change outAdapterKey");
}
hbaseMapping.put(fileName, config);
addSyncConfigToCache(fileName, config);
}
public void deleteConfig(String fileName) {
hbaseMapping.remove(fileName);
for (Map<String, MappingConfig> configMap : mappingConfigCache.values()) {
if (configMap != null) {
configMap.remove(fileName);
}
}
FileName2KeyMapping.unregister(getClass().getAnnotation(SPI.class).value(), fileName);
}
private boolean match(MappingConfig config) {
boolean sameMatch = config.getOuterAdapterKey() != null && config.getOuterAdapterKey()
.equalsIgnoreCase(configuration.getKey());View on GitHub (pinned to 87be50e876)
Solutions
- Keep the outerAdapterKey unchanged when editing an existing mapping file; to move a config between adapters, delete it first then addConfig on the target adapter.
- If you intend to reassign the key, restart the adapter rather than hot-reloading.
- Diff the new YAML against the original and confirm only non-key fields changed.
- Check the adapter's registered key in the canal instance configuration matches the mapping's outerAdapterKey.
Example fix
# before (changed key) hbaseMapping: outerAdapterKey: hbase-cluster-B # was hbase-cluster-A # after (keep the original key) hbaseMapping: outerAdapterKey: hbase-cluster-A
Defensive patterns
Strategy: validation
Validate before calling
// Before hot-reload, confirm outerAdapterKey is unchanged
MappingConfig old = hbaseMapping.get(fileName);
if (old != null && newConfig.getOuterAdapterKey() != null
&& !newConfig.getOuterAdapterKey().equals(configuration.getKey())) {
throw new IllegalStateException("Refusing to change outerAdapterKey; delete and re-add instead");
} Try / catch
try {
adapter.updateConfig(fileName, config);
} catch (RuntimeException e) {
if ("not allow to change outAdapterKey".equals(e.getMessage())) {
logger.error("outerAdapterKey changed; revert it or delete+addConfig instead");
}
throw e;
} Prevention
- Never edit outerAdapterKey of a deployed mapping; restart the adapter to reassign.
- Version-control mapping YAMLs and review diffs before hot-reload.
- To move a config, deleteConfig first then addConfig on the target adapter.
When it happens
Trigger: Calling HbaseAdapter.updateConfig(fileName, config) after editing the mapping YAML so that 'outerAdapterKey' now points to a different adapter key than the one stored in this adapter's configuration.getKey().
Common situations: Editing a running HBase adapter's mapping YAML and changing the outerAdapterKey; copying a config file from another adapter and reloading it; mis-typing the adapter key.
Related errors
- not allow to change outAdapterKey
- hbaseMapping.database
- hbaseMapping.table
- hbaseMapping.hbaseTable
- hbaseMapping.mode
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/9eb1c96b857e2dfc.
Report an issue: GitHub.