Gerrit search only giving 1st 500 records?

889 views
Skip to first unread message

Gaurav Negi

unread,
Aug 16, 2016, 1:40:57 PM8/16/16
to Repo and Gerrit Discussion

Dear All,

   In our case, direct push is allowed (which we plan to block sometime soon and forcing everyone to go via Gerrit verification).

So currently some commits are directly pushed and some goes via Gerrit verification. 

 

I wanted to calculate how many went through gerrit? I am runing this query      

ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master before:2016-08-15 after:2016-07-14 --current-patch-set| grep revision: 


But looks like above query only fetches 500 records, not more than that. 

Can I know how can I fetch all the records? We are using Gerrit 2.12.3


Thanks

-Gaurav

Jonathan Nieder

unread,
Aug 16, 2016, 1:44:57 PM8/16/16
to Gaurav Negi, Repo and Gerrit Discussion
https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/cmd-query.html#_description tells me:

A query may be limited on the number of results it returns with the 'limit:' operator. If no limit is supplied an internal default limit is used to prevent explosion of the result set. To obtain results beyond the limit, the '--start' flag can be used to resume the query after skipping a certain number of results.

Hope that helps,
Jonathan

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Borowitz

unread,
Aug 16, 2016, 3:34:53 PM8/16/16
to Jonathan Nieder, Gaurav Negi, Repo and Gerrit Discussion
There is also a permission that controls the maximum value of --limit allowed for a particular user:

On Tue, Aug 16, 2016 at 1:44 PM, 'Jonathan Nieder' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/cmd-query.html#_description tells me:

A query may be limited on the number of results it returns with the 'limit:' operator. If no limit is supplied an internal default limit is used to prevent explosion of the result set. To obtain results beyond the limit, the '--start' flag can be used to resume the query after skipping a certain number of results.

Hope that helps,
Jonathan
Le mar. 16 août 2016 à 10:40, Gaurav Negi <gaura...@gmail.com> a écrit :

Dear All,

   In our case, direct push is allowed (which we plan to block sometime soon and forcing everyone to go via Gerrit verification).

So currently some commits are directly pushed and some goes via Gerrit verification. 

 

I wanted to calculate how many went through gerrit? I am runing this query      

ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master before:2016-08-15 after:2016-07-14 --current-patch-set| grep revision: 


But looks like above query only fetches 500 records, not more than that. 

Can I know how can I fetch all the records? We are using Gerrit 2.12.3


Thanks

-Gaurav

--
--

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.

Gaurav Negi

unread,
Aug 16, 2016, 3:36:46 PM8/16/16
to Dave Borowitz, Jonathan Nieder, Repo and Gerrit Discussion
Thanks Jonathan and Dave, 
I already tried that. Still same result with limit:2000

[jenkins@jenkins-NOS-001 main]$ ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master --current-patch-set limit:2000 | grep revision: | awk -F":" '{print $2}' | wc -l

500


[jenkins@jenkins-NOS-001 main]$ ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master --current-patch-set --limit 2000 | grep revision: | awk -F":" '{print $2}' | wc -l

fatal: "--limit" is not a valid option

0

[jenkins@jenkins-NOS-001 main]$ ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master --current-patch-set --limit:2000 | grep revision: | awk -F":" '{print $2}' | wc -l

fatal: "--limit:2000" is not a valid option

Khai Do

unread,
Aug 16, 2016, 4:09:25 PM8/16/16
to Repo and Gerrit Discussion, dbor...@google.com, j...@google.com
Yeah, the limit setting is confusing to me as well.  You will probably need to script it to grab more than the limit.  There's a change in gerritlib[1] project for this purpose.

To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

David Pursehouse

unread,
Aug 16, 2016, 9:14:40 PM8/16/16
to Gaurav Negi, Dave Borowitz, Jonathan Nieder, Repo and Gerrit Discussion
On Wed, Aug 17, 2016 at 4:36 AM Gaurav Negi <gaura...@gmail.com> wrote:
Thanks Jonathan and Dave, 
I already tried that. Still same result with limit:2000

[jenkins@jenkins-NOS-001 main]$ ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master --current-patch-set limit:2000 | grep revision: | awk -F":" '{print $2}' | wc -l

500



The default query limit is 500, so it will never return more than that unless you allow a higher limit by assigning the queryLimit capability [1] to your user's group.

If there are more results than the limit, the last change in the results will have the "_more_changes" field, as described in the Query Changes REST API documentation [2].  You can then issue the same command again, but with the 'start' option to skip the results that you already have.



 

[jenkins@jenkins-NOS-001 main]$ ssh -p 29418 jenki...@gerrit.com gerrit query status:merged project:main branch:master --current-patch-set --limit 2000 | grep revision: | awk -F":" '{print $2}' | wc -l

fatal: "--limit" is not a valid option


limit is not an option, but a query operator.  It was correct in the previous command.

Reply all
Reply to author
Forward
0 new messages