mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 07:11:02 +00:00
one copy of shard map during a reload
This commit is contained in:
parent
8ff6e8e0fd
commit
c5e46e4618
1 changed files with 9 additions and 2 deletions
11
dbshard.go
11
dbshard.go
|
|
@ -266,6 +266,8 @@ func (ss *shardSet) CloneMaybe() map[uint64]bool {
|
|||
return ss.readonly
|
||||
}
|
||||
|
||||
//vv("888888 CloneMaybe updating to version %v with %v shards", ss.shardsVer, len(ss.shards))
|
||||
|
||||
// readonlyVer is out of date.
|
||||
// readonly needs update. We cannot
|
||||
// modify the readonly map in place;
|
||||
|
|
@ -515,10 +517,15 @@ func (per *DBPerShard) updateIndex2ShardCacheWithNewShard(dbs *DBShard) {
|
|||
if !ok {
|
||||
shardset = newShardSet()
|
||||
mapIndex2shardSet[dbs.Index] = shardset
|
||||
//vv("888888 made new shardset for shard dbs.Shard=%v", dbs.Shard)
|
||||
}
|
||||
// INVAR: shardset is present, not nil; a map that can be added to.
|
||||
shardset.shards[dbs.Shard] = true
|
||||
shardset.shardsVer++ // invalid the readonly copy, force cloning it anew.
|
||||
_, already := shardset.shards[dbs.Shard]
|
||||
if !already {
|
||||
shardset.shards[dbs.Shard] = true
|
||||
shardset.shardsVer++ // invalid the readonly copy, force cloning it anew.
|
||||
//vv("888888 updated to shardset version %v with %v shards", shardset.shardsVer, len(shardset.shards))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue