Skip to content

fix: S390x compatability#9746

Open
navaneeswar1011 wants to merge 4 commits into
dgraph-io:mainfrom
navaneeswar1011:s390x_compatability
Open

fix: S390x compatability#9746
navaneeswar1011 wants to merge 4 commits into
dgraph-io:mainfrom
navaneeswar1011:s390x_compatability

Conversation

@navaneeswar1011

@navaneeswar1011 navaneeswar1011 commented Jun 15, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are out of scope. Please revert. I will address in another PR

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