Skip to content

Commit

Permalink
fix: enhance the code reading experience for lacking RPC generated fi…
Browse files Browse the repository at this point in the history
…les (#353)

Co-authored-by: JerryHu87 <56461496+JerryHu87@users.noreply.github.com>
Co-authored-by: imbajin <jin@apache.org> e768bf2
  • Loading branch information
javeme and 0x2f2f2f2f committed Apr 13, 2024
1 parent 16e6bd3 commit 7119258
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cn/docs/_print/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8099,7 +8099,7 @@
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// ignore log
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>Map</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>Object</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>props</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>parseProperties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>properties</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><p>然后,使用 RESTful API 请求 <code>HugeGraphServer</code>:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span> <span style=color:#000;font-weight:700>|</span> gunzip
</span></span></code></pre></div><p>此时,可以在调试器中查看详细的变量信息。</p><h4 id=5-log4j2-日志配置>5. Log4j2 日志配置</h4><p>默认情况下,运行 <code>InitStore</code> 和 <code>HugeGraphServer</code> 时,读取的 Log4j2 配置文件路径为 <code>hugegraph-dist/src/main/resources/log4j2.xml</code>,而不是 <code>path-to-your-directory/conf/log4j2.xml</code>,这个配置文件是使用<strong>脚本</strong>启动 HugeGraph-Server 时读取的。</p><p>为了避免同时维护两份配置文件,可以考虑在 <strong>IntelliJ IDEA</strong> 运行与调试 HugeGraph-Server 时,修改读取的 Log4j2 配置文件路径:</p><ol><li>打开之前创建的 <code>Application</code> 配置</li><li>点击 <code>Modify options</code> - <code>Add VM options</code></li><li>设置 VM options 为 <code>-Dlog4j.configurationFile=conf/log4j2.xml</code></li></ol><h3 id=可能遇到的问题>可能遇到的问题</h3><h4 id=1-java-package-sunmisc-does-not-exist>1. java: package sun.misc does not exist</h4><p>原因可能是在使用 <strong>Java 11</strong> 编译时触发了交叉编译,导致项目中使用的 <code>sun.misc.Unsafe</code> 找不到符号。有两种解决方案可供选择:</p><ol><li>在 IntelliJ IDEA 的 <code>Preferences/Settings</code> 中找到 <code>Java Compiler</code> 面板,然后关闭 <code>--release</code> 选项 (推荐)</li><li>或者将项目的 SDK 版本设置为 8 (Deprecated soon)</li></ol><h4 id=2-log4j2-日志无法打印-l-等位置信息>2. Log4j2 日志无法打印 %l 等位置信息</h4><p>这是因为 Log4j2 中使用了 asynchronous loggers,可以参考<a href=https://logging.apache.org/log4j/2.x/manual/layouts.html#LocationInformation>官方文档</a>进行配置</p><hr><h5 id=参考>参考</h5><ol><li><a href=/docs/quickstart/hugegraph-server/>HugeGraph-Server Quick Start</a></li><li><a href=https://gist.github.com/imbajin/1661450f000cd62a67e46d4f1abfe82c>hugegraph-server 本地调试文档 (Win/Unix)</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-180033>&ldquo;package sun.misc does not exist&rdquo; compilation error</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-201168>Cannot compile: java: package sun.misc does not exist</a></li><li><a href=https://github.com/apache/incubator-hugegraph/wiki/The-style-config-for-HugeGraph-in-IDEA>The code-style config for HugeGraph in IDEA</a></li></ol></div><div class=td-content style=page-break-before:always><h1 id=pg-e1fc3666faccec72ead94a2ed6a9f8a3>9.5 - Apache HugeGraph Committer 指南</h1><blockquote><p>本文档概述了 Apache Committer 推选要求以及流程,对应的 ASF 官方文档可见:https://community.apache.org/newcommitter.html</p></blockquote><h1 id=候选人要求>候选人要求</h1><ol><li>候选人应遵守 <a href=https://www.apache.org/foundation/policies/conduct.html>Apache Code of Conduct</a></li><li>PMC 成员将通过搜索<a href=https://lists.apache.org/list?dev@hugegraph.apache.org>邮件列表</a>、<a href=https://github.com/apache/hugegraph/issues>issues</a>、<a href=https://github.com/apache/incubator-hugegraph/pulls>PRs</a>、<a href=https://hugegraph.apache.org/docs>官网文档</a>等方式,了解候选人如何与他人互动,以及他们所做的贡献</li><li>以下是在评估候选人是否适合成为 Committer 时需要考虑的一些要点:<ol><li>与社区成员合作的能力</li><li>担任导师的能力</li><li>社区参与度</li><li>贡献程度</li><li>个人技能/能力</li></ol></li></ol><h1 id=推选详细流程>推选详细流程</h1><p><strong>讨论 (DISCUSS) → 投票 (VOTE) → 邀请 (INVITE) → 公告 (ANNOUNCE)</strong></p><h2 id=1-发起社区邮件讨论-discuss>1. 发起社区邮件讨论 (DISCUSS)</h2><p>任何 HugeGraph 的 (P)PMC 成员都可以发起投票讨论,在发现社区贡献者任何有价值的贡献并取得候选人本人同意后,可以在 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a> 发起讨论。
</span></span></code></pre></div><p>此时,可以在调试器中查看详细的变量信息。</p><h4 id=5-log4j2-日志配置>5. Log4j2 日志配置</h4><p>默认情况下,运行 <code>InitStore</code> 和 <code>HugeGraphServer</code> 时,读取的 Log4j2 配置文件路径为 <code>hugegraph-dist/src/main/resources/log4j2.xml</code>,而不是 <code>path-to-your-directory/conf/log4j2.xml</code>,这个配置文件是使用<strong>脚本</strong>启动 HugeGraph-Server 时读取的。</p><p>为了避免同时维护两份配置文件,可以考虑在 <strong>IntelliJ IDEA</strong> 运行与调试 HugeGraph-Server 时,修改读取的 Log4j2 配置文件路径:</p><ol><li>打开之前创建的 <code>Application</code> 配置</li><li>点击 <code>Modify options</code> - <code>Add VM options</code></li><li>设置 VM options 为 <code>-Dlog4j.configurationFile=conf/log4j2.xml</code></li></ol><h3 id=可能遇到的问题>可能遇到的问题</h3><h4 id=1-java-package-sunmisc-does-not-exist>1. java: package sun.misc does not exist</h4><p>原因可能是在使用 <strong>Java 11</strong> 编译时触发了交叉编译,导致项目中使用的 <code>sun.misc.Unsafe</code> 找不到符号。有两种解决方案可供选择:</p><ol><li>在 IntelliJ IDEA 的 <code>Preferences/Settings</code> 中找到 <code>Java Compiler</code> 面板,然后关闭 <code>--release</code> 选项 (推荐)</li><li>或者将项目的 SDK 版本设置为 8 (Deprecated soon)</li></ol><h4 id=2-java-storeraftrpcraftrequests-does-not-exist-rpc-generated-files>2. java: *.store.raft.rpc.RaftRequests does not exist (RPC Generated Files)</h4><p>原因是源代码没有包含 <code>RPC-generated</code> 文件。可以尝试两种方法来解决:</p><ol><li>[命令] 在根目录下运行 <code>mvn clean compile -DskipTests</code> (<strong>推荐</strong>)</li><li>[UI] 在 IDEA 中,右键点击 <code>hugegraph</code> 模块,选择 <code>Manve -> Generate Sources and Update Folders</code></li></ol><h4 id=3-log4j2-日志无法打印-l-等位置信息>3. Log4j2 日志无法打印 %l 等位置信息</h4><p>这是因为 Log4j2 中使用了 asynchronous loggers,可以参考<a href=https://logging.apache.org/log4j/2.x/manual/layouts.html#LocationInformation>官方文档</a>进行配置</p><hr><h5 id=参考>参考</h5><ol><li><a href=/docs/quickstart/hugegraph-server/>HugeGraph-Server Quick Start</a></li><li><a href=https://gist.github.com/imbajin/1661450f000cd62a67e46d4f1abfe82c>hugegraph-server 本地调试文档 (Win/Unix)</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-180033>&ldquo;package sun.misc does not exist&rdquo; compilation error</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-201168>Cannot compile: java: package sun.misc does not exist</a></li><li><a href=https://github.com/apache/incubator-hugegraph/wiki/The-style-config-for-HugeGraph-in-IDEA>The code-style config for HugeGraph in IDEA</a></li></ol></div><div class=td-content style=page-break-before:always><h1 id=pg-e1fc3666faccec72ead94a2ed6a9f8a3>9.5 - Apache HugeGraph Committer 指南</h1><blockquote><p>本文档概述了 Apache Committer 推选要求以及流程,对应的 ASF 官方文档可见:https://community.apache.org/newcommitter.html</p></blockquote><h1 id=候选人要求>候选人要求</h1><ol><li>候选人应遵守 <a href=https://www.apache.org/foundation/policies/conduct.html>Apache Code of Conduct</a></li><li>PMC 成员将通过搜索<a href=https://lists.apache.org/list?dev@hugegraph.apache.org>邮件列表</a>、<a href=https://github.com/apache/hugegraph/issues>issues</a>、<a href=https://github.com/apache/incubator-hugegraph/pulls>PRs</a>、<a href=https://hugegraph.apache.org/docs>官网文档</a>等方式,了解候选人如何与他人互动,以及他们所做的贡献</li><li>以下是在评估候选人是否适合成为 Committer 时需要考虑的一些要点:<ol><li>与社区成员合作的能力</li><li>担任导师的能力</li><li>社区参与度</li><li>贡献程度</li><li>个人技能/能力</li></ol></li></ol><h1 id=推选详细流程>推选详细流程</h1><p><strong>讨论 (DISCUSS) → 投票 (VOTE) → 邀请 (INVITE) → 公告 (ANNOUNCE)</strong></p><h2 id=1-发起社区邮件讨论-discuss>1. 发起社区邮件讨论 (DISCUSS)</h2><p>任何 HugeGraph 的 (P)PMC 成员都可以发起投票讨论,在发现社区贡献者任何有价值的贡献并取得候选人本人同意后,可以在 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a> 发起讨论。
讨论邮件里提议者要把候选人的贡献说清楚,并最好给出确认贡献的 URL 等信息,便于大家讨论分析。</p><p>下面是 HugeGraph 对应的邮件模板:(仅供参考)</p><blockquote><p>Note: 后续将使用 xxx 指代候选人名,一般 <code>xxx</code> 为一个容易读的名字 (例如 <code>Simon Jay</code>)</p><p><code>ASF-INFRA</code> 建议<strong>避免</strong>使用不易读的 <code>ID</code> 直接作为邮件<strong>人名代指</strong> (例如<strong>避免</strong> <code>simon321</code> 或 <code>wh0isSim0n</code> 😄)</p><p>另发送邮件最好选择 <strong>&ldquo;纯文本&rdquo;</strong> 模式,否则排版在 ASF Mail UI 中可能会乱</p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-markdown data-lang=markdown><span style=display:flex><span>To: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: [DISCUSS] XXX as a HugeGraph Committer Candidate
</span></span><span style=display:flex><span>
Expand Down
Loading

0 comments on commit 7119258

Please sign in to comment.