@@ -148,38 +148,49 @@ func ReadOneBlockWithMeta(
148148 }
149149
150150 var filledEntries []fileservice.IOEntry
151+ putFillHolder := func (i int , seqnum uint16 ) {
152+ if filledEntries == nil {
153+ filledEntries = make ([]fileservice.IOEntry , len (seqnums ))
154+ }
155+ filledEntries [i ] = fileservice.IOEntry {
156+ Size : int64 (seqnum ), // a marker, it can not be zero
157+ }
158+ }
159+
151160 blkmeta := meta .GetBlockMeta (uint32 (blk ))
152161 maxSeqnum := blkmeta .GetMaxSeqnum ()
153162 for i , seqnum := range seqnums {
154163 // special columns
155164 if seqnum >= SEQNUM_UPPER {
156165 metaColCnt := blkmeta .GetMetaColumnCount ()
157- // read appendable block file, the last columns is commits and abort
158- if seqnum == SEQNUM_COMMITTS {
166+ switch seqnum {
167+ case SEQNUM_COMMITTS :
159168 seqnum = metaColCnt - 1
160- } else if seqnum == SEQNUM_ABORT {
169+ case SEQNUM_ABORT :
161170 panic ("not support" )
162- } else {
171+ default :
163172 panic (fmt .Sprintf ("bad path to read special column %d" , seqnum ))
164173 }
174+ // if the last column is not commits, do not read it
175+ // 1. created by cn
176+ // 2. old version tn nonappendable block
165177 col := blkmeta .ColumnMeta (seqnum )
166- ext := col .Location ()
167- ioVec .Entries = append (ioVec .Entries , fileservice.IOEntry {
168- Offset : int64 (ext .Offset ()),
169- Size : int64 (ext .Length ()),
170- ToCacheData : factory (int64 (ext .OriginSize ()), ext .Alg ()),
171- })
178+ if col .DataType () != uint8 (types .T_TS ) {
179+ putFillHolder (i , seqnum )
180+ } else {
181+ ext := col .Location ()
182+ ioVec .Entries = append (ioVec .Entries , fileservice.IOEntry {
183+ Offset : int64 (ext .Offset ()),
184+ Size : int64 (ext .Length ()),
185+ ToCacheData : factory (int64 (ext .OriginSize ()), ext .Alg ()),
186+ })
187+ }
172188 continue
173189 }
174190
175191 // need fill vector
176192 if seqnum > maxSeqnum || blkmeta .ColumnMeta (seqnum ).DataType () == 0 {
177- if filledEntries == nil {
178- filledEntries = make ([]fileservice.IOEntry , len (seqnums ))
179- }
180- filledEntries [i ] = fileservice.IOEntry {
181- Size : int64 (seqnum ), // a marker, it can not be zero
182- }
193+ putFillHolder (i , seqnum )
183194 continue
184195 }
185196
0 commit comments