-
Notifications
You must be signed in to change notification settings - Fork 458
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
Add read/write of tags to fileset to restore tags, add fs index bootstrapping #590
Changes from 7 commits
886793d
cf54469
9014e99
48afa23
9a70a80
2aa6ded
fe8c764
8095ab5
b06255b
ccc6305
dfc2e01
436bf26
63d92ff
c580dbe
78658f5
8aadf85
64bf392
29e5247
b219f44
37d4f77
6170c63
be3a1fd
1a8f1f9
22b5680
da4bcb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
// Copyright (c) 2018 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package clone | ||
|
||
import ( | ||
|
@@ -87,14 +107,32 @@ func TestCloner(t *testing.T) { | |
} | ||
require.NoError(t, r2.Open(r2OpenOpts)) | ||
for { | ||
t1, b1, c1, e1 := r1.Read() | ||
t2, b2, c2, e2 := r2.Read() | ||
t1, a1, b1, c1, e1 := r1.Read() | ||
t2, a2, b2, c2, e2 := r2.Read() | ||
if e1 == e2 && e1 == io.EOF { | ||
break | ||
} | ||
|
||
require.NoError(t, e1) | ||
require.NoError(t, e2) | ||
|
||
b1.IncRef() | ||
b2.IncRef() | ||
require.Equal(t, t1.String(), t2.String()) | ||
require.Equal(t, a1.Remaining(), a2.Remaining()) | ||
numTags, numTagsMatched := a1.Remaining(), 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's a matcher for tag iters, so can make this a little shorter if you'd like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah nice, will update - gracias. |
||
for a1.Next() && a2.Next() { | ||
tag0 := a1.Current() | ||
tag1 := a2.Current() | ||
require.Equal(t, tag0.Name.String(), tag1.Name.String()) | ||
require.Equal(t, tag0.Value.String(), tag1.Value.String()) | ||
numTagsMatched++ | ||
} | ||
require.NoError(t, a1.Err()) | ||
require.NoError(t, a2.Err()) | ||
a1.Close() | ||
a2.Close() | ||
require.Equal(t, numTags, numTagsMatched) | ||
require.Equal(t, b1.Bytes(), b2.Bytes()) | ||
require.Equal(t, c1, c2) | ||
b1.DecRef() | ||
|
@@ -121,8 +159,15 @@ func writeTestData(t *testing.T, bs time.Duration, src FileSetID, opts Options) | |
} | ||
require.NoError(t, w.Open(writerOpts)) | ||
for i := 0; i < numTestSeries; i++ { | ||
id := ident.StringID(fmt.Sprintf("testSeries.%d", i)) | ||
require.NoError(t, w.Write(id, testBytes, 1234)) | ||
id := ident.StringID(fmt.Sprintf("test-series.%d", i)) | ||
var tags ident.Tags | ||
if i%2 == 0 { | ||
tags = ident.Tags{ | ||
ident.StringTag("foo", "bar"), | ||
ident.StringTag("qux", "qaz"), | ||
} | ||
} | ||
require.NoError(t, w.Write(id, tags, testBytes, 1234)) | ||
} | ||
require.NoError(t, w.Close()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
// Copyright (c) 2018 Uber Technologies, Inc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note to future self: m3db/ci-scripts#12 ++ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, aye, all good. |
||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package clone | ||
|
||
import ( | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
this snippet seems to be repeated multiple times in the diff. mind pulling into a common place?
m3x/ident/testutil
maybe?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.
Sure thing.