You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b0324ef
Browse filesBrowse the repository at this point in the historyBrowse files
Apply additive storage changes at boot on BanyanDB, name the storage stage in StorageManipulationOpt, and log every storage resource's outcome in one place
Boot runs unattended in production, so it applies additive storage changes only; a runtime-rule hot update has an
operator, so a breaking change goes through there only with allowStorageChange=true.
- BanyanDB: an init or default-mode OAP applies an additive difference to every measure, stream and trace at boot
(a new tag or field, a tag moving between families except an entity tag), and refuses a breaking one with an
ERROR log; a property takes any change. @BanyanDB.Stream.AllowBootReshape is removed. A resource this boot
updated also gets the index rules it newly declares after a shared one.
- StorageManipulationOpt carries the stage: Stage {BOOT, RUNTIME}; modes BOOT_INSTALL, RUNTIME_APPLY,
RUNTIME_PEER_VERIFY, RUNTIME_LOCAL_ONLY; outcomes MATCHED, CREATED, UPDATED, DROPPED,
BOOT_REFUSED_BREAKING_CHANGE, RUNTIME_PEER_SCHEMA_ABSENT, RUNTIME_PEER_SCHEMA_DIFFERENT,
RUNTIME_BACKEND_UNTOUCHED. The class Javadoc maps where each mode runs in an OAP cluster. A refusal is checked
against the caller's own outcomes only, so one metric's refusal no longer turns off the next metric of a file.
- ModelInstaller logs each storage resource's outcome with its mode and physical name: DEBUG unchanged, INFO
created / updated / dropped, ERROR an incompatible difference left unapplied. Storage plugins log their DDL at
DEBUG. JDBC records the columns and indexes it added, also when a later statement fails; the ordinary
Elasticsearch index compares settings with the live index and reports a retyped field; a BanyanDB measure drop
records its TopN aggregations and binding.
Copy file name to clipboardExpand all lines: docs/en/changes/changes.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,7 @@
110
110
* Debug the network-alias pairing of OTLP calls through a new admin module, `trace-pairing-debugging` (`SW_TRACE_PAIRING_DEBUGGING`, on by default, requires `trace-analyzer`). `POST /trace-pairing-debugging/start` turns on one capture per OAP node, shared by every reader, as each node owns a share of the traces; it runs while it is read, and stops a minute after the latest read or on `POST /trace-pairing-debugging/stop`, releasing what it found; each capture from a start to its stop is a round with its own `roundId`, which every node in it shares, and each listed entry names the OAP nodes that hold it. `GET /trace-pairing-debugging/pairings` lists, over the nodes, the peers matched to a server, with the server before it when a later match moved it, the callers, the count of calls and each match's outcome (`registered`, `gateway`, `uncomposed`, `tooLong`, `noService`); and the peers and the servers whose halves left without their pair (`expired`, `evicted`, `replaced`), each with its latest five trace ids.
111
111
* BanyanDB: the OAP works with BanyanDB servers reporting API version `0.11` or `0.13`, the versions it supports. The `compatibleServerApiVersions` setting in `bydb.yml` (`SW_STORAGE_BANYANDB_COMPATIBLE_SERVER_API_VERSIONS`) is removed, as it could list versions the OAP does not support: a server reporting another API version, such as `0.10`, no longer boots even if the setting listed it, and a `bydb.yml` that still sets it boots with a warning. For debugging only, the environment variable `SW_STORAGE_BANYANDB_FORCE_SERVER_API_VERSION` makes the OAP work as one of those versions, whatever version the server reports.
112
112
* Fix OAL `maxDouble()` / `minDouble()` failing the OAP boot on Elasticsearch without `logicSharding`: their column is now `double_value`.
113
+
* BanyanDB: an init or default-mode OAP now applies additive schema changes (new columns, tags or fields) at boot to every measure, stream and trace, as it already did on JDBC and Elasticsearch, so a metric whose storage only gained columns in an upgrade no longer stays disabled. A breaking change (a removed or retyped column, a different entity) is still refused at boot. The OAP logs one line for each storage resource outcome its installers record: DEBUG when unchanged, INFO when created, updated or dropped, ERROR when an incompatible change is refused; the storage plugins log the DDL they run at DEBUG.
Copy file name to clipboardExpand all lines: docs/en/concepts-and-designs/runtime-rule-hot-update.md
+74-49Lines changed: 74 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,11 +95,13 @@ disagree a periodic scan is in flight or the node is mid-apply.
95
95
The feature is three cooperating workflows:
96
96
97
97
1.**Boot** — OAP starts; static rule files on disk are loaded, with persisted
98
-
runtime-rule entries substituted in or skipped at load time. Backend schema is
99
-
read-only at boot — never reshaped, never dropped.
98
+
runtime-rule entries substituted in or skipped at load time. Boot runs in
99
+
production with no operator watching, so it only extends backend schema: it
100
+
creates missing resources and applies additive changes, and never drops or
101
+
breaks one.
100
102
2.**On-demand** — an operator calls `POST /addOrUpdate`, `/inactivate`, or
101
-
`/delete`. This is the **only** workflow that may change backend schema, because
102
-
the operator explicitly asked for it.
103
+
`/delete`. This is the **only** workflow that may make a breaking schema change
104
+
(with `allowStorageChange=true`), because the operator explicitly asked for it.
103
105
3.**Periodic scan** — every OAP node re-reads every runtime-rule entry every 30 s
104
106
and converges its local state to match. This is what closes the convergence
105
107
bounds above; nothing else does.
@@ -136,76 +138,99 @@ plugin intercepts each file before compilation and decides per-`(catalog, name)`
136
138
- Persisted `ACTIVE` entry → compile the entry's content in place of the disk file.
137
139
- Persisted `INACTIVE` entry → skip the file; the operator has tombstoned the rule.
138
140
139
-
Compilation registers each rule under **create-if-absent** semantics: missing backend
140
-
resources are created; resources that already exist with a different shape are
141
-
**skipped with an ERROR log**, the affected metric is disabled until the operator
142
-
reconciles via `/addOrUpdate`. Boot is **never** allowed to silently reshape the
143
-
backend — that would mask edits made while OAP was offline.
141
+
Compilation registers each rule with the boot policy: missing backend resources
142
+
are created, and a resource that lacks declared columns, tags or fields is
143
+
**extended** (an additive change). Boot never applies a **breaking** difference — a
144
+
removed or retyped column, tag or field, or a different entity: that would lose data
145
+
or mask edits made while OAP was offline. On BanyanDB it is **refused with an ERROR
146
+
log**, and the resource keeps its shape until an operator drops it with the storage's
147
+
own tools or gives the metric a new name. (A rule edit that changes a metric's
148
+
storage goes through `/addOrUpdate` with `allowStorageChange=true`.)
144
149
145
150
After every analyzer has loaded, the runtime-rule plugin runs **one synchronous
146
151
scan** so any runtime-only entries (no static disk file) are applied before
147
152
receivers open ingress. From that point on, the periodic-scan workflow takes over.
148
153
149
-
### Why boot cannot reshape the backend
154
+
### Why boot applies additive changes only
150
155
151
-
If boot were allowed to update backend storage, a shape mismatch could silently
152
-
rewrite the BanyanDB measure or the Elasticsearch mapping. Before this feature, the
153
-
backends behaved inconsistently:
156
+
An additive change leaves the stored data in place and keeps every writer working
157
+
(OAP writes name their columns, tags and fields, in a layout each OAP keeps stable),
158
+
so it is safe to apply unattended; the one cost, older rows of a BanyanDB tag moved
159
+
between families, is described below. A breaking
160
+
change can lose data or break readers, so it needs an operator decision. Before this
161
+
policy, the backends behaved inconsistently:
154
162
155
163
- BanyanDB and JDBC silently accepted the mismatch — samples were written against
156
164
the old schema and quietly truncated or rejected later.
157
165
- Elasticsearch hard-failed boot on a strict-mapping type conflict.
158
166
159
-
Create-if-absent unifies the contract: schema mismatches are always surfaced as an
160
-
explicit ERROR, boot always continues, the affected metric is disabled, and the
161
-
operator reconciles explicitly through the on-demand workflow. The same shape is
162
-
visible across every backend.
167
+
The boot policy unifies the contract: additive changes are applied on every backend;
168
+
a breaking change to a table, an index, a measure, a stream or a trace is left as it is
169
+
(BanyanDB reports each as an ERROR); and boot always continues. A BanyanDB property is
170
+
schemaless and takes any change. An Elasticsearch template is re-put when its mapping,
171
+
shard / replica settings or order differ, and the new definition reaches only the
172
+
indices created after it.
163
173
164
-
### Code-defined stream opt-in (narrow exception)
174
+
### What boot does on each storage
165
175
166
-
The "boot never reshapes" rule above applies to **runtime-rule (MAL / LAL)**
167
-
registration — those rules ride the `/addOrUpdate` REST workflow when their
168
-
backing schema needs to change.
176
+
Only an init or default-mode OAP changes the schema at boot; a `no-init` OAP waits
177
+
until the init OAP has created the resources.
169
178
170
-
BanyanDB streams whose schema lives in OAP source code (e.g. `AlarmRecord`) can
171
-
opt in to **additive** boot-time reshape via
172
-
`@BanyanDB.Stream.AllowBootReshape`. When the stream opts in and the diff is
173
-
purely additive, the installer calls `client.update` at boot to extend the
174
-
live stream; non-additive divergences still record
175
-
`SKIPPED_SHAPE_MISMATCH` and require an operator drop+recreate. Only the
176
-
init / standalone OAP performs the reshape; non-init peers continue through
177
-
the existing poll-and-wait loop so a single node drives DDL during a rolling
178
-
restart.
179
+
| Storage / resource | Additive change at boot | Breaking change at boot |
180
+
|---|---|---|
181
+
| JDBC table |`ALTER TABLE ... ADD COLUMN`| left as it is (JDBC only checks that columns exist) |
182
+
| Elasticsearch index / template | mapping fields appended | the current index keeps its fields and settings (a settings difference on the `management` index, which is never re-created, is logged as a WARN); a re-put template applies to indices created later |
183
+
| BanyanDB measure, stream, trace | updated in place | refused, with an ERROR log |
184
+
| BanyanDB property | updated in place (schemaless: any change) | — |
185
+
| BanyanDB index rule, binding, TopN | reconciled to the declared rule | reconciled to the declared rule |
179
186
180
-
"Additive" includes two cases:
187
+
"Additive" for a BanyanDB measure, stream or trace covers two cases:
181
188
182
-
1.**New tag** — a brand-new `@Column` is appended to the live tag family.
189
+
1.**New tag or field** — a brand-new `@Column` is added to the live schema.
183
190
2.**Tag relocation between families** — a `@Column`'s `storageOnly` flag
184
191
flips, moving the tag between the `storage-only` and `searchable`
185
192
families. The tag identity and type are preserved; only its on-disk
186
-
family location changes.
193
+
family location changes. An entity tag cannot move: BanyanDB refuses it.
187
194
188
-
Drops, tag-type changes and entity changes are still rejected with
189
-
`SKIPPED_SHAPE_MISMATCH`.
195
+
A dropped or retyped tag or field, and a change to the entity, the sharding key,
196
+
the interval, or a trace's trace-id / span-id / timestamp tag, are breaking and
197
+
refused with `BOOT_REFUSED_BREAKING_CHANGE`.
190
198
191
-
When the primary `check*` records `SKIPPED_SHAPE_MISMATCH`, the dependent
192
-
`IndexRule` and `IndexRuleBinding` reconciliation is **also skipped**. This
193
-
preserves coherence between the stream / measure tag layout and the binding
194
-
that points into it — without the gate, the binding would silently update to
195
-
reference the new declared tag list while the live tag families still carry
196
-
the old shape, leaving operators with a binding routing to tags that don't
197
-
exist in the live family layout.
198
-
199
-
This opt-in is **BanyanDB-only**. JDBC and Elasticsearch are append-only on
200
-
the data path and already accept additive column / mapping additions at boot
201
-
without operator intervention, so the flag is unread on those backends.
199
+
When a measure, stream or trace is refused, its `IndexRule` and `IndexRuleBinding`
200
+
are **also left as they are** (the refusal's log line says so). This preserves
201
+
coherence between the tag layout and the binding that points into it — without
202
+
the gate, the binding would silently update to reference the new declared tag list
203
+
while the live tag families still carry the old shape, leaving operators with a
204
+
binding routing to tags that don't exist in the live family layout.
202
205
203
206
> **Operator caveat:** BanyanDB does not physically migrate existing rows
204
207
> when a tag's family changes. Pre-existing data for the relocated tag stays
205
208
> in its original on-disk family location; new writes go to the declared
206
209
> family. Queries that route through a new IndexRule on the relocated tag
207
210
> will only see post-reshape rows until historical data ages out via TTL.
208
211
212
+
### The schema log
213
+
214
+
Every OAP logs what it found and did for each storage resource — a table, an index
215
+
or template, a BanyanDB group, measure, stream, trace, property, index rule, binding
216
+
or TopN aggregation — one line for each outcome the installer records, with the mode it ran in: DEBUG when
217
+
nothing changed, INFO when it was created, updated or dropped, ERROR when an
218
+
incompatible difference was left unapplied. The storage plugins log the DDL they
219
+
execute at DEBUG.
220
+
For example:
221
+
222
+
```
223
+
storage schema [BOOT_INSTALL] model [service_cpm]: measure(sw_metricsMinute/service_cpm_minute)=UPDATED[adds tags [layer searchable:TAG_TYPE_STRING]]
224
+
storage schema [BOOT_INSTALL] model [service_resp_time]: measure(sw_metricsMinute/service_resp_time_minute)=BOOT_REFUSED_BREAKING_CHANGE[changes fields [value FIELD_TYPE_INT/... → FIELD_TYPE_FLOAT/...]; its index rules and binding are left as they are. To store the declared shape, delete the measure with BanyanDB's own tools before the next start (its data is lost), or give the metric a new name] — left as it is: boot applies additive changes only.
225
+
```
226
+
227
+
The modes are `BOOT_INSTALL` (an OAP registering models at startup),
228
+
`RUNTIME_APPLY` (the main OAP applying a runtime-rule change),
229
+
`RUNTIME_PEER_VERIFY` (a not-main OAP checking at startup that the main OAP has
230
+
applied the persisted rules; a rule that fails the check is loaded by a later scan)
231
+
and `RUNTIME_LOCAL_ONLY` (no backend call: a not-main OAP's periodic scan, or the
232
+
main OAP's `/inactivate`).
233
+
209
234
## On-demand workflow
210
235
211
236
Triggered by an HTTP call to one of the admin endpoints. A request arriving at any
@@ -293,7 +318,7 @@ never destroys data they might want back:
293
318
row (returns `HTTP 409 requires_inactivate_first`), so destruction always goes
294
319
through the explicit two-step `/inactivate → /delete` workflow. On an absent
295
320
row it is an idempotent `200 not_found`. The `/inactivate` step has already
296
-
torn down OAP-internal state under `withoutSchemaChange` (handlers, prototypes,
321
+
torn down OAP-internal state under `RUNTIME_LOCAL_ONLY` (handlers, prototypes,
297
322
Models cleared; backend measure preserved). What `/delete` does next depends on
298
323
whether a bundled YAML twin exists on disk:
299
324
-**No bundled twin (default mode)** — drops the row only; the backend measure
@@ -308,9 +333,9 @@ never destroys data they might want back:
Copy file name to clipboardExpand all lines: oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/v2/Analyzer.java
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -170,15 +170,15 @@ public static Analyzer prepare(final String metricName,
Copy file name to clipboardExpand all lines: oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/v2/MetricConvert.java
Copy file name to clipboardExpand all lines: oap-server/analyzer/trace-analyzer/src/main/java/org/apache/skywalking/oap/trace/analyzer/v2/compiler/TALClassGenerator.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -572,7 +572,7 @@ private void collectSegmentDefs(final List<?> statements, final Map<String, Inte
572
572
573
573
/**
574
574
* Install the storage model for every metric the rule declared. Runs before the rule sees a span; on the
575
-
* boot path {@code create} is create-if-absent, as it is for MAL.
575
+
* boot path {@code create} creates what is absent and applies additive changes only, as it does for MAL.
576
576
*
577
577
* @param meterSystem the meter system to register with
0 commit comments