11#include " flat_part_dump.h"
22#include " flat_part_iface.h"
3- #include " flat_page_index .h"
3+ #include " flat_part_index_iter .h"
44#include " flat_page_data.h"
55#include " flat_page_frames.h"
66#include " flat_page_blobs.h"
@@ -51,10 +51,20 @@ namespace {
5151 Index (part, depth);
5252
5353 if (depth > 2 ) {
54- for (auto iter = part.Index ->Begin (); iter; ++iter) {
54+ auto index = TPartIndexIt (&part, Env, { });
55+
56+ for (ssize_t i = 0 ; ; i++) {
57+ auto ready = i == 0 ? index.Seek (0 ) : index.Next ();
58+ if (ready != EReady::Data) {
59+ if (ready == EReady::Page) {
60+ Out << " | -- the rest of the index rows aren't loaded" << Endl;
61+ }
62+ break ;
63+ }
64+
5565 Out << Endl;
5666
57- DataPage (part, iter-> GetPageId ());
67+ DataPage (part, index. GetPageId ());
5868 }
5969 }
6070 }
@@ -90,15 +100,21 @@ namespace {
90100 {
91101 Key.reserve (part.Scheme ->Groups [0 ].KeyTypes .size ());
92102
93- auto label = part.Index .Label ();
94-
95- const auto items = (part.Index ->End () - part.Index ->Begin () + 1 );
103+ auto index = TPartIndexIt (&part, Env, { });
104+ auto label = index.TryGetLabel ();
96105
97- Out
98- << " + Index{" << (ui16)label.Type << " rev "
99- << label.Format << " , " << label.Size << " b}"
100- << " " << items << " rec" << Endl
101- << " | Page Row Bytes (" ;
106+ if (label) {
107+ Out
108+ << " + Index{" << (ui16)label->Type << " rev "
109+ << label->Format << " , " << label->Size << " b}"
110+ << Endl
111+ << " | Page Row Bytes (" ;
112+ } else {
113+ Out
114+ << " + Index{unknown}"
115+ << Endl
116+ << " | Page Row Bytes (" ;
117+ }
102118
103119 for (auto off : xrange (part.Scheme ->Groups [0 ].KeyTypes .size ())) {
104120 Out << (off ? " , " : " " );
@@ -108,20 +124,24 @@ namespace {
108124
109125 Out << " )" << Endl;
110126
111- ssize_t seen = 0 ;
112-
113- for (ssize_t i = 0 ; i < items; i++) {
127+ for (ssize_t i = 0 ; ; i++) {
114128 Key.clear ();
115129
116- if (depth < 2 && (seen += 1 ) > 10 ) {
117- Out
118- << " | -- skipped " << (items - Min (items, seen - 1 ))
119- << " entries, depth level " << depth << Endl;
130+ if (depth < 2 && i >= 10 ) {
131+ Out << " | -- skipped the rest entries, depth level " << depth << Endl;
132+ break ;
133+ }
120134
135+ // prints without LastKeyRecord, but it seems ok for now
136+ auto ready = i == 0 ? index.Seek (0 ) : index.Next ();
137+ if (ready != EReady::Data) {
138+ if (ready == EReady::Page) {
139+ Out << " | -- the rest of the index rows aren't loaded" << Endl;
140+ }
121141 break ;
122142 }
123143
124- auto record = part. Index . At (i );
144+ auto record = index. GetRecord ( );
125145 for (const auto &info: part.Scheme ->Groups [0 ].ColsKeyIdx )
126146 Key.push_back (record->Cell (info));
127147
0 commit comments