@@ -406,39 +406,34 @@ func checkWorkspaceEntryType(
406406 return (entry .typ == DELETE ) && (entry .fileName == "" )
407407}
408408
409- func checkTxnOffsetZero (ls * LocalDisttaeDataSource , writes []Entry ) {
410- if len (writes ) > 200 && ls .txnOffset == 0 && ls .table .accountId == 0 && ls .table .tableName == "mo_increment_columns" {
411- logutil .Info ("yyyyyy zero txnOffset" ,
412- zap .String ("txn" , hex .EncodeToString (ls .table .db .op .Txn ().ID )),
413- zap .Bool ("isSnapOp" , ls .table .db .op .IsSnapOp ()),
414- zap .String ("entries" , stringifySlice (writes [len (writes )- 2 :], func (a any ) string {
415- e := a .(Entry )
416- batstr := "nil"
417- if e .bat != nil {
418- batstr = common .MoBatchToString (e .bat , 3 )
419- }
420- return e .String () + " " + batstr
421- })))
422- }
423- }
424-
425409func checkTxnLastInsertRow (ls * LocalDisttaeDataSource , writes []Entry , cursor int , outBatch * batch.Batch ) {
426- if len (writes ) > 400 && ls .table .accountId == 0 && ls .table .tableName == "mo_increment_columns" && writes [len (writes )- 1 ].typ == INSERT && writes [len (writes )- 1 ].tableId == ls .table .tableId {
410+ injected , writesT := objectio .Debug19357Injected ()
411+ if injected && int64 (len (writes )) > writesT && len (outBatch .Vecs ) == 3 && ls .table .accountId == 0 && ls .table .tableName == "mo_increment_columns" && writes [len (writes )- 1 ].typ == INSERT && writes [len (writes )- 1 ].tableId == ls .table .tableId {
412+ outLen := outBatch .Vecs [0 ].Length ()
413+ var slim * batch.Batch
414+ if outLen > 0 {
415+ start := outLen - 3
416+ if start < 0 {
417+ start = 0
418+ }
419+ slim , _ = outBatch .Window (start , outLen )
420+ }
421+
427422 logutil .Info ("yyyyyy checkTxnLastInsertRow" ,
428423 zap .String ("txn" , hex .EncodeToString (ls .table .db .op .Txn ().ID )),
429424 zap .Int ("txnOffset" , ls .txnOffset ),
430425 zap .Int ("cursor" , cursor ),
431426 zap .Int ("writes" , len (writes )),
432427 zap .Bool ("isSnapOp" , ls .table .db .op .IsSnapOp ()),
433- zap .String ("entries" , stringifySlice (writes [len (writes )- 2 :], func (a any ) string {
428+ zap .String ("entries" , stringifySlice (writes [len (writes )- 1 :], func (a any ) string {
434429 e := a .(Entry )
435430 batstr := "nil"
436431 if e .bat != nil {
437432 batstr = common .MoBatchToString (e .bat , 3 )
438433 }
439434 return e .String () + " " + batstr
440435 })),
441- zap .String ("outBatch" , common .MoBatchToString (outBatch , 3 )),
436+ zap .String ("outBatch" , common .MoBatchToString (slim , 3 )),
442437 )
443438 }
444439}
@@ -488,13 +483,20 @@ func (ls *LocalDisttaeDataSource) filterInMemUnCommittedInserts(
488483 retainedRowIds = vector.MustFixedColWithTypeCheck [objectio.Rowid ](entry .bat .Vecs [0 ])
489484 offsets := engine_util .RowIdsToOffset (retainedRowIds , int64 (0 )).([]int64 )
490485
486+ offsetLen := len (offsets )
487+ badOffsetStart := offsetLen > 0 && offsets [0 ] > 0
488+
491489 b := retainedRowIds [0 ].BorrowBlockID ()
492490 sels , err := ls .ApplyTombstones (
493491 ls .ctx , b , offsets , engine .Policy_CheckUnCommittedOnly )
494492 if err != nil {
495493 return err
496494 }
497495
496+ if (len (sels ) < offsetLen || badOffsetStart ) && ls .table .accountId == 0 && ls .table .tableName == "mo_increment_columns" {
497+ logutil .Info ("Shrink retainedRowIds" , zap .Any ("sels" , sels ), zap .Any ("offsetsLen" , offsetLen ), zap .Bool ("badOffsetStart" , badOffsetStart ), zap .Int ("wsCursor" , ls .wsCursor ), zap .Int ("txnOffset" , ls .txnOffset ))
498+ }
499+
498500 if len (sels ) == 0 {
499501 continue
500502 }
0 commit comments