diff --git a/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go b/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go index 6e406be56..11cc3bd04 100644 --- a/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go +++ b/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go @@ -177,12 +177,12 @@ func dumpCustomZoneHashes(cmd *cobra.Command, nnsHash util.Uint160, zone string, _ = inv.TerminateSession(sessionID) }() - items, err := inv.TraverseIterator(sessionID, &iter, nnsMaxTokens) + items, err := inv.TraverseIterator(sessionID, &iter, 0) for err == nil && len(items) != 0 { for i := range items { processItem(items[i]) } - items, err = inv.TraverseIterator(sessionID, &iter, nnsMaxTokens) + items, err = inv.TraverseIterator(sessionID, &iter, 0) } if err != nil { return fmt.Errorf("error during NNS domains iteration: %w", err) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 88f9703e7..2570bc2c9 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -260,8 +260,13 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int _ = c.rpcActor.TerminateSession(sid) }() + // Batch size for TraverseIterator() can restricted on the server-side. + traverseBatchSize := batchSize + if invoker.DefaultIteratorResultItems < traverseBatchSize { + traverseBatchSize = invoker.DefaultIteratorResultItems + } for { - items, err := c.rpcActor.TraverseIterator(sid, &r, batchSize) + items, err := c.rpcActor.TraverseIterator(sid, &r, traverseBatchSize) if err != nil { return err } @@ -271,7 +276,7 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int return err } } - if len(items) < batchSize { + if len(items) < traverseBatchSize { break } }