-
Notifications
You must be signed in to change notification settings - Fork 14.9k
MINOR: Kafka Streams code samples formating unification #10651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINOR: Kafka Streams code samples formating unification #10651
Conversation
Code samples are now unified and correctly formatted. Samples under Streams use consistently the prism library.
|
The test failures in this PR should be unrelated to the changes introduced (docs). Is there anything I should do to move the PR forward? |
|
For the record: |
|
Thank for the PR! For the next time, I would recommend to open smaller PRs. Almost 2000 additions is a lot even for docs. In my experience smaller PRs tend to be merged faster. |
|
Do not worry about the test failures. First of all, your PR does not touch any code, so there is no reason a test would fail due to your PR. Additionally, the failing tests are all known to be flaky. You can find known flaky tests in the JIRA by searching for the test name. |
|
@cadonna I'll do it next time. I was doubting between providing a PR per file or a PR per folder. (ended up doing PR for the Streams folder). |
|
Most of the changes are purely cosmetic:
|
|
@cadonna Would you like me to split this PR into several ones? One per file, for example? |
cadonna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlprat Thank you for the PR!
I did a pass over the first 5 files. I will continue in the next days.
Here my feedback up to now.
| <pre class="line-numbers"><code class="language-bash"><path-to-kafka>/bin/kafka-streams-application-reset</code></pre> | ||
| <p>The tool accepts the following parameters:</p> | ||
| <div class="highlight-bash"><div class="highlight"><pre><span>Option</span><code> <span class="o">(</span>* <span class="o">=</span> required<span class="o">)</span> Description | ||
| <pre class="line-numbers"><code class="language-bash">Option (* = required) Description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class language-bash renders the text with strange colors, e.g., the keyword "file" which is not a keyword here. Since this is actually not a bash script code, I think we leave it as plain monospaced text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and also aligned the spaces, so it fit's to the 2 column printing.
|
|
||
| // Java 8+ example, using lambda expressions | ||
| KTable<String, String> joined = left.join(right, | ||
| foreignKeyExtractor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please put foreignKeyExtractor on the previous line or indent it so that it is at the same column as right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
|
||
| // Java 8+ example, using lambda expressions | ||
| KTable<String, String> joined = left.join(right, | ||
| foreignKeyExtractor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please put foreignKeyExtractor on the previous line or indent it so that it is at the same column as right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| // A hopping time window with a size of 5 minutes and an advance interval of 1 minute. | ||
| // The window's name -- the string parameter -- is used to e.g. name the backing state store. | ||
| Duration windowSizeMs = Duration.ofMinutes(5); | ||
| Duration advanceMs = Duration.ofMinutes(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you fix the indentation here to Duration advanceMs = Duration.ofMinutes(1);?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
Thanks @cadonna, all good points. I'll address the feedback later |
cadonna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates, @jlprat !
I reviewed the files until and including security.html.
Here my feedback.
|
|
||
| <span class="kd">private</span> <span class="kt">static</span> <span class="n">org.rocksdb.Cache</span> <span class="n">cache</span> <span class="o">=</span> <span class="k">new</span> <span class="n">org</span><span class="o">.</span><span class="na">rocksdb</span><span class="o">.</span><span class="na">LRUCache</span><span class="o">(</span><span class="mi">TOTAL_OFF_HEAP_MEMORY</span><span class="o">,</span> <span class="n">-1</span><span class="o">,</span> <span class="n">false</span><span class="o">,</span> <span class="n">INDEX_FILTER_BLOCK_RATIO</span><span class="o">);</span><sup><a href="#fn1" id="ref1">1</a></sup> | ||
| <span class="kd">private</span> <span class="kt">static</span> <span class="n">org.rocksdb.WriteBufferManager</span> <span class="n">writeBufferManager</span> <span class="o">=</span> <span class="k">new</span> <span class="n">org</span><span class="o">.</span><span class="na">rocksdb</span><span class="o">.</span><span class="na">WriteBufferManager</span><span class="o">(</span><span class="mi">TOTAL_MEMTABLE_MEMORY</span><span class="o">,</span> cache<span class="o">);</span> | ||
| private static org.rocksdb.Cache cache = new org.rocksdb.LRUCache(TOTAL_OFF_HEAP_MEMORY, -1, false, INDEX_FILTER_BLOCK_RATIO);1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 1 at the end should be a superscript reference to a footnote. Is there a way to get again a superscript here? If not what would be the alternatives?
| <span class="n">options</span><span class="o">.</span><span class="na">setMaxWriteBufferNumber</span><span class="o">(</span><span class="mi">N_MEMTABLES</span><span class="o">);</span> | ||
| <span class="n">options</span><span class="o">.</span><span class="na">setWriteBufferSize</span><span class="o">(</span><span class="mi">MEMTABLE_SIZE</span><span class="o">);</span> | ||
| // These options are recommended to be set when bounding the total memory | ||
| tableConfig.setCacheIndexAndFilterBlocksWithHighPriority(true);2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above for the 2 at the end.
| // These options are recommended to be set when bounding the total memory | ||
| tableConfig.setCacheIndexAndFilterBlocksWithHighPriority(true);2 | ||
| tableConfig.setPinTopLevelIndexAndFilter(true); | ||
| tableConfig.setBlockSize(BLOCK_SIZE);3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above for the 3 at the end.
|
Thanks @cadonna that one slipped through. I modified the code and brought back the foot notes with the hyperlink. |
cadonna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlprat Hi again!
I reviewed all files!
I found two code snippets that slipped through.
The rest looks good!
| <p> | ||
| The mock will capture any values that your processor forwards. You can make assertions on them: | ||
| <pre class="line-numbers"><code class="language-text">processorUnderTest.process("key", "value"); | ||
| <pre class="line-numbers"><code class="language-java">processorUnderTest.process("key", "value"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 304 and line 306 are two code snippets that slipped through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
Hi @cadonna I'll fix that in a couple of hours, thanks for your thorough review! |
cadonna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jlprat !
LGTM!
|
Thanks for the review, I know it was long and tricky! |
…e-allocations-lz4 * apache-github/trunk: (43 commits) KAFKA-12800: Configure generator to fail on trailing JSON tokens (apache#10717) MINOR: clarify message ordering with max in-flight requests and idempotent producer (apache#10690) MINOR: Add log identifier/prefix printing in Log layer static functions (apache#10742) MINOR: update java doc for deprecated methods (apache#10722) MINOR: Fix deprecation warnings in SlidingWindowedCogroupedKStreamImplTest (apache#10703) KAFKA-12499: add transaction timeout verification (apache#10482) KAFKA-12620 Allocate producer ids on the controller (apache#10504) MINOR: Kafka Streams code samples formating unification (apache#10651) KAFKA-12808: Remove Deprecated Methods under StreamsMetrics (apache#10724) KAFKA-12522: Cast SMT should allow null value records to pass through (apache#10375) KAFKA-12820: Upgrade maven-artifact dependency to resolve CVE-2021-26291 HOTFIX: fix checkstyle issue in KAFKA-12697 KAFKA-12697: Add OfflinePartitionCount and PreferredReplicaImbalanceCount metrics to Quorum Controller (apache#10572) KAFKA-12342: Remove MetaLogShim and use RaftClient directly (apache#10705) KAFKA-12779: KIP-740, Clean up public API in TaskId and fix TaskMetadata#taskId() (apache#10735) KAFKA-12814: Remove Deprecated Method StreamsConfig getConsumerConfigs (apache#10737) MINOR: Eliminate redundant functions in LogTest suite (apache#10732) MINOR: Remove unused maxProducerIdExpirationMs parameter in Log constructor (apache#10723) MINOR: Updating files with release 2.7.1 (apache#10660) KAFKA-12809: Remove deprecated methods of Stores factory (apache#10729) ...
We have updated the memory-mgmt.html in kafka repo in this PR: apache/kafka#10651. So, this pr, just simply fix the missing pre closing tag issue.
Code samples are now correctly formatted.
Samples under Streams use consistently the prism library to be displayed.
Committer Checklist (excluded from commit message)