-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove @metadata_list
from buffer.rb
#2563
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bbdbb4c
Remove `@metadata_list`
ganmacs 0d90aba
re-support add_timekey and del_timekey
ganmacs 2421e47
Remove metadata_list public method
ganmacs 5c81b40
Get a lock in #del_timekey. this is duplicated.
ganmacs 53a1e76
call Metadata.new directly
ganmacs 829b3aa
this module initialize will be never called
ganmacs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,6 @@ def create_chunk_es(metadata, es) | |
assert_equal([], plugin.queue) | ||
assert_equal({}, plugin.dequeued) | ||
assert_equal({}, plugin.queued_num) | ||
assert_equal([], plugin.metadata_list) | ||
|
||
assert_equal 0, plugin.stage_size | ||
assert_equal 0, plugin.queue_size | ||
|
@@ -207,7 +206,6 @@ def create_chunk_es(metadata, es) | |
assert_equal 203, @p.queue_size | ||
|
||
# staged, queued | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
assert_equal 1, @p.queued_num[@dm0] | ||
assert_equal 2, @p.queued_num[@dm1] | ||
end | ||
|
@@ -240,46 +238,11 @@ def create_chunk_es(metadata, es) | |
assert_nil @p.queue | ||
assert_nil @p.dequeued | ||
assert_nil @p.queued_num | ||
assert_nil @p.instance_eval{ @metadata_list } # #metadata_list does #dup for @metadata_list | ||
assert_equal 0, @p.stage_size | ||
assert_equal 0, @p.queue_size | ||
assert_equal [], @p.timekeys | ||
end | ||
|
||
test '#metadata_list returns list of metadata on stage or in queue' do | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
end | ||
|
||
test '#new_metadata creates metadata instance without inserting metadata_list' do | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
_m = @p.new_metadata(timekey: Time.parse('2016-04-11 16:40:00 +0000').to_i) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
end | ||
|
||
test '#add_metadata adds unknown metadata into list, or return known metadata if already exists' do | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
|
||
m = @p.new_metadata(timekey: Time.parse('2016-04-11 16:40:00 +0000').to_i) | ||
_mx = @p.add_metadata(m) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1,m], @p.metadata_list | ||
assert_equal m.object_id, m.object_id | ||
|
||
my = @p.add_metadata(@dm1) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1,m], @p.metadata_list | ||
assert_equal @dm1, my | ||
assert{ @dm1.object_id != my.object_id } # 'my' is an object created in #resume | ||
end | ||
|
||
test '#metadata is utility method to create-add-and-return metadata' do | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
|
||
m1 = @p.metadata(timekey: Time.parse('2016-04-11 16:40:00 +0000').to_i) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1,m1], @p.metadata_list | ||
m2 = @p.metadata(timekey: @dm3.timekey) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1,m1], @p.metadata_list | ||
assert_equal @dm3, m2 | ||
end | ||
|
||
test '#queued_records returns total number of size in all chunks in queue' do | ||
assert_equal 3, @p.queue.size | ||
|
||
|
@@ -430,7 +393,6 @@ def create_chunk_es(metadata, es) | |
test '#purge_chunk removes a chunk specified by argument id from dequeued chunks' do | ||
assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
|
||
m0 = @p.dequeue_chunk | ||
m1 = @p.dequeue_chunk | ||
|
@@ -447,13 +409,11 @@ def create_chunk_es(metadata, es) | |
|
||
assert_equal [@dm0,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
end | ||
|
||
test '#purge_chunk removes an argument metadata from metadata_list if no chunks exist on stage or in queue' do | ||
test '#purge_chunk removes an argument metadata if no chunks exist on stage or in queue' do | ||
assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
|
||
m0 = @p.dequeue_chunk | ||
|
||
|
@@ -467,13 +427,11 @@ def create_chunk_es(metadata, es) | |
|
||
assert_equal [@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm1], @p.metadata_list | ||
end | ||
|
||
test '#takeback_chunk returns false if specified chunk_id is already purged' do | ||
assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm0,@dm1], @p.metadata_list | ||
|
||
m0 = @p.dequeue_chunk | ||
|
||
|
@@ -487,13 +445,11 @@ def create_chunk_es(metadata, es) | |
|
||
assert_equal [@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm1], @p.metadata_list | ||
|
||
assert [email protected]_chunk(m0.unique_id) | ||
|
||
assert_equal [@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal({}, @p.dequeued) | ||
assert_equal [@dm2,@dm3,@dm1], @p.metadata_list | ||
end | ||
|
||
test '#clear_queue! removes all chunks in queue, but leaves staged chunks' do | ||
|
@@ -575,7 +531,7 @@ def create_chunk_es(metadata, es) | |
assert [email protected]?(timekey) | ||
|
||
prev_stage_size = @p.stage_size | ||
|
||
m = @p.metadata(timekey: timekey) | ||
|
||
@p.write({m => ["x" * 256, "y" * 256, "z" * 256]}) | ||
|
@@ -695,7 +651,7 @@ def create_chunk_es(metadata, es) | |
|
||
assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal [@dm2,@dm3], @p.stage.keys | ||
|
||
timekey = Time.parse('2016-04-11 16:40:00 +0000').to_i | ||
assert [email protected]?(timekey) | ||
|
||
|
@@ -718,7 +674,7 @@ def create_chunk_es(metadata, es) | |
assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata) | ||
assert_equal [@dm2,@dm3,m], @p.stage.keys | ||
assert_equal 1, @p.stage[m].append_count | ||
|
||
assert @p.timekeys.include?(timekey) | ||
end | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@mutex.synchronize
is called indel_timekey
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.
I forgot about it! thanks.
.5c81b40