Skip to content

fix: S390x compatability#9746

Merged
matthewmcneely merged 4 commits into
dgraph-io:mainfrom
navaneeswar1011:s390x_compatability
Jun 19, 2026
Merged

fix: S390x compatability#9746
matthewmcneely merged 4 commits into
dgraph-io:mainfrom
navaneeswar1011:s390x_compatability

Conversation

@navaneeswar1011

@navaneeswar1011 navaneeswar1011 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a build failure encountered while compiling Dgraph on IBM s390x architecture caused by a datatype mismatch in the disk metrics module.

Problem

During compilation, the build fails in x/disk_metrics_linux.go due to architecture-specific type differences in the Linux syscall.Statfs_t structure.

The existing implementation performs arithmetic operations using mixed types:

disk.All = s.Frsize * int64(s.Blocks-reservedBlocks)
disk.Free = s.Frsize * int64(s.Bavail)

On s390x architecture, the datatype definitions for Frsize, Blocks, and Bavail differ from architectures such as x86_64, causing a compile-time type mismatch.

Fix

Added explicit type conversion for Frsize to ensure consistent datatype handling during arithmetic operations.

Updated code:

disk.All = int64(s.Frsize) * int64(s.Blocks-reservedBlocks)
disk.Free = int64(s.Frsize) * int64(s.Bavail)

Validation Performed

The fix was validated by building and testing on multiple architectures:

  • s390x (RHEL VM) → Build completed successfully
  • x86_64 (Ubuntu VM) → Build completed successfully
  • ARM64 (macOS) → Build completed successfully

Additionally verified:

  • Successful startup of both Zero and Alpha services
  • CRUD operations executed successfully after build validation

Impact

  • Resolves architecture-specific build failure on IBM s390x
  • Improves cross-platform compatibility
  • No functional logic changes introduced
  • No impact observed on existing supported architectures

Checklist

  • The PR title follows the
    Conventional Commits syntax, leading
    with fix:, feat:, chore:, ci:, etc.
  • Code compiles correctly and linting (via trunk) passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@navaneeswar1011 navaneeswar1011 requested a review from a team as a code owner June 15, 2026 14:44
@navaneeswar1011 navaneeswar1011 changed the title S390x compatability fix: S390x compatability Jun 16, 2026
Comment thread x/disk_metrics_linux_test.go Outdated
Comment thread .github/workflows/cd-dgraph.yml
@matthewmcneely matthewmcneely enabled auto-merge (squash) June 19, 2026 19:47
@matthewmcneely matthewmcneely merged commit 6d2c345 into dgraph-io:main Jun 19, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants