Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuang-Minh Nguyen <qmnguyen@gitlab.com>2022-12-30 14:56:31 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2022-12-30 14:56:31 +0300
commit40f74aac5f0aa92f3841483321ecb3c5e0f70cfb (patch)
tree7e4b8a6cea110eb455719ff98b24acf129b864f3
parent4666f8afdd6a005034af3882eb24ecc23e86a670 (diff)
parent8e91c5746c4e70720de193e3748c56b7eb553b46 (diff)
Merge branch 'sh-fix-another-alignment-error' into 'master'
catfile: fix another 64-bit alignment error on objectInfoReader See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5226 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Co-authored-by: Stan Hu <stanhu@gmail.com>
-rw-r--r--internal/git/catfile/object_info_reader.go8
-rw-r--r--internal/git/catfile/request_queue.go9
2 files changed, 10 insertions, 7 deletions
diff --git a/internal/git/catfile/object_info_reader.go b/internal/git/catfile/object_info_reader.go
index d0e6cb1fc..c13fa6d1f 100644
--- a/internal/git/catfile/object_info_reader.go
+++ b/internal/git/catfile/object_info_reader.go
@@ -126,13 +126,15 @@ type ObjectInfoQueue interface {
// long-lived `git cat-file --batch-check` process such that we do not have to spawn a separate
// process per object info we're about to read.
type objectInfoReader struct {
+ // These items must be listed first to ensure 64-bit alignment on a 32-bit system.
+ // This explicit ordering can go away once we use Go 1.19's atomic types: https://gitlab.com/gitlab-org/gitaly/-/issues/4702
+ queue requestQueue
+ queueInUse int32
+
cmd *command.Command
objectHash git.ObjectHash
counter *prometheus.CounterVec
-
- queue requestQueue
- queueInUse int32
}
func newObjectInfoReader(
diff --git a/internal/git/catfile/request_queue.go b/internal/git/catfile/request_queue.go
index c020b17c8..77d7df647 100644
--- a/internal/git/catfile/request_queue.go
+++ b/internal/git/catfile/request_queue.go
@@ -43,14 +43,15 @@ type queueCounters struct {
}
type requestQueue struct {
+ // queueCounters is a separate structure to hold variables accessed with sync/atomic
+ // to ensure 64-bit alignment. This needs to be listed first.
+ // This explicit ordering can go away once we use Go 1.19's atomic types: https://gitlab.com/gitlab-org/gitaly/-/issues/4702
+ counters queueCounters
+
// objectHash is the object hash used by the repository the request queue has been
// spawned for.
objectHash git.ObjectHash
- // queueCounters is a separate structure to hold variables accessed with sync/atomic
- // to ensure 64-bit alignment.
- counters queueCounters
-
// isObjectQueue is set to `true` when this is a request queue which can be used for reading
// objects. If set to `false`, then this can only be used to read object info.
isObjectQueue bool