本文整理汇总了Golang中github.com/cockroachdb/cockroach/keys.MakeKey函数的典型用法代码示例。如果您正苦于以下问题:Golang MakeKey函数的具体用法?Golang MakeKey怎么用?Golang MakeKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeKey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestStoreRangeSplitBetweenConfigPrefix
// TestStoreRangeSplitBetweenConfigPrefix verifies a range can be split
// between ConfigPrefix and gossip them correctly.
func TestStoreRangeSplitBetweenConfigPrefix(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
key := keys.MakeKey(keys.SystemPrefix, []byte("tsd"))
args := adminSplitArgs(proto.KeyMin, key, 1, store.StoreID())
_, err := store.ExecuteCmd(context.Background(), &args)
if err != nil {
t.Fatalf("%q: split unexpected error: %s", key, err)
}
// Update configs to trigger gossip in both of the ranges.
acctConfig := &config.AcctConfig{}
key = keys.MakeKey(keys.ConfigAccountingPrefix, proto.KeyMin)
if err = store.DB().Put(key, acctConfig); err != nil {
t.Fatal(err)
}
zoneConfig := &config.ZoneConfig{}
key = keys.MakeKey(keys.ConfigZonePrefix, proto.KeyMin)
if err = store.DB().Put(key, zoneConfig); err != nil {
t.Fatal(err)
}
}
开发者ID:knorwood,项目名称:cockroach,代码行数:27,代码来源:client_split_test.go
示例2: newRangeDataIterator
func newRangeDataIterator(d *proto.RangeDescriptor, e engine.Engine) *rangeDataIterator {
// The first range in the keyspace starts at KeyMin, which includes the node-local
// space. We need the original StartKey to find the range metadata, but the
// actual data starts at LocalMax.
dataStartKey := d.StartKey
if d.StartKey.Equal(proto.KeyMin) {
dataStartKey = keys.LocalMax
}
ri := &rangeDataIterator{
ranges: []keyRange{
{
start: engine.MVCCEncodeKey(keys.MakeKey(keys.LocalRangeIDPrefix, encoding.EncodeUvarint(nil, uint64(d.RangeID)))),
end: engine.MVCCEncodeKey(keys.MakeKey(keys.LocalRangeIDPrefix, encoding.EncodeUvarint(nil, uint64(d.RangeID+1)))),
},
{
start: engine.MVCCEncodeKey(keys.MakeKey(keys.LocalRangePrefix, encoding.EncodeBytes(nil, d.StartKey))),
end: engine.MVCCEncodeKey(keys.MakeKey(keys.LocalRangePrefix, encoding.EncodeBytes(nil, d.EndKey))),
},
{
start: engine.MVCCEncodeKey(dataStartKey),
end: engine.MVCCEncodeKey(d.EndKey),
},
},
iter: e.NewIterator(),
}
ri.iter.Seek(ri.ranges[ri.curIndex].start)
ri.advance()
return ri
}
开发者ID:ErikGrimes,项目名称:cockroach,代码行数:29,代码来源:range_data_iter.go
示例3: TestRangeLookupWithOpenTransaction
// TestRangeLookupWithOpenTransaction verifies that range lookups are
// done in such a way (e.g. using inconsistent reads) that they
// proceed in the event that a write intent is extant at the meta
// index record being read.
func TestRangeLookupWithOpenTransaction(t *testing.T) {
defer leaktest.AfterTest(t)
s := server.StartTestServer(t)
defer s.Stop()
db := createTestClient(t, s.Stopper(), s.ServingAddr())
// Create an intent on the meta1 record by writing directly to the
// engine.
key := keys.MakeKey(keys.Meta1Prefix, roachpb.KeyMax)
now := s.Clock().Now()
txn := roachpb.NewTransaction("txn", roachpb.Key("foobar"), 0, roachpb.SERIALIZABLE, now, 0)
if err := engine.MVCCPutProto(s.Ctx.Engines[0], nil, key, now, txn, &roachpb.RangeDescriptor{}); err != nil {
t.Fatal(err)
}
// Now, with an intent pending, attempt (asynchronously) to read
// from an arbitrary key. This will cause the distributed sender to
// do a range lookup, which will encounter the intent. We're
// verifying here that the range lookup doesn't fail with a write
// intent error. If it did, it would go into a deadloop attempting
// to push the transaction, which in turn requires another range
// lookup, etc, ad nauseam.
if _, err := db.Get("a"); err != nil {
t.Fatal(err)
}
}
开发者ID:guowenfei-mathsfan,项目名称:cockroach,代码行数:30,代码来源:dist_sender_server_test.go
示例4: getConfig
// getConfig retrieves the configuration for the specified key. If the
// key is empty, all configurations are returned. Otherwise, the
// leading "/" path delimiter is stripped and the configuration
// matching the remainder is retrieved. Note that this will retrieve
// the default config if "key" is equal to "/", and will list all
// configs if "key" is equal to "". The body result contains a listing
// of keys and retrieval of a config. The output format is determined
// by the request header.
func getConfig(db *client.DB, configPrefix proto.Key, config gogoproto.Message,
path string, r *http.Request) (body []byte, contentType string, err error) {
// Scan all configs if the key is empty.
if len(path) == 0 {
var rows []client.KeyValue
if rows, err = db.Scan(configPrefix, configPrefix.PrefixEnd(), maxGetResults); err != nil {
return
}
if len(rows) == maxGetResults {
log.Warningf("retrieved maximum number of results (%d); some may be missing", maxGetResults)
}
var prefixes []string
for _, row := range rows {
trimmed := bytes.TrimPrefix(row.Key, configPrefix)
prefixes = append(prefixes, url.QueryEscape(string(trimmed)))
}
// Encode the response.
body, contentType, err = util.MarshalResponse(r, prefixes, util.AllEncodings)
} else {
configkey := keys.MakeKey(configPrefix, proto.Key(path[1:]))
if err = db.GetProto(configkey, config); err != nil {
return
}
body, contentType, err = util.MarshalResponse(r, config, util.AllEncodings)
}
return
}
开发者ID:Hellblazer,项目名称:cockroach,代码行数:36,代码来源:config.go
示例5: newTestDescriptorDB
func newTestDescriptorDB() *testDescriptorDB {
db := &testDescriptorDB{}
db.data.Insert(testDescriptorNode{
&proto.RangeDescriptor{
StartKey: keys.MakeKey(keys.Meta2Prefix, proto.KeyMin),
EndKey: keys.MakeKey(keys.Meta2Prefix, proto.KeyMax),
},
})
db.data.Insert(testDescriptorNode{
&proto.RangeDescriptor{
StartKey: proto.KeyMin,
EndKey: proto.KeyMax,
},
})
return db
}
开发者ID:nkhuyu,项目名称:cockroach,代码行数:16,代码来源:range_cache_test.go
示例6: TestObjectIDForKey
func TestObjectIDForKey(t *testing.T) {
defer leaktest.AfterTest(t)
testCases := []struct {
key roachpb.RKey
success bool
id uint32
}{
// Before the structured span.
{roachpb.RKeyMin, false, 0},
// Boundaries of structured span.
{roachpb.RKeyMax, false, 0},
// Valid, even if there are things after the ID.
{keys.MakeKey(keys.MakeTablePrefix(42), roachpb.RKey("\xff")), true, 42},
{keys.MakeTablePrefix(0), true, 0},
{keys.MakeTablePrefix(999), true, 999},
}
for tcNum, tc := range testCases {
id, success := config.ObjectIDForKey(tc.key)
if success != tc.success {
t.Errorf("#%d: expected success=%t", tcNum, tc.success)
continue
}
if id != tc.id {
t.Errorf("#%d: expected id=%d, got %d", tcNum, tc.id, id)
}
}
}
开发者ID:billhongs,项目名称:cockroach,代码行数:31,代码来源:config_test.go
示例7: getPermConfig
// getPermConfig fetches the permissions config for 'prefix'.
func getPermConfig(db *client.DB, prefix string) (*config.PermConfig, error) {
config := &config.PermConfig{}
if err := db.GetProto(keys.MakeKey(keys.ConfigPermissionPrefix, proto.Key(prefix)), config); err != nil {
return nil, err
}
return config, nil
}
开发者ID:nkhuyu,项目名称:cockroach,代码行数:9,代码来源:util.go
示例8: TestStoreRangeSplitOnConfigs
// TestStoreRangeSplitOnConfigs verifies that config changes to both
// accounting and zone configs cause ranges to be split along prefix
// boundaries.
func TestStoreRangeSplitOnConfigs(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
acctConfig := &config.AcctConfig{}
zoneConfig := &config.ZoneConfig{}
// Write zone configs for db3 & db4.
b := &client.Batch{}
for _, k := range []string{"db4", "db3"} {
b.Put(keys.MakeKey(keys.ConfigZonePrefix, proto.Key(k)), zoneConfig)
}
// Write accounting configs for db1 & db2.
for _, k := range []string{"db2", "db1"} {
b.Put(keys.MakeKey(keys.ConfigAccountingPrefix, proto.Key(k)), acctConfig)
}
if err := store.DB().Run(b); err != nil {
t.Fatal(err)
}
log.Infof("wrote updated configs")
// Check that we split into expected ranges in allotted time.
expKeys := []proto.Key{
proto.Key("\x00\x00meta2db1"),
proto.Key("\x00\x00meta2db2"),
proto.Key("\x00\x00meta2db3"),
proto.Key("\x00\x00meta2db4"),
proto.Key("\x00\x00meta2db5"),
keys.MakeKey(proto.Key("\x00\x00meta2"), proto.KeyMax),
}
if err := util.IsTrueWithin(func() bool {
rows, err := store.DB().Scan(keys.Meta2Prefix, keys.MetaMax, 0)
if err != nil {
t.Fatalf("failed to scan meta2 keys: %s", err)
}
var keys []proto.Key
for _, r := range rows {
keys = append(keys, r.Key)
}
return reflect.DeepEqual(keys, expKeys)
}, 500*time.Millisecond); err != nil {
t.Errorf("expected splits not found: %s", err)
}
}
开发者ID:knorwood,项目名称:cockroach,代码行数:48,代码来源:client_split_test.go
示例9: TestRangeSplitsWithWritePressure
// TestRangeSplitsWithWritePressure sets the zone config max bytes for
// a range to 256K and writes data until there are five ranges.
func TestRangeSplitsWithWritePressure(t *testing.T) {
defer leaktest.AfterTest(t)
s := createTestDB(t)
defer s.Stop()
setTestRetryOptions()
// Rewrite a zone config with low max bytes.
zoneConfig := &proto.ZoneConfig{
ReplicaAttrs: []proto.Attributes{
{},
{},
{},
},
RangeMinBytes: 1 << 8,
RangeMaxBytes: 1 << 18,
}
if err := s.DB.Put(keys.MakeKey(keys.ConfigZonePrefix, proto.KeyMin), zoneConfig); err != nil {
t.Fatal(err)
}
// Start test writer write about a 32K/key so there aren't too many writes necessary to split 64K range.
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(1)
go startTestWriter(s.DB, int64(0), 1<<15, &wg, nil, nil, done, t)
// Check that we split 5 times in allotted time.
if err := util.IsTrueWithin(func() bool {
// Scan the txn records.
rows, err := s.DB.Scan(keys.Meta2Prefix, keys.MetaMax, 0)
if err != nil {
t.Fatalf("failed to scan meta2 keys: %s", err)
}
return len(rows) >= 5
}, 6*time.Second); err != nil {
t.Errorf("failed to split 5 times: %s", err)
}
close(done)
wg.Wait()
// This write pressure test often causes splits while resolve
// intents are in flight, causing them to fail with range key
// mismatch errors. However, LocalSender should retry in these
// cases. Check here via MVCC scan that there are no dangling write
// intents. We do this using an IsTrueWithin construct to account
// for timing of finishing the test writer and a possibly-ongoing
// asynchronous split.
if err := util.IsTrueWithin(func() bool {
if _, _, err := engine.MVCCScan(s.Eng, keys.LocalMax, proto.KeyMax, 0, proto.MaxTimestamp, true, nil); err != nil {
log.Infof("mvcc scan should be clean: %s", err)
return false
}
return true
}, 500*time.Millisecond); err != nil {
t.Error("failed to verify no dangling intents within 500ms")
}
}
开发者ID:Hellblazer,项目名称:cockroach,代码行数:59,代码来源:split_test.go
示例10: TestStoreRangeSplitAtIllegalKeys
// TestStoreRangeSplitAtIllegalKeys verifies a range cannot be split
// at illegal keys.
func TestStoreRangeSplitAtIllegalKeys(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
for _, key := range []proto.Key{
keys.Meta1Prefix,
keys.MakeKey(keys.Meta1Prefix, []byte("a")),
keys.MakeKey(keys.Meta1Prefix, proto.KeyMax),
keys.MakeKey(keys.ConfigZonePrefix, []byte("a")),
} {
args := adminSplitArgs(proto.KeyMin, key, 1, store.StoreID())
_, err := store.ExecuteCmd(context.Background(), &args)
if err == nil {
t.Fatalf("%q: split succeeded unexpectedly", key)
}
}
}
开发者ID:DevendranGitHub,项目名称:cockroach,代码行数:20,代码来源:client_split_test.go
示例11: deleteConfig
// deleteConfig removes the config specified by key.
func deleteConfig(db *client.DB, configPrefix proto.Key, path string, r *http.Request) error {
if len(path) == 0 {
return util.Errorf("no path specified for config Delete")
}
if path == "/" {
return util.Errorf("the default configuration cannot be deleted")
}
configKey := keys.MakeKey(configPrefix, proto.Key(path[1:]))
return db.Del(configKey)
}
开发者ID:Hellblazer,项目名称:cockroach,代码行数:11,代码来源:config.go
示例12: rangeLookup
func (mdb mockRangeDescriptorDB) rangeLookup(key roachpb.RKey, options lookupOptions, _ *roachpb.RangeDescriptor) ([]roachpb.RangeDescriptor, error) {
if bytes.HasPrefix(key, keys.Meta2Prefix) {
return mdb(key[len(keys.Meta1Prefix):], options)
}
if bytes.HasPrefix(key, keys.Meta1Prefix) {
return mdb(keys.MakeKey(keys.Meta2Prefix, key[len(keys.Meta1Prefix):]), options)
}
// First range.
return mdb(nil, options)
}
开发者ID:rissoa,项目名称:cockroach,代码行数:10,代码来源:dist_sender_test.go
示例13: RangeLookup
func (mdb mockRangeDescriptorDB) RangeLookup(key roachpb.RKey, _ *roachpb.RangeDescriptor, considerIntents, useReverseScan bool) ([]roachpb.RangeDescriptor, *roachpb.Error) {
if bytes.HasPrefix(key, keys.Meta2Prefix) {
return mdb(key[len(keys.Meta1Prefix):], considerIntents, useReverseScan)
}
if bytes.HasPrefix(key, keys.Meta1Prefix) {
return mdb(keys.MakeKey(keys.Meta2Prefix, key[len(keys.Meta1Prefix):]), considerIntents, useReverseScan)
}
// First range.
return mdb(nil, considerIntents, useReverseScan)
}
开发者ID:welfeng2016,项目名称:cockroach,代码行数:10,代码来源:dist_sender_test.go
示例14: WritePermissionConfig
// WritePermissionConfig writes the passed-in 'cfg' permissions config
// for the 'path' key prefix.
func (ts *TestServer) WritePermissionConfig(path string, cfg *proto.PermConfig) error {
// The testserver is running as "node". However, things like config changes are generally
// done as root.
db, err := client.Open(ts.Ctx.RequestScheme() + "://[email protected]" + ts.ServingAddr() + "?certs=test_certs")
if err != nil {
return err
}
key := keys.MakeKey(keys.ConfigPermissionPrefix, proto.Key(path))
return db.Put(key, cfg)
}
开发者ID:XisiHuang,项目名称:cockroach,代码行数:12,代码来源:testserver.go
示例15: TestStoreRangeSplitAtIllegalKeys
// TestStoreRangeSplitAtIllegalKeys verifies a range cannot be split
// at illegal keys.
func TestStoreRangeSplitAtIllegalKeys(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
for _, key := range []roachpb.Key{
keys.Meta1Prefix,
keys.MakeKey(keys.Meta1Prefix, []byte("a")),
keys.MakeKey(keys.Meta1Prefix, roachpb.RKeyMax),
keys.Meta2KeyMax,
keys.MakeTablePrefix(10 /* system descriptor ID */),
} {
args := adminSplitArgs(roachpb.KeyMin, key)
_, err := client.SendWrapped(rg1(store), nil, &args)
if err == nil {
t.Fatalf("%q: split succeeded unexpectedly", key)
}
}
}
开发者ID:kaustubhkurve,项目名称:cockroach,代码行数:21,代码来源:client_split_test.go
示例16: rangeAddressing
// rangeAddressing updates or deletes the range addressing metadata
// for the range specified by desc. The action to take is specified by
// the supplied metaAction function.
//
// The rules for meta1 and meta2 records are as follows:
//
// 1. If desc.StartKey or desc.EndKey is meta1:
// - ERROR
// 2. If desc.EndKey is meta2:
// - meta1(desc.EndKey)
// 3. If desc.EndKey is normal user key:
// - meta2(desc.EndKey)
// 3a. If desc.StartKey is KeyMin or meta2:
// - meta1(KeyMax)
func rangeAddressing(b *client.Batch, desc *proto.RangeDescriptor, action metaAction) error {
// 1. handle illegal case of start or end key being meta1.
if bytes.HasPrefix(desc.EndKey, keys.Meta1Prefix) ||
bytes.HasPrefix(desc.StartKey, keys.Meta1Prefix) {
return util.Errorf("meta1 addressing records cannot be split: %+v", desc)
}
// 2. the case of the range ending with a meta2 prefix. This means
// the range is full of meta2. We must update the relevant meta1
// entry pointing to the end of this range.
if bytes.HasPrefix(desc.EndKey, keys.Meta2Prefix) {
action(b, keys.RangeMetaKey(desc.EndKey), desc)
} else {
// 3. the range ends with a normal user key, so we must update the
// relevant meta2 entry pointing to the end of this range.
action(b, keys.MakeKey(keys.Meta2Prefix, desc.EndKey), desc)
// 3a. the range starts with KeyMin or a meta2 addressing record,
// update the meta1 entry for KeyMax.
if bytes.Equal(desc.StartKey, proto.KeyMin) ||
bytes.HasPrefix(desc.StartKey, keys.Meta2Prefix) {
action(b, keys.MakeKey(keys.Meta1Prefix, proto.KeyMax), desc)
}
}
return nil
}
开发者ID:kumarh1982,项目名称:cockroach,代码行数:38,代码来源:addressing.go
示例17: putConfig
// putConfig writes a config for the specified key prefix (which is
// treated as a key). The config is parsed from the input "body". The
// config is stored proto-encoded. The specified body must validly
// parse into a config struct and must pass a given validation check (if
// validate is not nil).
func putConfig(db *client.DB, configPrefix proto.Key, config gogoproto.Message,
path string, body []byte, r *http.Request,
validate func(gogoproto.Message) error) error {
if len(path) == 0 {
return util.Errorf("no path specified for Put")
}
if err := util.UnmarshalRequest(r, body, config, util.AllEncodings); err != nil {
return util.Errorf("config has invalid format: %+v: %s", config, err)
}
if validate != nil {
if err := validate(config); err != nil {
return err
}
}
key := keys.MakeKey(configPrefix, proto.Key(path[1:]))
return db.Put(key, config)
}
开发者ID:Hellblazer,项目名称:cockroach,代码行数:22,代码来源:config.go
示例18: TestStoreRangeSplitBetweenConfigPrefix
// TestStoreRangeSplitBetweenConfigPrefix verifies a range can be split
// between ConfigPrefix and gossip them correctly.
func TestStoreRangeSplitBetweenConfigPrefix(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
key := keys.MakeKey(keys.SystemPrefix, []byte("tsd"))
args, reply := adminSplitArgs(proto.KeyMin, key, 1, store.StoreID())
err := store.ExecuteCmd(context.Background(), proto.Call{Args: args, Reply: reply})
if err != nil {
t.Fatalf("%q: split unexpected error: %s", key, err)
}
if err := store.MaybeGossipConfigs(); err != nil {
t.Fatalf("error gossiping configs: %s", err)
}
}
开发者ID:greener98103,项目名称:cockroach,代码行数:19,代码来源:client_split_test.go
示例19: TestStoreSetRangesMaxBytes
// TestStoreSetRangesMaxBytes creates a set of ranges via splitting
// and then sets the config zone to a custom max bytes value to
// verify the ranges' max bytes are updated appropriately.
func TestStoreSetRangesMaxBytes(t *testing.T) {
defer leaktest.AfterTest(t)
store, _, stopper := createTestStore(t)
defer stopper.Stop()
testData := []struct {
rng *Range
expMaxBytes int64
}{
{store.LookupRange(proto.KeyMin, nil), 64 << 20},
{splitTestRange(store, proto.KeyMin, proto.Key("a"), t), 1 << 20},
{splitTestRange(store, proto.Key("a"), proto.Key("aa"), t), 1 << 20},
{splitTestRange(store, proto.Key("aa"), proto.Key("b"), t), 64 << 20},
}
// Now set a new zone config for the prefix "a" with a different max bytes.
zoneConfig := &proto.ZoneConfig{
ReplicaAttrs: []proto.Attributes{{}, {}, {}},
RangeMinBytes: 1 << 8,
RangeMaxBytes: 1 << 20,
}
data, err := gogoproto.Marshal(zoneConfig)
if err != nil {
t.Fatal(err)
}
key := keys.MakeKey(keys.ConfigZonePrefix, proto.Key("a"))
pArgs := putArgs(key, data, 1, store.StoreID())
pArgs.Timestamp = store.ctx.Clock.Now()
if err := store.ExecuteCmd(context.Background(), proto.Call{Args: &pArgs, Reply: pArgs.CreateReply()}); err != nil {
t.Fatal(err)
}
if err := util.IsTrueWithin(func() bool {
for _, test := range testData {
if test.rng.GetMaxBytes() != test.expMaxBytes {
return false
}
}
return true
}, 500*time.Millisecond); err != nil {
t.Errorf("range max bytes values did not change as expected: %s", err)
}
}
开发者ID:backend2use,项目名称:cockroachdb,代码行数:46,代码来源:store_test.go
示例20: TestStoreZoneUpdateAndRangeSplit
// TestStoreZoneUpdateAndRangeSplit verifies that modifying the zone
// configuration changes range max bytes and Range.maybeSplit() takes
// max bytes into account when deciding whether to enqueue a range for
// splitting. It further verifies that the range is in fact split on
// exceeding zone's RangeMaxBytes.
func TestStoreZoneUpdateAndRangeSplit(t *testing.T) {
defer leaktest.AfterTest(t)
store, stopper := createTestStore(t)
defer stopper.Stop()
maxBytes := int64(1 << 16)
rng := store.LookupReplica(proto.KeyMin, nil)
fillRange(store, rng.Desc().RangeID, proto.Key("test"), maxBytes, t)
// Rewrite zone config with range max bytes set to 64K.
// This will cause the split queue to split the range in the background.
// This must happen after fillRange() because that function is not using
// a full-fledged client and cannot handle running concurrently with splits.
zoneConfig := &config.ZoneConfig{
ReplicaAttrs: []proto.Attributes{
{},
{},
{},
},
RangeMinBytes: 1 << 8,
RangeMaxBytes: maxBytes,
}
key := keys.MakeKey(keys.ConfigZonePrefix, proto.KeyMin)
if err := store.DB().Put(key, zoneConfig); err != nil {
t.Fatal(err)
}
// See if the range's max bytes is modified via gossip callback within 50ms.
if err := util.IsTrueWithin(func() bool {
return rng.GetMaxBytes() == zoneConfig.RangeMaxBytes
}, 50*time.Millisecond); err != nil {
t.Fatalf("failed to notice range max bytes update: %s", err)
}
// Verify that the range is in fact split (give it a second for very slow test machines).
if err := util.IsTrueWithin(func() bool {
newRng := store.LookupReplica(proto.Key("\xff\x00"), nil)
return newRng != rng
}, time.Second); err != nil {
t.Errorf("expected range to split within 1s")
}
}
开发者ID:knorwood,项目名称:cockroach,代码行数:47,代码来源:client_split_test.go
注:本文中的github.com/cockroachdb/cockroach/keys.MakeKey函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论