@@ -123,8 +123,15 @@ bool TCdcStreamChangeCollector::NeedToReadKeys() const {
123123 }
124124
125125 bool value = false ;
126- for (const auto & [_, tableInfo] : Self->GetUserTables ()) {
127- for (const auto & [_, streamInfo] : tableInfo->CdcStreams ) {
126+ const auto & userTables = Self->GetUserTables ();
127+ Cerr << " CDC_DEBUG: NeedToReadKeys checking " << userTables.size () << " user tables" << Endl;
128+ for (const auto & [tableLocalPathId, tableInfo] : userTables) {
129+ Cerr << " CDC_DEBUG: Table LocalPathId=" << tableLocalPathId
130+ << " has " << tableInfo->CdcStreams .size () << " CDC streams" << Endl;
131+ for (const auto & [streamPathId, streamInfo] : tableInfo->CdcStreams ) {
132+ Cerr << " CDC_DEBUG: Stream PathId=" << streamPathId
133+ << " State=" << static_cast <ui32>(streamInfo.State )
134+ << " Mode=" << static_cast <ui32>(streamInfo.Mode ) << Endl;
128135 if (streamInfo.State == NKikimrSchemeOp::ECdcStreamStateDisabled) {
129136 continue ;
130137 }
@@ -145,15 +152,29 @@ bool TCdcStreamChangeCollector::NeedToReadKeys() const {
145152 }
146153
147154 CachedNeedToReadKeys = value;
155+ Cerr << " CDC_DEBUG: NeedToReadKeys returning " << value << Endl;
148156 return *CachedNeedToReadKeys;
149157}
150158
151159bool TCdcStreamChangeCollector::Collect (const TTableId& tableId, ERowOp rop,
152160 TArrayRef<const TRawTypeValue> key, TArrayRef<const TUpdateOp> updates)
153161{
154- Y_ENSURE (Self->IsUserTable (tableId), " Unknown table: " << tableId);
162+ Cerr << " CDC_DEBUG: Collect called for TableId OwnerId=" << tableId.PathId .OwnerId
163+ << " LocalPathId=" << tableId.PathId .LocalPathId
164+ << " RowOp=" << static_cast <ui32>(rop) << Endl;
165+
166+ if (!Self->IsUserTable (tableId)) {
167+ const auto & userTables = Self->GetUserTables ();
168+ Cerr << " CDC_DEBUG: IsUserTable returned FALSE! TableId not in UserTables map." << Endl;
169+ Cerr << " CDC_DEBUG: UserTables contains " << userTables.size () << " tables:" << Endl;
170+ for (const auto & [localPathId, _] : userTables) {
171+ Cerr << " CDC_DEBUG: LocalPathId=" << localPathId << Endl;
172+ }
173+ Y_ENSURE (false , " Unknown table: " << tableId);
174+ }
155175
156176 auto userTable = Self->GetUserTables ().at (tableId.PathId .LocalPathId );
177+ Cerr << " CDC_DEBUG: Found user table with " << userTable->CdcStreams .size () << " CDC streams" << Endl;
157178 const auto & keyTags = userTable->KeyColumnIds ;
158179 const auto & keyTypes = userTable->KeyColumnTypes ;
159180 const auto valueTags = MakeValueTags (userTable->Columns );
@@ -173,6 +194,9 @@ bool TCdcStreamChangeCollector::Collect(const TTableId& tableId, ERowOp rop,
173194 }
174195
175196 for (const auto & [pathId, stream] : userTable->CdcStreams ) {
197+ Cerr << " CDC_DEBUG: Processing CDC stream PathId=" << pathId
198+ << " State=" << static_cast <ui32>(stream.State )
199+ << " Mode=" << static_cast <ui32>(stream.Mode ) << Endl;
176200 TMaybe<TRowState> initialState;
177201 TMaybe<TRowVersion> snapshotVersion;
178202
0 commit comments