refactor: refactor sharded wal to handle coordinator#1237
refactor: refactor sharded wal to handle coordinator#1237
Conversation
|
View your CI Pipeline Execution ↗ for commit 55816b9
☁️ Nx Cloud last updated this comment at |
…rdinator-in-sharded-wal
# Conflicts: # packages/utils/src/lib/wal.ts # packages/utils/src/lib/wal.unit.test.ts
…-sharded-wal' into feat/utils/handle-coordinator-in-sharded-wal
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/axe-plugin
@code-pushup/nx-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/coverage-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit b46851f with previous commit dd6e35e. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 3 groups improved, 👎 3 groups regressed, 👍 9 audits improved, 👎 10 audits regressed, 17 audits changed without impacting score🗃️ Groups
28 other groups are unchanged. 🛡️ Audits
643 other audits are unchanged. |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit b46851f with previous commit dd6e35e. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🟡 60 | 🟡 61 | |
| Code coverage | 🟢 95 | 🟢 95 |
4 other categories are unchanged.
👍 1 group improved, 👎 1 group regressed, 👍 5 audits improved, 👎 3 audits regressed
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🟡 60 | 🟡 61 | |
| Code coverage | Code coverage metrics | 🟢 95 | 🟢 95 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| JSDocs coverage | Methods coverage | 🟨 10 undocumented methods | 🟨 10 undocumented methods | |
| JSDocs coverage | Properties coverage | 🟥 40 undocumented properties | 🟥 44 undocumented properties | |
| Code coverage | Branch coverage | 🟩 91.8 % | 🟩 91.3 % | |
| JSDocs coverage | Types coverage | 🟨 55 undocumented types | 🟨 56 undocumented types | |
| JSDocs coverage | Variables coverage | 🟥 49 undocumented variables | 🟥 50 undocumented variables | |
| Code coverage | Function coverage | 🟩 95.8 % | 🟩 95.9 % | |
| JSDocs coverage | Functions coverage | 🟥 243 undocumented functions | 🟥 242 undocumented functions | |
| Code coverage | Line coverage | 🟩 97.8 % | 🟩 97.8 % |
436 other audits are unchanged.
💼 Project plugin-lighthouse
🤨 Code PushUp report has both improvements and regressions.
🕵️ See full comparison in Code PushUp portal 🔍
All of 6 categories are unchanged.
1 audit changed without impacting score
🗃️ Groups
All of 15 groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Branch coverage | 🟩 98.8 % | 🟩 98.8 % |
443 other audits are unchanged.
12 other projects are unchanged.
| return ++ShardedWal.instanceCount; | ||
| }, | ||
| }); | ||
| readonly groupId = getUniqueTimeId(); |
There was a problem hiding this comment.
The groupId default value is always overwritten and never used. Consider declaring the field without a default.
| // create dir if not existing | ||
| ensureDirectoryExistsSync(groupDir); |
There was a problem hiding this comment.
I found it a bit hard to follow which layer is responsible for creating which directory. The finalize path calls ensureDirectoryExistsSync three times across two methods.
What do you think about moving the directory creation into finalize() so that shardFiles() stays a pure read method?
| } | ||
|
|
||
| /** | ||
| * NOTE: this helper is only used in this file. The rest of the repo avoids sync methods so it is not reusable. |
There was a problem hiding this comment.
The comment is misleading as ensureDirectoryExistsSync is actually exported and used in other files.
| : this.getCreatedShardFiles(); | ||
|
|
||
| return { | ||
| lastRecover: this.#lastRecovery, |
There was a problem hiding this comment.
Is there a specific reason why the names differ so that lastRecover maps to lastRecovery?
| * Handles distributed logging across multiple processes/files with atomic finalization. | ||
| */ | ||
|
|
||
| export class ShardedWal<T extends WalRecord = WalRecord> { |
There was a problem hiding this comment.
Nit: stale profiler references in JSDoc.
setCoordinatorProcess and isCoordinatorProcess have JSDoc and parameter names from before the generalization. profilerID param name, references to "origin PID", "enabled profiling", and CP_PROFILER_ORIGIN_PID. These could be updated to match the generic coordinator terminology used everywhere else in the class.
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Precondition:
Related:
This PR includes:
Followup: