diff options
author | Thomas Draebing <thomas.draebing@sap.com> | 2023-01-11 09:23:04 +0100 |
---|---|---|
committer | Luca Milanesio <luca.milanesio@gmail.com> | 2023-10-26 21:12:14 +0000 |
commit | 21da56b7bfb376e090c6b236ec5fde8550964d03 (patch) | |
tree | 07f99b0a4093dcb01b331112d85da25af7d8351e | |
parent | fafafb91b0f9749bcded5ee8fa6afc5c166358bf (diff) |
Add project and slice ID to name of thread reindexing changes
Release-Notes: skip
Change-Id: I7f190819200b492e16d77a79775e2fb5c511b635
(cherry picked from commit 080058e0053e5924f856ca3b146e340818c3a8a7)
-rw-r--r-- | java/com/google/gerrit/server/index/change/AllChangesIndexer.java | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/java/com/google/gerrit/server/index/change/AllChangesIndexer.java b/java/com/google/gerrit/server/index/change/AllChangesIndexer.java index 86326dc715..3935108199 100644 --- a/java/com/google/gerrit/server/index/change/AllChangesIndexer.java +++ b/java/com/google/gerrit/server/index/change/AllChangesIndexer.java @@ -236,19 +236,32 @@ public class AllChangesIndexer extends SiteIndexer<Change.Id, ChangeData, Change @Override public Void call() throws Exception { - OnlineReindexMode.begin(); - // Order of scanning changes is undefined. This is ok if we assume that packfile locality is - // not important for indexing, since sites should have a fully populated DiffSummary cache. - // It does mean that reindexing after invalidating the DiffSummary cache will be expensive, - // but the goal is to invalidate that cache as infrequently as we possibly can. And besides, - // we don't have concrete proof that improving packfile locality would help. - notesFactory - .scan( - projectSlice.metaIdByChange(), - projectSlice.name(), - id -> (id.get() % projectSlice.slices()) == projectSlice.slice()) - .forEach(r -> index(r)); - OnlineReindexMode.end(); + String oldThreadName = Thread.currentThread().getName(); + try { + Thread.currentThread() + .setName( + oldThreadName + + "[" + + projectSlice.name().toString() + + "-" + + projectSlice.slice() + + "]"); + OnlineReindexMode.begin(); + // Order of scanning changes is undefined. This is ok if we assume that packfile locality is + // not important for indexing, since sites should have a fully populated DiffSummary cache. + // It does mean that reindexing after invalidating the DiffSummary cache will be expensive, + // but the goal is to invalidate that cache as infrequently as we possibly can. And besides, + // we don't have concrete proof that improving packfile locality would help. + notesFactory + .scan( + projectSlice.metaIdByChange(), + projectSlice.name(), + id -> (id.get() % projectSlice.slices()) == projectSlice.slice()) + .forEach(r -> index(r)); + OnlineReindexMode.end(); + } finally { + Thread.currentThread().setName(oldThreadName); + } return null; } |