@@ -10842,32 +10842,32 @@ void HandleMysqlShowLocks ( RowBuffer_i & tOut )
1084210842 if ( !tOut.HeadEnd () )
1084310843 return ;
1084410844
10845+ auto fnLine = [&tOut](const NamedIndexType_t& dPair, int iLocks, const char * szType ) noexcept -> bool
10846+ {
10847+ tOut.PutString ( GetIndexTypeName ( dPair.m_eType ) );
10848+ tOut.PutString ( dPair.m_sName );
10849+ tOut.PutString ( szType );
10850+ tOut.PutStringf ( " Count: %d" , iLocks );
10851+ return tOut.Commit ();
10852+ };
1084510853
1084610854 // collect local, rt, percolate
1084710855 auto dIndexes = GetAllServedIndexes ();
1084810856 for ( auto & dPair: dIndexes )
1084910857 {
10850- switch ( dPair.m_eType )
10858+ auto pIndex = GetServed ( dPair.m_sName );
10859+ if ( ServedDesc_t::IsMutable ( pIndex ) )
1085110860 {
10852- case IndexType_e::RT:
10853- case IndexType_e::PERCOLATE:
10854- {
10855- auto pIndex = GetServed ( dPair.m_sName );
10856- assert ( ServedDesc_t::IsMutable ( pIndex ) );
1085710861 RIdx_T<RtIndex_i *> pRt { pIndex };
10858- int iLocks = pRt->GetNumOfLocks ();
10859- if ( iLocks>0 )
10860- {
10861- tOut.PutString ( GetIndexTypeName ( dPair.m_eType ) );
10862- tOut.PutString ( dPair.m_sName );
10863- tOut.PutString ( " freeze" );
10864- tOut.PutStringf ( " Count: %d" , iLocks );
10865- if ( !tOut.Commit () )
10866- return ;
10867- }
10862+ const int iLocks = pRt->GetNumOfLocks ();
10863+ if ( iLocks>0 && !fnLine ( dPair, iLocks, " freeze" ) )
10864+ return ;
1086810865 }
10869- default :
10870- break ;
10866+ if ( ServedDesc_t::IsLocal ( pIndex ) )
10867+ {
10868+ const int iRLocks = pIndex->GetReadLocks ();
10869+ if ( iRLocks>0 && !fnLine ( dPair, iRLocks, " read" ) )
10870+ return ;
1087110871 }
1087210872 }
1087310873
0 commit comments