Skip to content

Commit 9f35ad1

Browse files
committed
Group storage annotations per storage and per BanyanDB engine
An attribute only one storage reads now lives under that storage's annotation, and its value in that storage's extension of the model: - `@Column(indexOnly)` becomes `@ElasticSearch.IndexOnly` (`ElasticSearchExtension`). - `@Stream(allowBootReshape)` becomes `@BanyanDB.Stream.AllowBootReshape` (`BanyanDBModelExtension`). It is for streams only: the BanyanDB installer's boot-reshape path for measures, which no production measure used, is removed. BanyanDB annotations are grouped by the engine that reads them: `@BanyanDB.Measure.*`, `@BanyanDB.IndexMode.*`, `@BanyanDB.Stream.*` and `@BanyanDB.Trace.*`. `MeasureField` becomes `Measure.Field`, and a trace's `NoIndexing` becomes `Trace.InSpanPayloadOnly`; the two `EnableSort` on trace models, which BanyanDB never read, are removed. `@BanyanDB.Trace.StoreAsAttachmentOf(Target.class)` replaces the `BanyanDBTrace.MergeTable` interface: the rows go into the target's trace and its query returns them; the target model gives the trace, its group and its columns. The annotation changes leave every schema as it was: with every bundled OAL, MAL, LAL and TAL rule, Zipkin and OTLP active, plus verification-only rules for every OAL and MAL function, the schemas dumped from BanyanDB, MySQL, PostgreSQL, and Elasticsearch with and without logic sharding are identical to master's (Elasticsearch without logic sharding ran without the `maxDouble()` / `minDouble()` rules, as master can't boot with them there). So are the model definitions each build's `StorageModels` produces for the hand-written models and the function classes, but for the two removed `EnableSort`. Also fix OAL `maxDouble()` / `minDouble()`: their double column was named `value`, which Elasticsearch without logic sharding refused at boot ("Class type conflict in index: metrics-all"). It is now `double_value`, as `doubleAvg()`'s.
1 parent 28d097d commit 9f35ad1

106 files changed

Lines changed: 854 additions & 959 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/en/changes/changes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
* **Breaking Change** — DSL Debug API across OAP nodes: `CollectDebugRecords` replaces `CollectDebugSamples` on the admin gRPC bus (`admin-server.gRPCPort`), which returned a node's whole capture in one reply. During a rolling upgrade, a node reads no records from a node of the other version and shows it as `unreachable` in a debug session's `nodes[]`; a session reads the whole cluster again once every node runs the same version.
110110
* 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.
111111
* 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+
* Fix OAL `maxDouble()` / `minDouble()` failing the OAP boot on Elasticsearch without `logicSharding`: their column is now `double_value`.
112113

113114
#### UI
114115

‎docs/en/concepts-and-designs/runtime-rule-hot-update.md‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,26 @@ The "boot never reshapes" rule above applies to **runtime-rule (MAL / LAL)**
167167
registration — those rules ride the `/addOrUpdate` REST workflow when their
168168
backing schema needs to change.
169169

170-
Streams whose schema lives in OAP source code (e.g. `AlarmRecord`) can opt in
171-
to **additive** boot-time reshape via
172-
`@Stream(allowBootReshape = true)`. When the flag is on and the diff is
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
173173
purely additive, the installer calls `client.update` at boot to extend the
174-
live measure / stream; non-additive divergences still record
174+
live stream; non-additive divergences still record
175175
`SKIPPED_SHAPE_MISMATCH` and require an operator drop+recreate. Only the
176176
init / standalone OAP performs the reshape; non-init peers continue through
177177
the existing poll-and-wait loop so a single node drives DDL during a rolling
178178
restart.
179179

180180
"Additive" includes two cases:
181181

182-
1. **New tag / new field** — a brand-new `@Column` is appended to the live
183-
tag family (or fields list, for measures).
182+
1. **New tag** — a brand-new `@Column` is appended to the live tag family.
184183
2. **Tag relocation between families** — a `@Column`'s `storageOnly` flag
185184
flips, moving the tag between the `storage-only` and `searchable`
186185
families. The tag identity and type are preserved; only its on-disk
187186
family location changes.
188187

189-
Drops, tag-type changes, kind flips (tag↔field), and entity / interval /
190-
sharding-key changes are still rejected with `SKIPPED_SHAPE_MISMATCH`.
188+
Drops, tag-type changes and entity changes are still rejected with
189+
`SKIPPED_SHAPE_MISMATCH`.
191190

192191
When the primary `check*` records `SKIPPED_SHAPE_MISMATCH`, the dependent
193192
`IndexRule` and `IndexRuleBinding` reconciliation is **also skipped**. This

‎oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/OALClassGeneratorV2.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private Class generateMetricsClass(CodeGenModel model) throws OALCompileExceptio
259259

260260
if (field.isID()) {
261261
// Add SeriesID annotation
262-
Annotation banyanSeriesIDAnnotation = new Annotation(BanyanDB.SeriesID.class.getName(), constPool);
262+
Annotation banyanSeriesIDAnnotation = new Annotation(BanyanDB.Measure.SeriesID.class.getName(), constPool);
263263
banyanSeriesIDAnnotation.addMemberValue("index", new IntegerMemberValue(constPool, 0));
264264
annotationsAttribute.addAnnotation(banyanSeriesIDAnnotation);
265265

@@ -269,7 +269,7 @@ private Class generateMetricsClass(CodeGenModel model) throws OALCompileExceptio
269269
}
270270

271271
if (field.isShardingKey()) {
272-
Annotation banyanShardingKeyAnnotation = new Annotation(BanyanDB.ShardingKey.class.getName(), constPool);
272+
Annotation banyanShardingKeyAnnotation = new Annotation(BanyanDB.Measure.ShardingKey.class.getName(), constPool);
273273
banyanShardingKeyAnnotation.addMemberValue("index", new IntegerMemberValue(constPool, field.getShardingKeyIdx()));
274274
annotationsAttribute.addAnnotation(banyanShardingKeyAnnotation);
275275
}

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
@Getter
4343
@Setter
4444
@ScopeDeclaration(id = ALARM, name = "Alarm")
45-
@Stream(name = AlarmRecord.INDEX_NAME, scopeId = DefaultScopeDefine.ALARM, builder = AlarmRecord.Builder.class, processor = RecordStreamProcessor.class, allowBootReshape = true)
45+
@Stream(name = AlarmRecord.INDEX_NAME, scopeId = DefaultScopeDefine.ALARM, builder = AlarmRecord.Builder.class, processor = RecordStreamProcessor.class)
46+
@BanyanDB.Stream.AllowBootReshape
4647
@SQLDatabase.ExtraColumn4AdditionalEntity(additionalTable = AlarmRecord.ADDITIONAL_TAG_TABLE, parentColumn = TIME_BUCKET)
47-
@BanyanDB.TimestampColumn(AlarmRecord.START_TIME)
48-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS)
48+
@BanyanDB.Stream.TimestampColumn(AlarmRecord.START_TIME)
49+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS)
4950
public class AlarmRecord extends Record {
5051
public static final String INDEX_NAME = "alarm_record";
5152
public static final String ADDITIONAL_TAG_TABLE = "alarm_record_tag";
@@ -79,7 +80,7 @@ public StorageID id() {
7980
// (id1) IDs. Indexed (storageOnly removed in 11.0.0) so `queryAlarms` can
8081
// filter alarms by serviceId / instanceId / endpointId / relation ends.
8182
@Column(name = ID0, length = 512)
82-
@BanyanDB.SeriesID(index = 0)
83+
@BanyanDB.Stream.SeriesID(index = 0)
8384
private String id0;
8485
@Column(name = ID1)
8586
private String id1;
@@ -88,11 +89,12 @@ public StorageID id() {
8889
private long startTime;
8990
@Column(name = ALARM_MESSAGE, length = 512)
9091
@ElasticSearch.MatchQuery
91-
@BanyanDB.MatchQuery(analyzer = BanyanDB.MatchQuery.AnalyzerType.SIMPLE)
92+
@BanyanDB.Stream.MatchQuery(analyzer = BanyanDB.AnalyzerType.SIMPLE)
9293
private String alarmMessage;
9394
@Column(name = RULE_NAME)
9495
private String ruleName;
95-
@Column(name = TAGS, indexOnly = true)
96+
@Column(name = TAGS)
97+
@ElasticSearch.IndexOnly
9698
@SQLDatabase.AdditionalEntity(additionalTables = {ADDITIONAL_TAG_TABLE})
9799
private List<String> tagsInString;
98100
@Column(name = TAGS_RAW_DATA, storageOnly = true, length = Tag.TAG_LENGTH)

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecoveryRecord.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
@Setter
4040
@ScopeDeclaration(id = ALARM_RECOVERY, name = "AlarmRecovery")
4141
@Stream(name = AlarmRecoveryRecord.INDEX_NAME, scopeId = DefaultScopeDefine.ALARM_RECOVERY, builder = AlarmRecoveryRecord.Builder.class, processor = RecordStreamProcessor.class)
42-
@BanyanDB.TimestampColumn(AlarmRecoveryRecord.RECOVERY_TIME)
43-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS)
42+
@BanyanDB.Stream.TimestampColumn(AlarmRecoveryRecord.RECOVERY_TIME)
43+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS)
4444
public class AlarmRecoveryRecord extends Record {
4545
public static final String INDEX_NAME = "alarm_recovery_record";
4646
public static final String UUID = "uuid";
@@ -54,7 +54,7 @@ public StorageID id() {
5454
@ElasticSearch.EnableDocValues
5555
@Column(name = RECOVERY_TIME)
5656
private long recoveryTime;
57-
@BanyanDB.SeriesID(index = 0)
57+
@BanyanDB.Stream.SeriesID(index = 0)
5858
@Column(name = UUID)
5959
private String uuid;
6060

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Stream.java‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
2828
import org.apache.skywalking.oap.server.core.analysis.worker.TopNStreamProcessor;
2929
import org.apache.skywalking.oap.server.core.source.ScopeDeclaration;
30-
import org.apache.skywalking.oap.server.core.storage.model.ModelInstaller;
31-
import org.apache.skywalking.oap.server.core.storage.model.StorageManipulationOpt;
3230
import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
3331

3432
/**
@@ -61,28 +59,4 @@
6159
* TopNStreamProcessor} and {@link NoneStreamProcessor} for more details.
6260
*/
6361
Class<? extends StreamProcessor> processor();
64-
65-
/**
66-
* Opt-in to additive boot-time reshape of the backend resource for this stream class.
67-
* <strong>BanyanDB only</strong> — JDBC and Elasticsearch are append-only on the data
68-
* path and don't refuse additive column / mapping additions at boot, so they don't
69-
* need (and don't read) this flag.
70-
*
71-
* <p>Default is {@code false} — boot follows the standard {@code schemaCreateIfAbsent}
72-
* policy and records {@link StorageManipulationOpt.Outcome#SKIPPED_SHAPE_MISMATCH} on
73-
* any shape divergence, leaving reconciliation to the operator (the only workflow that
74-
* may change backend schema).
75-
*
76-
* <p>When set to {@code true}, the BanyanDB installer is allowed to apply
77-
* <strong>purely additive</strong> changes (new tag, new field) during boot via
78-
* {@code client.update}. Type changes, drops, kind flips, entity / interval /
79-
* sharding-key changes are still refused with {@code SKIPPED_SHAPE_MISMATCH} and
80-
* require a manual drop+recreate (identity-breaking edits are explicit operator
81-
* actions, not boot side-effects).
82-
*
83-
* <p>Only the init / standalone OAP performs the reshape; non-init peers continue
84-
* through the existing poll-and-wait loop in {@link ModelInstaller#whenCreating} so a
85-
* single node drives DDL during a rolling restart.
86-
*/
87-
boolean allowBootReshape() default false;
8862
}

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/aiagent/AIAgentSessionDataRecord.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
@ScopeDeclaration(id = DefaultScopeDefine.AI_AGENT_SESSION_DATA, name = "AIAgentSessionData")
5656
@Stream(name = AIAgentSessionDataRecord.INDEX_NAME, scopeId = DefaultScopeDefine.AI_AGENT_SESSION_DATA,
5757
builder = AIAgentSessionDataRecord.Builder.class, processor = RecordStreamProcessor.class)
58-
@BanyanDB.TimestampColumn(AIAgentSessionDataRecord.TIMESTAMP)
59-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS_AI_AGENT)
58+
@BanyanDB.Stream.TimestampColumn(AIAgentSessionDataRecord.TIMESTAMP)
59+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS_AI_AGENT)
6060
public class AIAgentSessionDataRecord extends Record {
6161
public static final String INDEX_NAME = "ai_agent_session_data";
6262
public static final String SERVICE_ID = "service_id";
@@ -71,13 +71,13 @@ public class AIAgentSessionDataRecord extends Record {
7171
public static final int BODY_MAX_LENGTH = 16 * 1024 * 1024;
7272

7373
@Column(name = SERVICE_ID)
74-
@BanyanDB.SeriesID(index = 0)
74+
@BanyanDB.Stream.SeriesID(index = 0)
7575
private String serviceId;
7676
@Column(name = SERVICE_INSTANCE_ID, length = 512)
77-
@BanyanDB.SeriesID(index = 1)
77+
@BanyanDB.Stream.SeriesID(index = 1)
7878
private String serviceInstanceId;
7979
@Column(name = SESSION, length = 256)
80-
@BanyanDB.SeriesID(index = 2)
80+
@BanyanDB.Stream.SeriesID(index = 2)
8181
private String session;
8282
@ElasticSearch.EnableDocValues
8383
@Column(name = SEQ)

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/aiagent/AIAgentSessionFlowRecord.java‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
@SuperDataset
5353
@ScopeDeclaration(id = DefaultScopeDefine.AI_AGENT_SESSION_FLOW, name = "AIAgentSessionFlow")
5454
@Stream(name = AIAgentSessionFlowRecord.INDEX_NAME, scopeId = DefaultScopeDefine.AI_AGENT_SESSION_FLOW,
55-
builder = AIAgentSessionFlowRecord.Builder.class, processor = RecordStreamProcessor.class, allowBootReshape = true)
56-
@BanyanDB.TimestampColumn(AIAgentSessionFlowRecord.TIMESTAMP)
57-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS_AI_AGENT)
55+
builder = AIAgentSessionFlowRecord.Builder.class, processor = RecordStreamProcessor.class)
56+
@BanyanDB.Stream.AllowBootReshape
57+
@BanyanDB.Stream.TimestampColumn(AIAgentSessionFlowRecord.TIMESTAMP)
58+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS_AI_AGENT)
5859
public class AIAgentSessionFlowRecord extends Record {
5960
public static final String INDEX_NAME = "ai_agent_session_flow";
6061
public static final String SERVICE_ID = "service_id";
@@ -83,16 +84,16 @@ public class AIAgentSessionFlowRecord extends Record {
8384
public static final int BODY_MAX_LENGTH = 16 * 1024 * 1024;
8485

8586
@Column(name = SERVICE_ID)
86-
@BanyanDB.SeriesID(index = 0)
87+
@BanyanDB.Stream.SeriesID(index = 0)
8788
private String serviceId;
8889
@Column(name = SERVICE_INSTANCE_ID, length = 512)
89-
@BanyanDB.SeriesID(index = 1)
90+
@BanyanDB.Stream.SeriesID(index = 1)
9091
private String serviceInstanceId;
9192
@Column(name = CONVERSATION, length = 256)
9293
private String conversation;
9394
/** Sortable, so the head of a chain is one read of the highest round rather than a page of rows. */
9495
@ElasticSearch.EnableDocValues
95-
@BanyanDB.EnableSort
96+
@BanyanDB.Stream.EnableSort
9697
@Column(name = ROUND)
9798
private long round;
9899
@Column(name = SESSION_FROM_TIME, storageOnly = true)

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/cache/TopNCacheReadCommand.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
* Database TopN statement, including Database SQL statement, mongoDB and Redis commands.
3737
*/
3838
@Stream(name = TopNCacheReadCommand.INDEX_NAME, scopeId = DefaultScopeDefine.CACHE_SLOW_ACCESS, builder = TopNCacheReadCommand.Builder.class, processor = TopNStreamProcessor.class)
39-
@BanyanDB.TimestampColumn(TopN.TIMESTAMP)
40-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS)
39+
@BanyanDB.Stream.TimestampColumn(TopN.TIMESTAMP)
40+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS)
4141
public class TopNCacheReadCommand extends TopN {
4242
public static final String INDEX_NAME = "top_n_cache_read_command";
4343

‎oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/cache/TopNCacheWriteCommand.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
* Database TopN statement, including Database SQL statement, mongoDB and Redis commands.
3737
*/
3838
@Stream(name = TopNCacheWriteCommand.INDEX_NAME, scopeId = DefaultScopeDefine.CACHE_SLOW_ACCESS, builder = TopNCacheWriteCommand.Builder.class, processor = TopNStreamProcessor.class)
39-
@BanyanDB.TimestampColumn(TopN.TIMESTAMP)
40-
@BanyanDB.Group(streamGroup = BanyanDB.StreamGroup.RECORDS)
39+
@BanyanDB.Stream.TimestampColumn(TopN.TIMESTAMP)
40+
@BanyanDB.Stream.Group(BanyanDB.StreamGroup.RECORDS)
4141
public class TopNCacheWriteCommand extends TopN {
4242
public static final String INDEX_NAME = "top_n_cache_write_command";
4343

0 commit comments

Comments
 (0)