@@ -44,10 +44,18 @@ fields:
44
44
Allow the target Schema Registry instance to allocate different schema IDs for migrated schemas. This is useful
45
45
when it already contains some schemas which differ from the ones being migrated.
46
46
47
+ - name : input_bundle_label
48
+ type : string
49
+ kind : scalar
50
+ default : " "
51
+ description : |
52
+ Specify the redpanda_migrator_bundle input label if one is assigned to it.
53
+
47
54
mapping : |
48
55
#!blobl
49
56
50
57
let labelPrefix = @label.not_empty().or("redpanda_migrator_bundle")
58
+ let inputBundleLabel = this.input_bundle_label.not_empty().or("redpanda_migrator_bundle")
51
59
52
60
if this.translate_schema_ids == true && this.schema_registry.length() == 0 {
53
61
root = throw("Schema ID translation requires schema_registry to be configured")
@@ -75,7 +83,7 @@ mapping: |
75
83
]
76
84
},
77
85
"translate_schema_ids": this.translate_schema_ids.or(false),
78
- "input_resource": "%s_redpanda_migrator_input".format($labelPrefix )
86
+ "input_resource": "%s_redpanda_migrator_input".format($inputBundleLabel )
79
87
}
80
88
)
81
89
@@ -100,7 +108,7 @@ mapping: |
100
108
this.schema_registry.assign({
101
109
"subject": "${! @schema_registry_subject }",
102
110
"max_in_flight": $srMaxInFlight,
103
- "input_resource": "%s_schema_registry_input".format($labelPrefix ),
111
+ "input_resource": "%s_schema_registry_input".format($inputBundleLabel ),
104
112
"translate_ids": this.translate_schema_ids.or(false)
105
113
})
106
114
}
@@ -225,6 +233,71 @@ tests:
225
233
- output :
226
234
reject : ${! @fallback_error }
227
235
236
+ - name : Migrate messages, offsets and schemas when setting a label on the bundle input
237
+ config :
238
+ redpanda_migrator :
239
+ seed_brokers : [ "127.0.0.1:9092" ]
240
+ topic_prefix : dest.
241
+ max_in_flight : 1
242
+ schema_registry :
243
+ url : http://localhost:8081
244
+ max_in_flight : 1
245
+ input_bundle_label : source
246
+
247
+ expected :
248
+ switch :
249
+ cases :
250
+ - check : metadata("input_label") == "redpanda_migrator_input"
251
+ output :
252
+ label : redpanda_migrator_bundle_redpanda_migrator_output
253
+ redpanda_migrator :
254
+ key : ${! metadata("kafka_key") }
255
+ max_in_flight : 1
256
+ partition : ${! metadata("kafka_partition").or(throw("missing kafka_partition metadata")) }
257
+ partitioner : manual
258
+ seed_brokers :
259
+ - 127.0.0.1:9092
260
+ timestamp_ms : ${! metadata("kafka_timestamp_ms").or(timestamp_unix_milli()) }
261
+ topic : ${! metadata("kafka_topic").or(throw("missing kafka_topic metadata")) }
262
+ topic_prefix : " dest."
263
+ metadata :
264
+ include_patterns :
265
+ - ^(?:[^k].*|k[^a].*|ka[^f].*|kaf[^k].*|kafk[^a].*|kafka[^_].*)
266
+ translate_schema_ids : false
267
+ input_resource : source_redpanda_migrator_input
268
+ schema_registry_output_resource : redpanda_migrator_bundle_schema_registry_output
269
+ processors :
270
+ - mapping : |
271
+ meta input_label = deleted()
272
+ - check : metadata("input_label") == "redpanda_migrator_offsets_input"
273
+ output :
274
+ label : redpanda_migrator_bundle_redpanda_migrator_offsets_output
275
+ redpanda_migrator_offsets :
276
+ seed_brokers :
277
+ - 127.0.0.1:9092
278
+ offset_topic_prefix : " dest."
279
+ - check : metadata("input_label") == "schema_registry_input"
280
+ output :
281
+ fallback :
282
+ - label : redpanda_migrator_bundle_schema_registry_output
283
+ schema_registry :
284
+ subject : ${! @schema_registry_subject }
285
+ url : http://localhost:8081
286
+ max_in_flight : 1
287
+ translate_ids : false
288
+ input_resource : source_schema_registry_input
289
+ - switch :
290
+ cases :
291
+ - check : ' @fallback_error == "request returned status: 422"'
292
+ output :
293
+ drop : {}
294
+ processors :
295
+ - log :
296
+ message : |
297
+ Subject '${! @schema_registry_subject }' version ${! @schema_registry_version } already has schema: ${! content() }
298
+ - output :
299
+ reject : ${! @fallback_error }
300
+
228
301
- name : Migrate messages, offsets and schemas with schema ID translation
229
302
config :
230
303
redpanda_migrator :
0 commit comments