@@ -117,8 +117,6 @@ class TJsonDescribe : public TViewerPipeClient {
117
117
118
118
void FillDescription (NKikimrSchemeOp::TDirEntry* descr, ui64 schemeShardId) {
119
119
descr->SetSchemeshardId (schemeShardId);
120
- descr->SetPathId (InvalidLocalPathId);
121
- descr->SetParentPathId (InvalidLocalPathId);
122
120
descr->SetCreateFinished (true );
123
121
descr->SetCreateTxId (0 );
124
122
descr->SetCreateStep (0 );
@@ -177,11 +175,21 @@ class TJsonDescribe : public TViewerPipeClient {
177
175
result->SetReason (record.GetReason ());
178
176
result->SetPath (record.GetPath ());
179
177
result->MutablePathDescription ()->CopyFrom (record.GetPathDescription ());
180
- result->SetPathId (record.GetPathId ());
178
+ if (record.GetPathId () != 0 && record.GetPathId () != InvalidLocalPathId) {
179
+ result->SetPathId (record.GetPathId ());
180
+ }
181
+ if (result->MutablePathDescription ()->GetSelf ().GetPathId () == 0 || result->MutablePathDescription ()->GetSelf ().GetPathId () == InvalidLocalPathId) {
182
+ result->MutablePathDescription ()->MutableSelf ()->ClearPathId ();
183
+ }
184
+ if (result->MutablePathDescription ()->GetSelf ().GetParentPathId () == 0 || result->MutablePathDescription ()->GetSelf ().GetParentPathId () == InvalidLocalPathId) {
185
+ result->MutablePathDescription ()->MutableSelf ()->ClearParentPathId ();
186
+ }
181
187
result->SetLastExistedPrefixPath (record.GetLastExistedPrefixPath ());
182
188
result->SetLastExistedPrefixPathId (record.GetLastExistedPrefixPathId ());
183
189
result->MutableLastExistedPrefixDescription ()->CopyFrom (record.GetLastExistedPrefixDescription ());
184
- result->SetPathOwnerId (record.GetPathOwnerId ());
190
+ if (record.GetPathOwnerId () != 0 && record.GetPathOwnerId () != InvalidOwnerId) {
191
+ result->SetPathOwnerId (record.GetPathOwnerId ());
192
+ }
185
193
result->SetSource (NKikimrViewer::TEvDescribeSchemeInfo::SchemeShard);
186
194
187
195
return result;
@@ -194,13 +202,23 @@ class TJsonDescribe : public TViewerPipeClient {
194
202
195
203
TAutoPtr<NKikimrViewer::TEvDescribeSchemeInfo> result (new NKikimrViewer::TEvDescribeSchemeInfo ());
196
204
result->SetPath (path);
197
- result->SetPathId (entry.Self ->Info .GetPathId ());
198
- result->SetPathOwnerId (entry.Self ->Info .GetSchemeshardId ());
199
-
200
205
auto * pathDescription = result->MutablePathDescription ();
201
206
auto * self = pathDescription->MutableSelf ();
202
-
203
- self->CopyFrom (entry.Self ->Info );
207
+ if (entry.Self ) {
208
+ self->CopyFrom (entry.Self ->Info );
209
+ if (self->GetPathId () == 0 || self->GetPathId () == InvalidLocalPathId) {
210
+ self->ClearPathId ();
211
+ }
212
+ if (self->GetParentPathId () == 0 || self->GetParentPathId () == InvalidLocalPathId) {
213
+ self->ClearParentPathId ();
214
+ }
215
+ if (entry.Self ->Info .GetPathId () != 0 && entry.Self ->Info .GetPathId () != InvalidLocalPathId) {
216
+ result->SetPathId (entry.Self ->Info .GetPathId ());
217
+ }
218
+ if (entry.Self ->Info .GetSchemeshardId () != 0 && entry.Self ->Info .GetSchemeshardId () != InvalidOwnerId) {
219
+ result->SetPathOwnerId (entry.Self ->Info .GetSchemeshardId ());
220
+ }
221
+ }
204
222
FillDescription (self, schemeShardId);
205
223
206
224
if (entry.ListNodeEntry ) {
@@ -255,6 +273,14 @@ class TJsonDescribe : public TViewerPipeClient {
255
273
PassAway ();
256
274
return ;
257
275
}
276
+ for (auto & child : *DescribeResult->MutablePathDescription ()->MutableChildren ()) {
277
+ if (child.GetPathId () == InvalidLocalPathId) {
278
+ child.ClearPathId ();
279
+ }
280
+ if (child.GetParentPathId () == InvalidLocalPathId) {
281
+ child.ClearParentPathId ();
282
+ }
283
+ }
258
284
TProtoToJson::ProtoToJson (json, *DescribeResult, JsonSettings);
259
285
DecodeExternalTableContent (json);
260
286
} else {
0 commit comments