{"record":{"id":"deef98aeadeb05a3","repo":"risingwavelabs/risingwave","slug":"should-not-read-changelog-from-mockwaitepochstates","errorCode":null,"errorMessage":"should not read changelog from MockWaitEpochStateStore","messagePattern":"should not read changelog from MockWaitEpochStateStore","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/stream/src/executor/dml.rs","lineNumber":486,"sourceCode":"    struct MockWaitEpochStateStore {\n        wait_epoch_called_tx: Arc<Mutex<Option<WaitEpochCallSender>>>,\n        wait_epoch_release_rx: Arc<tokio::sync::Mutex<Option<oneshot::Receiver<()>>>>,\n    }\n\n    impl StateStoreReadLog for MockWaitEpochStateStore {\n        type ChangeLogIter = PanicStateStoreIter<StateStoreReadLogItem>;\n\n        async fn next_epoch(&self, _epoch: u64, _options: NextEpochOptions) -> StorageResult<u64> {\n            panic!(\"should not read changelog from MockWaitEpochStateStore\")\n        }\n\n        async fn iter_log(\n            &self,\n            _epoch_range: (u64, u64),\n            _key_range: TableKeyRange,\n            _options: ReadLogOptions,\n        ) -> StorageResult<Self::ChangeLogIter> {\n            panic!(\"should not read changelog from MockWaitEpochStateStore\")\n        }\n    }\n\n    impl StateStore for MockWaitEpochStateStore {\n        type Local = PanicStateStore;\n        type ReadSnapshot = PanicStateStore;\n        type VectorWriter = PanicStateStore;\n\n        async fn try_wait_epoch(\n            &self,\n            epoch: HummockReadEpoch,\n            options: TryWaitEpochOptions,\n        ) -> StorageResult<()> {\n            if let Some(tx) = self.wait_epoch_called_tx.lock().unwrap().take() {\n                assert!(tx.send((epoch, options)).is_ok());\n            }\n            let rx = self.wait_epoch_release_rx.lock().await.take().unwrap();\n            rx.await.unwrap();","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/dml.rs#L468-L504","documentation":"This is a deliberate `panic!` in the `MockWaitEpochStateStore` test double's `StateStoreChangeEventLog::iter_log` implementation. The mock exists only to wait for epoch releases (DML backpressure testing) and must never serve real reads; any call to iter_log signals the test or executor used the mock in an unsupported way. It is an internal invariant guard, not a runtime error users should see in production.","triggerScenarios":"Any code path invoking `iter_log` on a `MockWaitEpochStateStore`, i.e. requesting a changelog iteration from the mock during a DML executor test.","commonSituations":"Writing or modifying a stream DML executor test that accidentally routes change-log reads through the mock; switching a test's state store from a real Hummock store to MockWaitEpochStateStore while the executor still exercises changelog reads.","solutions":["Do not exercise changelog reads in tests that use MockWaitEpochStateStore; restrict it to the wait-epoch/DML backpressure scenario.","Use a real or recording state store implementation (e.g. MemoryStateStore) when the test must call iter_log.","If the panic appears unexpectedly, trace which executor path reads the changelog and gate that path off in the test setup."],"exampleFix":"// before\nlet store = Arc::new(MockWaitEpochStateStore::new(...));\n// executor under test reads changelog -> panics\n// after: use a store that supports changelog reads\nlet store = MemoryStateStore::new();","handlingStrategy":"validation","validationCode":"// assert the mock is only used where changelog reads never happen\nassert!(\n    !test_exercises_changelog_reads,\n    \"MockWaitEpochStateStore cannot serve iter_log; use MemoryStateStore\"\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve MockWaitEpochStateStore for wait-epoch/DML backpressure tests only.","Prefer MemoryStateStore whenever reads or writes are exercised.","Document the mock's supported surface at its definition.","Fail fast in test setup if the executor under test performs changelog reads."],"tags":["test-mock","panic","state-store","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}