unexport availableShardFileFlushDuration

This commit is contained in:
Todd Gruben 2020-03-24 13:55:11 -05:00
parent 000ea90877
commit 6bd81b87eb
4 changed files with 14 additions and 14 deletions

View file

@ -80,7 +80,7 @@ func (p *protected) Get() time.Duration {
return p.duration
}
var AvailableShardFileFlushDuration = &protected{
var availableShardFileFlushDuration = &protected{
duration: 5 * time.Second,
}
@ -636,7 +636,7 @@ func nonBlockingWriteAvailableShards(fieldPath string, availableShardBytes []byt
func (f *Field) writeAvailableShards() {
defer f.wg.Done()
ticker := time.NewTicker(AvailableShardFileFlushDuration.Get())
ticker := time.NewTicker(availableShardFileFlushDuration.Get())
var data []byte
tracker := make(chan bool)
writing := false

View file

@ -351,7 +351,7 @@ func TestField_RowTime(t *testing.T) {
}
func TestField_PersistAvailableShards(t *testing.T) {
AvailableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
availableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
f := OpenField(t, OptFieldTypeDefault())
// bm represents remote available shards.
@ -360,7 +360,7 @@ func TestField_PersistAvailableShards(t *testing.T) {
if err := f.AddRemoteAvailableShards(bm); err != nil {
t.Fatal(err)
}
time.Sleep(2 * AvailableShardFileFlushDuration.Get())
time.Sleep(2 * availableShardFileFlushDuration.Get())
// Reload field and verify that shard data is persisted.
if err := f.Reopen(); err != nil {
@ -372,7 +372,7 @@ func TestField_PersistAvailableShards(t *testing.T) {
}
func TestField_CorruptAvailableShards(t *testing.T) {
AvailableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
availableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
f := OpenField(t, OptFieldTypeDefault())
// bm represents remote available shards.
@ -381,7 +381,7 @@ func TestField_CorruptAvailableShards(t *testing.T) {
if err := f.AddRemoteAvailableShards(bm); err != nil {
t.Fatal(err)
}
time.Sleep(2 * AvailableShardFileFlushDuration.Get())
time.Sleep(2 * availableShardFileFlushDuration.Get())
path := filepath.Join(f.path, ".available.shards")
@ -404,7 +404,7 @@ func TestField_CorruptAvailableShards(t *testing.T) {
}
func TestField_TruncatedAvailableShards(t *testing.T) {
AvailableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
availableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
f := OpenField(t, OptFieldTypeDefault())
// bm represents remote available shards.
@ -413,7 +413,7 @@ func TestField_TruncatedAvailableShards(t *testing.T) {
if err := f.AddRemoteAvailableShards(bm); err != nil {
t.Fatal(err)
}
time.Sleep(2 * AvailableShardFileFlushDuration.Get())
time.Sleep(2 * availableShardFileFlushDuration.Get())
path := filepath.Join(f.path, ".available.shards")
@ -434,7 +434,7 @@ func TestField_TruncatedAvailableShards(t *testing.T) {
// Ensure that persisting available shards having a smaller footprint (for example,
// when going from a bitmap to a smaller, RLE representation) succeeds.
func TestField_PersistAvailableShardsFootprint(t *testing.T) {
AvailableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
availableShardFileFlushDuration.Set(200 * time.Millisecond) //shorten the default time to force a file write
f := OpenField(t, OptFieldTypeDefault())
// bm represents remote available shards.
@ -449,7 +449,7 @@ func TestField_PersistAvailableShardsFootprint(t *testing.T) {
if err := f.AddRemoteAvailableShards(bm); err != nil {
t.Fatal(err)
}
time.Sleep(2 * AvailableShardFileFlushDuration.Get())
time.Sleep(2 * availableShardFileFlushDuration.Get())
// Reload field and verify that shard data is persisted.
if err := f.Reopen(); err != nil {

View file

@ -99,7 +99,7 @@ func TestHolder_Optn(t *testing.T) {
if os.Geteuid() == 0 {
t.Skip("Skipping permissions test since user is root.")
}
AvailableShardFileFlushDuration.Set(100 * time.Millisecond)
availableShardFileFlushDuration.Set(100 * time.Millisecond)
h := newHolder()
defer h.Close()
@ -184,7 +184,7 @@ func TestHolder_Optn(t *testing.T) {
// Ensure holder can clean up orphaned fragments.
func TestHolderCleaner_CleanHolder(t *testing.T) {
AvailableShardFileFlushDuration.Set(100 * time.Millisecond) //shorten the default time to force a file write
availableShardFileFlushDuration.Set(100 * time.Millisecond) //shorten the default time to force a file write
cluster := NewTestCluster(2)
// Create a local holder.
@ -226,7 +226,7 @@ func TestHolderCleaner_CleanHolder(t *testing.T) {
if err != nil {
t.Fatalf("adding remote shards: %v", err)
}
time.Sleep(2 * AvailableShardFileFlushDuration.Get())
time.Sleep(2 * availableShardFileFlushDuration.Get())
// Keep replication the same and ensure we get the expected results.
cluster.ReplicaN = 2

View file

@ -34,7 +34,7 @@ func NewTestCluster(n int) *cluster {
panic(err)
}
AvailableShardFileFlushDuration.Set(100 * time.Millisecond)
availableShardFileFlushDuration.Set(100 * time.Millisecond)
c := newCluster()
c.ReplicaN = 1
c.Hasher = NewTestModHasher()