KStreams PAPI test for SessionStoreWithHeaders - #4414
Open
Lucy Liu (lucliu1108) wants to merge 1 commit into
Open
KStreams PAPI test for SessionStoreWithHeaders#4414Lucy Liu (lucliu1108) wants to merge 1 commit into
Lucy Liu (lucliu1108) wants to merge 1 commit into
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds a new Kafka Streams integration test that exercises SessionStoreWithHeaders end-to-end with header-based schema ID transport, validating various session-store operations executed from within a processor (plus IQv1 querying and changelog/restore behavior).
Changes:
- Introduces
SessionStoreWithHeadersIntegrationTestcovering put/fetch/find/remove/backward/Instant variants for session stores using header-based schema IDs. - Adds IQv1 query verification via a custom
QueryableStoreTypereturningAggregationWithHeaders. - Adds changelog tombstone-header verification and a restore-from-changelog test to ensure headers persist across rebuilds.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+89
to
+91
| private static final String INPUT_TOPIC = "session-input"; | ||
| private static final String OUTPUT_TOPIC = "session-output"; | ||
| private static final String STORE_NAME = "session-store"; |
Comment on lines
+1087
to
+1088
| private static final Schema SESSION_KEY_SCHEMA = new Schema.Parser().parse( | ||
| "{\"type\":\"record\",\"name\":\"SessionKey\",\"namespace\":\"io.confluent.kafka.streams.integration\",\"fields\":[{\"name\":\"userId\",\"type\":\"string\"}]}"); |
Comment on lines
+1442
to
+1454
| List<ConsumerRecord<GenericRecord, byte[]>> changelogRecords = | ||
| consumeRecords(changelogTopic, "session-changelog-consumer", 6, ByteArrayDeserializer.class); | ||
|
|
||
| int tombstoneCount = 0; | ||
| for (ConsumerRecord<GenericRecord, byte[]> record : changelogRecords) { | ||
| if (record.value() == null) { | ||
| tombstoneCount++; | ||
| Header keySchemaIdHeader = record.headers().lastHeader(SchemaId.KEY_SCHEMA_ID_HEADER); | ||
| assertNotNull(keySchemaIdHeader, | ||
| "Tombstone record should have key schema ID header"); | ||
| } | ||
| } | ||
| assertTrue(tombstoneCount >= 2, "Should have at least 2 tombstone records, but found " + tombstoneCount); |
Comment on lines
+1586
to
+1588
| // Strip stale schema-id headers before the tombstone-producing put so the changelog | ||
| // tombstone isn't written with a stale value schema id attached. | ||
| private void handlePutNull(Record<GenericRecord, GenericRecord> record) { |
Comment on lines
+1613
to
+1615
| // Strip stale schema-id headers before the tombstone-producing remove so the changelog | ||
| // tombstone isn't written with a stale value schema id attached. | ||
| private void handleRemove(Record<GenericRecord, GenericRecord> record) { |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary
This PR adds:
SessionStoreWithHeadersIntegrationTest, which did PAPI test on sessionStoreWithHeaders, and validate store operations in the processor.
What
Checklist
Please answer the questions with Y, N or N/A if not applicable.
References
JIRA:
Test & Review
Open questions / Follow-ups