Change number mystery

127 views
Skip to first unread message

Goran Žauhar

unread,
Mar 9, 2023, 10:05:58 AM3/9/23
to Repo and Gerrit Discussion
Hi folks!

My Gerrit instance does not contain any changes! It only serves as git server.
$ curl --user admin:XXX https://mygerrit.example.com/a/changes/
)]}'
[]

Yet when creating my first change, it starts with change number 21:
$ git push origin HEAD:refs/for/master
Password for 'https://ad...@mygerrit.example.com':
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 48 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 470 bytes | 470.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4)
remote: Counting objects: 595, done
remote: Processing changes: refs: 1, new: 1, done    
remote:
remote: SUCCESS
remote:
remote:   https://mygerrit.example.com/c/MyProject/+/21 Dummy change [NEW]
remote:
To https://mygerrit.exmaple.com/a/MyProject
 * [new reference]         HEAD -> refs/for/master

List of changes shows no surprise, change 21 is here:
$ curl --user admin:adminpass https://mygerrit.example.com/a/changes/?pp=1
)]}'
[
  {
    "id": "MyProject~master~Ic717a2bc4d3b3dabf1eac31908758717e284d278",
    "project": "MyProject",
    "branch": "master",
    "hashtags": [],
    "change_id": "Ic717a2bc4d3b3dabf1eac31908758717e284d278",
    "subject": "Dummy change",
    "status": "NEW",
    "created": "2023-03-09 14:29:44.000000000",
    "updated": "2023-03-09 14:29:44.000000000",
    "submit_type": "MERGE_IF_NECESSARY",
    "insertions": 1,
    "deletions": 0,
    "total_comment_count": 0,
    "unresolved_comment_count": 0,
    "has_review_started": true,
    "meta_rev_id": "b4581507812209013730f67da608c2d755437540",
    "_number": 21,
    "owner": {
      "_account_id": 1000002
    },
    "requirements": [],
    "submit_records": [
      {
        "rule_name": "gerrit~DefaultSubmitRule",
        "status": "OK",
        "labels": [
          {
            "label": "Code-Review",
            "status": "MAY"
          },
          {
            "label": "Verified",
            "status": "MAY"
          }
        ]
      }
    ]
  }
]

What am I missing? Where are missing changes (1-20)? Somewhere hidden?
My Gerrit server started as 3.4, then it was upgraded to 3.5, and finally to 3.6.4.

More complete picture: this is my test Gerrit instance used for playing around. I restored it from backup many times.

Thank you for all your effort,
Goran

Edwin Kempin

unread,
Mar 9, 2023, 10:15:09 AM3/9/23
to Goran Žauhar, Repo and Gerrit Discussion
I wouldn't worry much about this.
Gerrit retrieves change numbers in batches of 20 numbers (see class Sequences and field DEFAULT_CHANGES_SEQUENCE_BATCH_SIZE).
Gerrit increases the persisted counter by 20 and then uses the 20 change numbers for creating the next 20 changes. Then it gets another batch of 20 change numbers.
If the server is restarted while the loaded change numbers were not used yet, those unused change numbers are dropped and a new batch of change numbers is loaded. This is how you can have gaps in change numbers.
 

Thank you for all your effort,
Goran

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/2e46b90c-0cd4-4df8-b4eb-d4461d5c4e23n%40googlegroups.com.

Goran Žauhar

unread,
Mar 10, 2023, 12:22:15 PM3/10/23
to Repo and Gerrit Discussion
On Thursday, March 9, 2023 at 4:15:09 PM UTC+1 Edwin Kempin wrote:
I wouldn't worry much about this.
Gerrit retrieves change numbers in batches of 20 numbers (see class Sequences and field DEFAULT_CHANGES_SEQUENCE_BATCH_SIZE).
Gerrit increases the persisted counter by 20 and then uses the 20 change numbers for creating the next 20 changes. Then it gets another batch of 20 change numbers.
If the server is restarted while the loaded change numbers were not used yet, those unused change numbers are dropped and a new batch of change numbers is loaded. This is how you can have gaps in change numbers.

Thank you Edwin for rapid response!

A bit unexpected behavior but if this is "by-design" - OK.

/Goran 

Reply all
Reply to author
Forward
0 new messages