Skip to content
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

Support overflow_action in v14 api #943

Merged
merged 6 commits into from
May 17, 2016

Conversation

tagomoris
Copy link
Member

@tagomoris tagomoris commented May 9, 2016

I found that implementing buffer_queue_full_action in v0.14 requires change of internal API of Buffer.
This pull-request does:

  • merge Buffer#emit and Buffer#emit_bulk to Buffer#write
  • fix Buffer#write to get a set of metadata and its data (as a hash) to control commit/rollback as a transaction

This change is based on #912

@tagomoris tagomoris added the v0.14 label May 9, 2016
@tagomoris tagomoris force-pushed the support-overflow-action-in-v14-api branch from 5b23cc0 to d3154f1 Compare May 12, 2016 08:46
@tagomoris tagomoris changed the title [WIP] Support overflow action in v14 api Support overflow_action in v14 api May 12, 2016
@tagomoris
Copy link
Member Author

This fix changes more code than expected: details are in commit comment here:
c3489d7

@tagomoris tagomoris force-pushed the support-overflow-action-in-v14-api branch from 24cd94c to 9d7ae8c Compare May 13, 2016 10:32
* without this fix, some events will be written paritally if any chunks raise error in #append/#concat
* it makes duplicated events

Buffer#write will do: (method name was changed: #emit is method names for event routers)
* this method receives pairs of metadata and data to be written at once
* append/concat these data to chunks (not committed)
* commit first chunk
  * if succeeded, then commit all (even if any following chunk raises error)
  * if failed, rollback all

In memory/file buffer, #commit is very lightweight operation and will NOT fail in most cases.

This change requires some additional internal APIs for buffers/chunks
* chunk status in general: this is required to make #write thread safe
* keyword argument of #write: bulk and enqueue
  * #write method becomes much more complex, so bulk operation should be merged into an implementation
    (we can't maintain two different/similar methods)
  * #write method enqueues chunks if needed, so :immediate mode should be implemented in same level
* chunk_full_threshold configuration parameter to control "chunk_size_full?"
  * bulk and non-bulk #write were merged
  * In non-bulk mode, it's too rare that written chunk content bytesize is same with limitation
@tagomoris tagomoris force-pushed the support-overflow-action-in-v14-api branch from 9d7ae8c to 6de12b0 Compare May 17, 2016 05:23
@tagomoris
Copy link
Member Author

I confirmed that CI is green now.

@tagomoris tagomoris merged commit 657954f into master May 17, 2016
@tagomoris tagomoris deleted the support-overflow-action-in-v14-api branch May 17, 2016 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant