Skip to content

Implement support for insertion into Kafka tables#6012

Merged
abyss7 merged 20 commits intoClickHouse:masterfrom
abyss7:issue-5834
Aug 20, 2019
Merged

Implement support for insertion into Kafka tables#6012
abyss7 merged 20 commits intoClickHouse:masterfrom
abyss7:issue-5834

Conversation

@abyss7
Copy link
Copy Markdown
Contributor

@abyss7 abyss7 commented Jul 15, 2019

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

For changelog. Remove if this is non-significant change.

Category (leave one):

  • New Feature

Short description (up to few sentences):
Implement support for INSERT-query with Kafka tables

@abyss7 abyss7 added the pr-feature Pull request with new product feature label Jul 15, 2019
@abyss7 abyss7 self-assigned this Jul 15, 2019
@abyss7 abyss7 requested a review from KochetovNicolai August 9, 2019 17:42
@abyss7 abyss7 marked this pull request as ready for review August 9, 2019 17:42
@abyss7
Copy link
Copy Markdown
Contributor Author

abyss7 commented Aug 9, 2019

Should implement #5834

@KochetovNicolai
Copy link
Copy Markdown
Member

Part with output formats seems ok.
Probably, it is worth to add general settings class RowOutputFormatParams the same as RowInputFormatParams. Then next time you won't need to change every constructor in order to add new setting.

@abyss7
Copy link
Copy Markdown
Contributor Author

abyss7 commented Aug 17, 2019

Probably, it is worth to add general settings class RowOutputFormatParams the same as RowInputFormatParams.

Don't see any reason to do it now - there is a single param.

Copy link
Copy Markdown
Member

@KochetovNicolai KochetovNicolai left a comment

Choose a reason for hiding this comment

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

Part with streams is fine.

@abyss7 abyss7 merged commit a502424 into ClickHouse:master Aug 20, 2019
@abyss7 abyss7 deleted the issue-5834 branch August 20, 2019 11:18
inline void next()
{
if (!offset())
if (!offset() && available())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@abyss7 can you elaborate this hunk?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suggest that I wanted to prevent miscalling next() if there is still available space in buffer - it's permissive, so no penalties for logical error in the code. But maybe there should be assert(!available()). Does this break anything?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this break anything?

I have't any example, but is this strictly correct?
AFAICS right now destructor tries to send the data, so after this change it will send only if the buffer is full, sounds icky

I came to this while working on #19451
And quite frankly to me sending some data from destructor looks not safe anyway, and the goal is to replace destructor final flush with assert that will ensure that there is no bytes pending in buffer.

Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov Jan 30, 2021

Choose a reason for hiding this comment

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

if (!offset() && available())
    return;

This is strange.

The following code means: if there is no data to write - ignore the next call:

if (!offset())
    return;

This is how it was and it is 100% correct.

But available() means - if the buffer is not filled up completely.
Adding this condition with "and" is bogus - because if the buffer size is greater than zero, and !offset() - at least one byte is available.

Even if you meant this:

if (!offset() || available())
    return;

it also does not make sense, because flushing half-filled buffer is completely legit and is used extensively.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay, let's try to revert this hunk - #19886, and see, maybe CI will find something interesting.

azat added a commit to azat/ClickHouse that referenced this pull request Feb 1, 2021
In ClickHouse#6012 the behavior of the WriteBuffer has been changed.

Before, WriteBuffer write the data when next() is called.
After, WriteBuffer will write the data if, and only if, the buffer is
full.

See the discussion here [1].

  [1]: ClickHouse#6012 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants