Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7d6602f
[fix](restore) Preserve cross-database references when restoring view…
Ryan19929 Jan 30, 2026
94e4258
[fix](vectorization) Fix BE UT core dump (#11)
xuchenhao Feb 2, 2026
7647032
Fix regression test cases. (#15)
xuchenhao Feb 5, 2026
4688961
Update build version RC version to hydcp-rc01
wenzhenghu Feb 9, 2026
b6d6b3b
change version to hydcp-1.0-rc01
wenzhenghu Feb 9, 2026
27f0048
Fix loop variable increment in database listing (#28)
xuchenhao Mar 20, 2026
e016543
[fix](scan) Fix missing predicate filter when Native and JNI readers …
wenzhenghu Mar 31, 2026
3faf967
[fix](ui) Fix query profile displaying as garbled text with html tags…
wenzhenghu Mar 31, 2026
63ad743
[fix](tool) Fix meta_tool coredump and dead loop issues (#32)
wenzhenghu Mar 31, 2026
42f8d9d
bump to hydcp-1.1-rc01 (#33)
wenzhenghu Apr 1, 2026
464dfce
[fix](catalog) avoid catalog/cache lock inversion in resetToUninitial…
wenzhenghu Apr 2, 2026
533fcdc
[opt](UI) Optimization for frontend UI (#36)
wenzhenghu Apr 2, 2026
132b517
fix: update ExternalCatalogResetToUninitializedTest to match External…
xuchenhao Apr 3, 2026
fd9d9cf
Revert "[fix](ui) Fix query profile displaying as garbled text with h…
wenzhenghu Apr 7, 2026
639c32e
bump to hydcp-1.1-rc02 (#40)
wenzhenghu Apr 9, 2026
094c804
[feature](agent) Port code-review skill and AGENTS.md to branch-3.1 (…
wenzhenghu Apr 9, 2026
fe18823
first commit
wenzhenghu May 15, 2026
57c7112
[fix](http) add missing uri import for redirect url build
wenzhenghu May 16, 2026
290687f
[fix](stream-load) improve redirect drain handling and tests
wenzhenghu May 17, 2026
1bcbccf
[fix](stream-load) fix redirect view test compatibility
wenzhenghu May 17, 2026
b12eebb
[fix](stream-load) make redirect drain idle wait configurable
wenzhenghu May 17, 2026
c482e3a
[fix](fe) Increase default stream load redirect drain limits
wenzhenghu May 18, 2026
a5b5fff
[fix](fe) Make Jetty unconsumed reads opt in
wenzhenghu May 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 281 additions & 0 deletions .claude/skills/code-review/SKILL.md

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# AGENTS.md — Apache Doris

This is the codebase for Apache Doris, an MPP OLAP database. It primarily consists of the Backend module BE (be/, execution and storage engine), the Frontend module FE (fe/, optimizer and transaction core), and the Cloud module (cloud/, storage-compute separation). Your basic development workflow is: modify code, build using standard procedures, add and run tests, and submit relevant changes.

## When running in a WORKTREE directory

To ensure smooth test execution without interference between worktrees, the first thing to do upon entering a worktree directory is to check if `.worktree_initialized` exists. If not, execute `hooks/setup_worktree.sh`, setting `$ROOT_WORKSPACE_PATH` to the base directory (typically `${DORIS_REPO}`) beforehand. After successful execution, verify that `.worktree_initialized` has been touched and that `thirdparty/installed` dependencies exist correctly. Also check if submodules have been properly initialized; if not, do so manually.

When working in worktree mode, all operations must be confined to the current worktree directory. Do not enter `${DORIS_REPO}` or use any resources there. Compilation and execution must be done within the current worktree directory. The compiled Doris cluster must use random ports not used by other worktrees (modify BE and FE conf before compilation, using a uniform offset of `${DORIS_PORT_OFFSET_RANGE}` from default ports without conflicting with other worktrees' ports). Run from the `output` directory within the worktree. To run regression tests, modify `regression-test/conf/regression-conf.groovy` and set the port numbers in jdbcUrl and other configuration items to your new ports so the corresponding worktree cluster can be used for regression testing.

## Coding Standards

> **Note for branch-3.1**: Since these standards were ported from the `master` branch, some cutting-edge features, error-handling macros, or architectural patterns might not be fully present in `branch-3.1`. When reviewing or writing code, **always prioritize matching the existing conventions in `branch-3.1`** over strictly forcing `master`'s new paradigms (e.g., if the old Planner is still used here, or if `Status` is preferred over `Result<T>` in certain modules).

Assert correctness only—never use defensive programming with `if` or similar constructs. Any `if` check for errors must have a clearly known inevitable failure path (not speculation). If no such scenario is found, strictly avoid using `if(valid)` checks. However, you may use the `DORIS_CHECK` macro for precondition assertions (If inside performance-sensitive areas like loops, it can only be `DCHECK`). For example, if logically A=true should always imply B=true, then strictly avoid `if(A&&B)` and instead use `if(A){DORIS_CHECK(B);...}`. In short, the principle is: upon discovering errors or unexpected situations, report errors or crash—never allow the process to continue.

When adding code, strictly follow existing similar code in similar contexts, including interface usage, error handling, etc., maintaining consistency. When adding any code, first try to reference existing functionality. Second, you must examine the relevant context paragraphs to fully understand the logic.

After adding code, you must first conduct self-review and refactoring attempts to ensure good abstraction and reuse as much as possible.

## Code Review

When conducting code review (including self-review and review tasks), it is necessary to complete the key checkpoints according to our `code-review` skill and provide conclusions for each key checkpoint (if applicable) as part of the final written description. Other content does not require individual responses; just check them during the review process.

## Build and Run Standards

Always use only the `build.sh` script with its correct parameters to build Doris BE and FE. When building, use `-j${DORIS_PARALLELISM}` parallelism. For example, the simplest BE+FE build command is `./build.sh --be --fe -j${DORIS_PARALLELISM}`.
Build type can be set via `BUILD_TYPE` in `custom_env.sh`, but only set it to `RELEASE` when explicitly required for performance testing; otherwise, keep it as `ASAN`.
You may modify BE and FE ports and network settings in `conf/` before compilation to ensure correctness and avoid conflicts.
Build artifacts are in the current directory's `output/`. If starting the service, ensure all process artifacts have their conf set with appropriate non-conflicting ports and `priority_networks = 10.16.10.3/24`. Use `--daemon` when starting. Cluster startup is slow; wait at least 30s for success. If still not ready after waiting, continue waiting. If not ready after a long time, check BE and FE logs to investigate.
For first-time cluster startup, you may need to manually add the backend.

## Testing Standards

All kernel features must have corresponding tests. Prioritize adding regression tests under `regression-test/`, while also having BE unit tests (`be/test/`) and FE unit tests (`fe/fe-core/src/test/`) where possible. Interface usage in test cases must first reference similar cases.

You must use the preset scripts in the codebase with their correct parameters to run tests (`run-regression-test.sh`, `run-be-ut.sh`, `run-fe-ut.sh`). Regression test result files must not be handwritten; they must be auto-generated via test scripts. When running regression tests, if using `-s` to specify a case, also try to use `-d` to specify the parent directory for faster execution. For example, for cases under `nereids_p0`, you can use `-d nereids_p0 -s xxx`, where `xxx` is the name from `suite("xxx")` in the groovy file.

BE-UT compilation must use at most `${DORIS_PARALLELISM}` parallelism also.

Key utility functions in BE code, as well as the core logic (functions) of complete features, must have corresponding unit tests. If it's inconvenient to add unit tests, the module design and function decomposition should be reviewed again to ensure high cohesion and low coupling are properly achieved.

Added regression tests must comply with the following standards:
1. Use `order_qt` prefix or manually add `order by` to ensure ordered results
2. For cases expected to error, use the `test{sql,exception}` pattern
3. After completing tests, do not drop tables; instead drop tables before using them in tests, to preserve the environment for debugging
4. For ordinary single test tables, do not use `def tableName` form; instead hardcode your table name in all SQL
5. Except for variables you explicitly need to adjust for testing current functionality, other variables do not need extra setup before testing. For example, nereids optimizer and pipeline engine settings can use default states

## Commit Standards

Files in git commit should only be related to the current modification task. Environment modifications for running (e.g., `conf/`, `AGENTS.md`, `hooks/`, etc.) must not be `git add`ed. When delivering the final task, you must ensure all actual code modifications have been committed.

Commit messages must follow the format below, which mirrors the PR template (`.github/PULL_REQUEST_TEMPLATE.md`):

```
[<type>](<module>) <Short summary of the change>

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary: <Describe the problem this commit addresses>

### Release note

<If applicable, describe user-visible changes; otherwise write "None">

### Check List (For Author)

- Test: <Specify which testing was done>
- Regression test / Unit Test / Manual test / No need to test (with reason)
- Behavior changed: No / Yes (with explanation)
- Does this need documentation: No / Yes (with doc PR link)
```

Key rules for commit messages:
1. The title must follow the `[type](module)` format validated by the PR title checker (`.github/workflows/title-checker.yml`). Common types include: `fix`, `feature`, `improvement`, `refactor`, `chore`, `test`, `doc`. Common modules include: `fe`, `be`, `cloud`, `regression`, `build`
2. The short summary must be concise and written in imperative mood (e.g., `[fix](fe) Fix null pointer in scan node` not `[fix](fe) Fixed null pointer`)
3. The `Issue Number` field must reference the corresponding GitHub Issue with `close #xxx` syntax when applicable
4. The `Release note` section must be filled in for any user-visible behavior or feature change; write "None" for internal refactoring or test-only changes
5. The test section must honestly reflect the testing performed; do not claim tests that were not actually run
20 changes: 20 additions & 0 deletions be/src/cloud/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BE Cloud Module — Review Guide

## Meta-Service RPC Pattern

`retry_rpc` in `cloud_meta_mgr.cpp` wraps BE-to-meta-service RPC error handling.

### Checkpoints

- [ ] New meta-service RPCs reuse `retry_rpc` instead of open-coding retry?
- [ ] `INVALID_ARGUMENT` returns immediately without retry?
- [ ] `KV_TXN_CONFLICT` keeps its separate retry budget from generic retries?
- [ ] Retry count, timeout, and backoff stay consistent with existing config pattern?

## CloudTablet Sync

- [ ] Lock order preserved: `_sync_meta_lock → _meta_lock`?
- [ ] `sync_rowsets()` double-checks local max version before remote work?
- [ ] Stale compaction-count detection checked against latest local counters before applying returned rowsets?
- [ ] `NOT_FOUND` and full re-sync paths clear local version state before rebuilding?
- [ ] `sync_if_not_running()` clears `_rs_version_map`, `_stale_rs_version_map`, and `_timestamped_version_tracker` before re-syncing?
29 changes: 29 additions & 0 deletions be/src/common/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# BE Common Module — Review Guide

## Error Handling: Status / Exception / Result<T>

| Type | Use | Propagation |
|------|-----|-------------|
| `Status` | Default error return | `RETURN_IF_ERROR` |
| `Exception` | Vectorized hot paths | `RETURN_IF_CATCH_EXCEPTION` |
| `Result<T>` | Value-or-error return | `DORIS_TRY` |

### Checkpoints

- [ ] Every `Status` return checked? Never `static_cast<void>(...)` to discard
- [ ] Every `THROW_IF_ERROR` has a `RETURN_IF_CATCH_EXCEPTION` or `RETURN_IF_ERROR_OR_CATCH_EXCEPTION` above it?
- [ ] `THROW_IF_ERROR` kept out of `Defer`, destructors, and stack-unwinding paths? Use `WARN_IF_ERROR` there
- [ ] Thrift/RPC handlers convert Doris exceptions at the boundary?
- [ ] `WARN_IF_ERROR` limited to cleanup/best-effort paths with non-empty message?
- [ ] `DORIS_CHECK` for invariants only, never speculative defensive checks?
- [ ] New catch blocks keep standard order: `doris::Exception` → `std::exception` → `...`?

## compile_check Mechanism

`compile_check_begin.h` / `compile_check_end.h` raise conversion warnings to errors.

### Checkpoints

- [ ] New declaration-heavy headers use paired `compile_check_begin.h` / `compile_check_end.h` matching neighbors?
- [ ] Narrowing conversions avoided (`int64_t→int32_t`, `size_t→int`, `uint64_t→int64_t`)?
- [ ] Third-party bypass uses `compile_check_avoid_begin.h` / `compile_check_avoid_end.h`, not local weakening?
32 changes: 32 additions & 0 deletions be/src/core/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# BE Core Module — Review Guide

## COW Column Semantics

Vectorized columns (`IColumn`) use intrusive-reference-counted copy-on-write.

### Checkpoints

- [ ] Exclusive ownership guaranteed before `mutate()` on hot paths? Shared ownership triggers deep copy
- [ ] `assume_mutable_ref()` used only when exclusive ownership is already guaranteed?
- [ ] After `Block::mutate_columns()`, columns put back with `set_columns()`?
- [ ] `convert_to_full_column_if_const()` materializes only `ColumnConst`; ordinary columns may return shared storage?

## Type System and Serialization

### Upgrade/Downgrade Compatibility

- [ ] Serialized block/datatype layout changes gated with `be_exec_version` where required?
- [ ] Old and new serialization branches updated together (byte-size, serialize, deserialize)?

### Decimal and Type Metadata

- [ ] Decimal result types check precision growth limits, no accidental incompatible widening?
- [ ] `DecimalV2` `original_precision`/`original_scale` set intentionally, not left as `UINT32_MAX` sentinel?
- [ ] `TScalarType` optional fields filled for DECIMAL, CHAR/VARCHAR, DATETIMEV2?
- [ ] Flattened `TTypeDesc.types` traversal correct for nested complex types?

## Block Merge Nullable Trap

`MutableBlock::merge_impl()` assumes nullable promotion shape without dynamic checking in release builds.

- [ ] New block merge logic preserves nullable-promotion preconditions?
26 changes: 26 additions & 0 deletions be/src/exec/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# BE Exec Module — Review Guide

## Pipeline Execution

### Operator Lifecycle

Tasks move through `INITED → RUNNABLE → BLOCKED → FINISHED → FINALIZED`.

- [ ] `SharedState` source/sink dependencies connected through `inject_shared_state()`?

### Memory Reservation and Spill

- [ ] Memory-heavy operators use `_try_to_reserve_memory()` before materializing large structures?
- [ ] `_memory_sufficient_dependency` wired in where pressure should block, not overrun?
- [ ] `revoke_memory()` preserves the existing spill path?

## Dependency Concurrency

- [ ] Default readiness preserved? Source starts blocked; sink starts ready
- [ ] `set_ready()` fast-path precheck vs `is_blocked_by()` lock-first asymmetry respected?
- [ ] New `Dependency` subclasses pair `block()` / `set_ready()` on every path?
- [ ] `CountedFinishDependency::add()` and `sub()` under `_mtx`?

## Atomics

- [ ] Relaxed atomics only for statistics; lifecycle/stop flags use at least acquire/release?
4 changes: 4 additions & 0 deletions be/src/io/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BE IO — Review Guide

- [ ] Public `FileSystem` operations use `FILESYSTEM_M` (inline on pthreads, `AsyncIO::run_task` on bthreads)?
- [ ] Remote-reader caching stays at `RemoteFileSystem::open_file_impl()`, not reimplemented per backend?
8 changes: 6 additions & 2 deletions be/src/olap/tablet_meta_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ Status TabletMetaManager::traverse_headers(

Status TabletMetaManager::load_json_meta(DataDir* store, const std::string& meta_path) {
std::ifstream infile(meta_path);
// Check if the file is successfully opened to prevent dead loop or reading errors
if (!infile.is_open()) {
return Status::Error<HEADER_LOAD_JSON_HEADER>("fail to open json meta file: {}", meta_path);
}
char buffer[102400];
std::string json_meta;
while (!infile.eof()) {
infile.getline(buffer, 102400);
// Read line by line until EOF to avoid dead loop on file read errors
while (infile.getline(buffer, 102400)) {
json_meta = json_meta + buffer;
}
boost::algorithm::trim(json_meta);
Expand Down
35 changes: 35 additions & 0 deletions be/src/runtime/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# BE Runtime Module — Review Guide

## MemTracker Hierarchy

Two levels: `MemTrackerLimiter` (heavyweight, with limits) and `MemTracker` (lightweight, nested accounting). Thread-local state via `ThreadMemTrackerMgr`.

### Checkpoints

- [ ] Task-bound threads/bthreads enter with `SCOPED_ATTACH_TASK`?
- [ ] Non-task background threads use `SCOPED_INIT_THREAD_CONTEXT`?
- [ ] Temporary limiter switching uses `SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER`, not manual save/restore?
- [ ] Thread-pool callbacks attach at callback entry, not deeper in the call chain?
- [ ] Large allocations use `try_reserve()` with `DEFER_RELEASE_RESERVED()` for balanced accounting on every exit?
- [ ] Code reachable from `ThreadMemTrackerMgr::consume` avoids operations that may allocate recursively?

## Object Lifecycle

- [ ] `ENABLE_FACTORY_CREATOR` classes use `create_shared()` / `create_unique()`, not raw `new`?
- [ ] Ownership cycles broken with `weak_ptr` or raw observer pointers?
- [ ] Single-owner paths use `unique_ptr` plus observer raw pointers?

## Cache Lifecycle

- [ ] Every `Cache::Handle*` released after use?
- [ ] Cache values inherit `LRUCacheValueBase` for tracked-byte release?
- [ ] New caches registered with `CacheManager` for global GC?

## Static Initialization

- [ ] New namespace-scope static/global depends on another TU's object? That is a SIOF hazard
- [ ] Fix: `constexpr`, same-header `inline`, or function-local static?

## Workload Group Memory

- [ ] When precise limit enforcement matters, code uses `check_mem_used()` not just `exceed_limit()`?
10 changes: 5 additions & 5 deletions be/src/runtime/exec_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,8 @@ class ExecEnv {
void set_storage_engine(std::unique_ptr<BaseStorageEngine>&& engine);
void set_inverted_index_searcher_cache(
segment_v2::InvertedIndexSearcherCache* inverted_index_searcher_cache);
void set_cache_manager(CacheManager* cm) { this->_cache_manager = cm; }
void set_process_profile(ProcessProfile* pp) { this->_process_profile = pp; }
void set_tablet_schema_cache(TabletSchemaCache* c) { this->_tablet_schema_cache = c; }
void set_delete_bitmap_agg_cache(DeleteBitmapAggCache* c) { _delete_bitmap_agg_cache = c; }
void set_tablet_column_object_pool(TabletColumnObjectPool* c) {
this->_tablet_column_object_pool = c;
}
void set_storage_page_cache(StoragePageCache* c) { this->_storage_page_cache = c; }
void set_segment_loader(SegmentLoader* sl) { this->_segment_loader = sl; }
void set_routine_load_task_executor(RoutineLoadTaskExecutor* r) {
Expand All @@ -337,6 +332,11 @@ class ExecEnv {
_non_block_close_thread_pool = std::move(pool);
}
#endif
void set_cache_manager(CacheManager* cm) { this->_cache_manager = cm; }
void set_tablet_schema_cache(TabletSchemaCache* c) { this->_tablet_schema_cache = c; }
void set_tablet_column_object_pool(TabletColumnObjectPool* c) {
this->_tablet_column_object_pool = c;
}
LoadStreamMapPool* load_stream_map_pool() { return _load_stream_map_pool.get(); }

vectorized::DeltaWriterV2Pool* delta_writer_v2_pool() { return _delta_writer_v2_pool.get(); }
Expand Down
35 changes: 35 additions & 0 deletions be/src/storage/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# BE Storage Module — Review Guide

## Tablet Locks

| Lock | Type | Role |
|------|------|------|
| `_meta_lock` | `shared_mutex` | Version maps and tablet metadata visibility |
| `_rowset_update_lock` | `mutex` | Serializes delete bitmap updates (publish / MoW) |
| `_base_compaction_lock` | `mutex` | Serializes base compaction |
| `_cumulative_compaction_lock` | `mutex` | Serializes cumulative compaction |

### Checkpoints

- [ ] `_rs_version_map` and `_stale_rs_version_map` accessed under `_meta_lock` with correct shared/exclusive mode?
- [ ] Tablet-meta mutations under exclusive `_meta_lock`?
- [ ] Nested locking follows established preconditions? (`update_delete_bitmap_without_lock()` requires both `_rowset_update_lock` and `_meta_lock`)
- [ ] TxnManager lock order: `_txn_lock → _txn_map_lock`?

## Rowset and Version Lifecycle

- [ ] `add_rowset()` / `modify_rowsets()` under exclusive `_meta_lock`?
- [ ] Version continuity preserved, or intentional same-version replacement used correctly?
- [ ] Same-version replacement: old rowset moved to unused-rowset tracking before new becomes authoritative?
- [ ] Reader/rowset code respects split lifetime: `shared_ptr` ownership + reader `acquire()` / `release()`?
- [ ] `StorageEngine::_unused_rowsets` deletable only when `use_count() == 1`?

## Delete Bitmap (MoW)

- [ ] Cloud mode: `TEMP_VERSION_COMMON` and sentinels replaced before bitmap use?
- [ ] Bitmap calculation serialized under `_rowset_update_lock`?
- [ ] Compaction bitmap uses latest compaction counters, not stale snapshots?

## Segment Writing

- [ ] MoW tables: `SegmentWriterOptions::enable_unique_key_merge_on_write` set to `true` on every path?
17 changes: 17 additions & 0 deletions be/src/storage/index/inverted/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Inverted Index — Review Guide

## Lifecycle

- [ ] Field declaration order preserves `_dir` before `_index_writer` lifetime dependency?
- [ ] Cache-facing code uses `InvertedIndexCacheHandle` over raw handles for paired release/retention?

## CLucene Boundary

CLucene uses `ErrorContext` + local FINALLY helpers, not Doris exception flow.

- [ ] New CLucene integrations use `ErrorContext` + `FINALLY` / `FINALLY_CLOSE` / `FINALLY_EXCEPTION`, not ad hoc try/catch?

## Three-Valued Logic Bitmap

- [ ] Bitmap logic preserves SQL three-valued semantics across `_data_bitmap` and `_null_bitmap`?
- [ ] `op_not` is `const` in signature but mutates shared state — callers handle this?
Loading
Loading