Skip to content

fix(ci): align JNI LTO compiler - #5

Closed
imbajin wants to merge 5 commits into
memtable_as_log_indexfrom
fix-jni-ci
Closed

fix(ci): align JNI LTO compiler#5
imbajin wants to merge 5 commits into
memtable_as_log_indexfrom
fix-jni-ci

Conversation

@imbajin

@imbajin imbajin commented Jul 21, 2026

Copy link
Copy Markdown

0x00 Summary

Align both JNI workflows with the GCC 13 LTO toolchain used by the prebuilt CSPP trial objects.

Before After
GCC 11 linked GCC 13 LTO objects Ubuntu 24.04 with explicit gcc-13 / g++-13

0x01 Root cause

The prebuilt cspp_memtable.o contains GCC 13.1 LTO bytecode, while the previous JNI workflow linked it with GCC 11.3:

lto1: bytecode stream ... generated with LTO version 13.1
instead of the expected 11.3

0x02 Scope

  • Update topling-jni.yml
  • Update topling-jni-release.yml
  • Keep Makefile unchanged

The non-fatal make depend errors are handled upstream by 635f082 (ci(jni): ignore explicit make depend failures).

0x03 Validation

  • Rebased onto 635f082
  • git diff --check
  • PR diff contains only the two JNI workflows

Summary by CodeRabbit

  • 新增功能

    • 基准测试页面现支持链接至 GitHub Actions 工件,便于查看运行日志。
    • 基准测试日志将作为保留 90 天的工件上传,避免直接暴露在 Pages 页面中。
  • 构建与发布

    • JNI 构建与发布流程升级至 Ubuntu 24.04,并支持手动触发发布任务。
  • Bug 修复

    • 修复内存映射文件引用计数未正确初始化的问题,降低资源无法释放和内存泄漏风险。
    • 改进基准测试页面生成时的日志校验与元数据处理。

Copilot AI review requested due to automatic review settings July 21, 2026 07:52
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Changes

基准日志工件发布

Layer / File(s) Summary
日志页面生成与工件链接
.github/scripts/bench_dcompact_pages.py, .github/scripts/bench_logs_to_pages.py
页面不再复制 LOG-* 文件,改为在提供 Actions 运行 URL 时生成外部工件链接;缺少 URL 时拒绝生成页面,并补齐 engine-meta.json
基准工作流上传日志
.github/workflows/db_bench-dcompact-run.yml, .github/workflows/db_bench-run.yml
两个工作流上传 LOG-* Actions 工件,设置 90 天保留期,并传递运行 URL。

JNI 构建与 mmap 初始化

Layer / File(s) Summary
JNI CI 编译环境更新
.github/workflows/topling-jni.yml, .github/workflows/topling-jni-release.yml
构建环境切换至 Ubuntu 24.04 与 GCC 13,并使指定 make depend 命令失败时继续执行。
mmap 引用计数初始化
env/file_system.cc
ReadonlyFileMmap 构造函数显式将 ref_count_ 初始化为 0。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: rockeet

Sequence Diagram(s)

sequenceDiagram
  participant BenchmarkWorkflow
  participant LogPageScript
  participant ActionsArtifact
  participant GitHubPages
  BenchmarkWorkflow->>ActionsArtifact: 上传 LOG-* 工件
  BenchmarkWorkflow->>LogPageScript: 传入 Actions 运行 URL
  LogPageScript->>LogPageScript: 收集工件名称
  LogPageScript->>GitHubPages: 生成外部工件链接
  GitHubPages->>ActionsArtifact: 链接至运行工件
Loading

Poem

兔子蹦蹦把日志装,
工件上传闪着光。
页面不藏原始档,
链接引向 Actions 旁。
GCC 十三齐开工,
mmap 计数零起航。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了该 PR 的核心变化:为 JNI CI 对齐 LTO 编译器到 GCC 13。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-jni-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the Makefile to conditionally clone the 'topling-rocks' and 'cspp-memtable' repositories only when 'UPDATE_REPO' is not set to '0'. Additionally, it excludes the prebuilt source file 'cspp_memtable.cc' from 'ALL_SOURCES' to prevent dependency generation issues. The reviewer feedback suggests also excluding 'top_zip_table_builder.cc' from 'ALL_SOURCES' to avoid similar build dependency failures, and wrapping the cloning of the 'cspp-wbwi' repository in the same 'UPDATE_REPO' conditional check for consistency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Makefile Outdated
# Exclude build_version.cc -- a generated source file -- from all sources. Not needed for dependencies
ALL_SOURCES = $(filter-out util/build_version.cc, $(LIB_SOURCES)) $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES) $(GTEST_DIR)/gtest/gtest-all.cc
# Exclude generated and prebuilt sources that do not need dependencies.
ALL_SOURCES = $(filter-out util/build_version.cc sideplugin/topling-zip_table_reader/cspp_memtable.cc, $(LIB_SOURCES)) $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES) $(GTEST_DIR)/gtest/gtest-all.cc

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Just like cspp_memtable.cc, the synthetic source file sideplugin/topling-zip_table_reader/top_zip_table_builder.cc (added to EXTRA_LIB_SOURCES at line 653 when TOPLING_ZIP_TABLE_TRIAL_DAYS is set and topling-rocks is missing) does not exist on disk and has no rule to be generated in this scenario.\n\nIf TOPLING_ZIP_TABLE_TRIAL_DAYS is set, make depend will fail with a similar error:\ntext\nNo rule to make target 'sideplugin/topling-zip_table_reader/top_zip_table_builder.cc',\nneeded by '.../sideplugin/topling-zip_table_reader/top_zip_table_builder.cc.d'.\n\n\nTo prevent this, we should also exclude sideplugin/topling-zip_table_reader/top_zip_table_builder.cc from ALL_SOURCES so that its dependency file is not generated.

ALL_SOURCES  = $(filter-out util/build_version.cc sideplugin/topling-zip_table_reader/cspp_memtable.cc sideplugin/topling-zip_table_reader/top_zip_table_builder.cc, $(LIB_SOURCES)) $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES) $(GTEST_DIR)/gtest/gtest-all.cc

Comment thread Makefile Outdated
endif

ifeq (,$(wildcard sideplugin/cspp-memtable))
ifneq (${UPDATE_REPO},0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While you have successfully protected the cspp-memtable and topling-rocks clones when UPDATE_REPO=0, the private repository cspp-wbwi (cloned around line 491) is still cloned unconditionally when it is missing.\n\nTo avoid unnecessary clone attempts and potential failures/delays in CI, you should also wrap the cspp-wbwi clone in a similar ifneq (${UPDATE_REPO},0) check.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes JNI CI dependency-generation failures when the private CSPP MemTable sources are unavailable by ensuring Make’s depend step no longer tries to generate .d files for a synthetic, intentionally-nonexistent cspp_memtable.cc path, while keeping the prebuilt cspp_memtable.o download rule usable for linking.

Changes:

  • Guard private-repository clone probes (topling-rocks, cspp-memtable) behind UPDATE_REPO!=0 so UPDATE_REPO=0 builds don’t attempt them.
  • Exclude sideplugin/topling-zip_table_reader/cspp_memtable.cc from ALL_SOURCES so it doesn’t produce a *.cc.d dependency target during make depend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Makefile (1)

475-482: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

移除多余的 cd 命令

在这个 shell 调用中,cd cspp-memtable; 是最后一条执行的命令。由于它位于执行完毕后即被销毁的子 Shell 中,且其后没有任何操作,这个目录切换动作实际上是无效的,可以安全地移除以保持代码整洁。

💡 建议的修改
 ifneq (${UPDATE_REPO},0)
  # topling specific: just for people who has permission to cspp-memtable
  dummy := $(shell set -e -x; \
    cd sideplugin; \
-   git clone https://github.com/topling/cspp-memtable; \
-   cd cspp-memtable; \
+   git clone https://github.com/topling/cspp-memtable \
  )
 endif
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 475 - 482, Remove the trailing `cd cspp-memtable;`
command from the `dummy` shell invocation guarded by `UPDATE_REPO`, leaving the
repository clone operation and shell structure unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Makefile`:
- Around line 475-482: Remove the trailing `cd cspp-memtable;` command from the
`dummy` shell invocation guarded by `UPDATE_REPO`, leaving the repository clone
operation and shell structure unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd9d5db2-226d-4721-9bde-3f6cf4f3bbda

📥 Commits

Reviewing files that changed from the base of the PR and between daa09d4 and a74dcb9.

📒 Files selected for processing (13)
  • .github/workflows/sanity_check.yml
  • .github/workflows/topling-jni-release.yml
  • .github/workflows/topling-jni.yml
  • Makefile
  • TARGETS
  • db/db_memtable_test.cc
  • env/fs_cat.cc
  • env/fs_cat.h
  • file/writable_file_writer.cc
  • java/rocksjni/side_plugin_repo_jni.cc
  • util/thread_local.cc
  • utilities/transactions/lock/point/point_lock_manager.cc
  • utilities/write_batch_with_index/write_batch_with_index_test.cc
🚧 Files skipped from review as they are similar to previous changes (11)
  • util/thread_local.cc
  • .github/workflows/topling-jni-release.yml
  • .github/workflows/topling-jni.yml
  • TARGETS
  • file/writable_file_writer.cc
  • utilities/write_batch_with_index/write_batch_with_index_test.cc
  • env/fs_cat.h
  • env/fs_cat.cc
  • java/rocksjni/side_plugin_repo_jni.cc
  • db/db_memtable_test.cc
  • utilities/transactions/lock/point/point_lock_manager.cc

rockeet and others added 5 commits July 25, 2026 17:08
LOG files are too large for the pages repo; link to the run's Artifacts instead.
…eaks

Under C++17, std::atomic's default constructor does not zero-initialize. intrusive_ptr
refcounts can start from heap garbage and never reach zero, so .blob mappings remain
in Shared RSS after compact deletes the files.
Trial synthetic CSPP sources can fail DEPFILES generation; keep the
build going like the implicit -include path used by db_bench.
- pin both JNI workflows to Ubuntu 24.04
- select GCC 13 for prebuilt trial LTO objects
- remove the stale GCC 11 version hint
@imbajin imbajin changed the title fix(build): handle prebuilt CSPP dependency in JNI CI fix(ci): align JNI LTO compiler Jul 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/db_bench-dcompact-run.yml:
- Line 166: Allow artifact replacement on reruns by updating both
upload-artifact steps: .github/workflows/db_bench-dcompact-run.yml lines 164-169
and .github/workflows/db_bench-run.yml lines 442-448. Set overwrite: true for
each upload, or include github.run_attempt in both db-info-logs-${{ env.VARIANT
}} artifact names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a99b2954-8e7c-4095-b54b-aaeb108147f0

📥 Commits

Reviewing files that changed from the base of the PR and between 122c3e9 and a46a3df.

📒 Files selected for processing (7)
  • .github/scripts/bench_dcompact_pages.py
  • .github/scripts/bench_logs_to_pages.py
  • .github/workflows/db_bench-dcompact-run.yml
  • .github/workflows/db_bench-run.yml
  • .github/workflows/topling-jni-release.yml
  • .github/workflows/topling-jni.yml
  • env/file_system.cc
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/topling-jni.yml
  • .github/workflows/topling-jni-release.yml

- name: Upload DB INFO LOGs (Actions artifact)
uses: actions/upload-artifact@v4
with:
name: db-info-logs-${{ env.VARIANT }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow references =="
rg -n "upload-artifact|db-info-logs|mantisbt" .github/workflows/db_bench*.yml || true

echo
echo "== relevant slices =="
for f in .github/workflows/db_bench-dcompact-run.yml .github/workflows/db_bench-run.yml; do
  echo "--- $f ---"
  nl -ba "$f" | sed -n '140,180p;430,455p'
done

echo
echo "== all upload-artifact configs in workflows =="
rg -n "upload-artifact|overwrite:|github.run_attempt|name:" .github/workflows/db_bench*.yml

Repository: hugegraph/toplingdb

Length of output: 822


🌐 Web query:

actions/upload-artifact v4 overwrite true run attempts artifact names same workflow run

💡 Result:

In GitHub Actions, actions/upload-artifact@v4 enforces immutability for artifacts [1][2]. Unlike previous versions, you cannot modify an existing artifact or upload to the same artifact name multiple times within the same workflow run without explicit configuration [3][2]. By default, attempting to upload an artifact with a name that already exists in the same workflow run will cause the action to fail [4][5]. To manage scenarios where you want to replace an existing artifact, you can use the overwrite: true input [4][6]. When overwrite: true is set, the action will delete the existing artifact with the matching name before uploading the new one [4][5]. It is important to note the following: 1. New ID: The new artifact will be assigned an entirely new ID, and the previous artifact will no longer exist [4][5]. 2. Not for concurrency: overwrite: true is intended for replacing an artifact, not for enabling concurrent uploads from multiple jobs to the same artifact name [7]. Uploading to the same artifact name across multiple jobs is not supported in v4 [2][5]. If you need to combine outputs from multiple jobs, the recommended approach is to give each artifact a unique name (e.g., using matrix variables) and then use the merge-multiple functionality when downloading them [1][3][7].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== relevant slices =="
for f in .github/workflows/db_bench-dcompact-run.yml .github/workflows/db_bench-run.yml; do
  echo "--- $f ---"
  awk 'NR>=140 && NR<=180 {printf "%5d %s\n", NR, $0}' "$f"
  printf '\n'
  awk 'NR>=430 && NR<=455 {printf "%5d %s\n", NR, $0}' "$f"
  printf '\n--- all upload-artifact config in $f ---\n'
  awk '/upload-artifact|overwrite:|name:|persist-credentials:|retention-days:/{start=NR-5; end=NR+10} start && NR>=start && NR<=end+5 {printf "%5d %s\n", NR, $0}' "$f" | tail -50
done

echo
echo "== dependency on these artifacts =="
rg -n "db-info-logs|download-artifact|github.run_attempt" .github/workflows/db_bench*.yml

Repository: hugegraph/toplingdb

Length of output: 10158


重跑时允许覆盖上传的 artifact

upload-artifact@v4 中,同一 workflow run 使用同一名 artifact 会失败;请在两处上传步骤中设置 overwrite: true,或在 db-info-logs-${{ env.VARIANT }} 中纳入 github.run_attempt

  • .github/workflows/db_bench-dcompact-run.yml#L164-L169
  • .github/workflows/db_bench-run.yml#L442-L448
📍 Affects 2 files
  • .github/workflows/db_bench-dcompact-run.yml#L166-L166 (this comment)
  • .github/workflows/db_bench-run.yml#L445-L445
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/db_bench-dcompact-run.yml at line 166, Allow artifact
replacement on reruns by updating both upload-artifact steps:
.github/workflows/db_bench-dcompact-run.yml lines 164-169 and
.github/workflows/db_bench-run.yml lines 442-448. Set overwrite: true for each
upload, or include github.run_attempt in both db-info-logs-${{ env.VARIANT }}
artifact names.

Source: MCP tools

@imbajin imbajin closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants