Skip to content

Commit

Permalink
RavenDB-22583 : fix failing resharding test - increase timeout for bi…
Browse files Browse the repository at this point in the history
…g bucket migration
  • Loading branch information
aviv committed Jul 14, 2024
1 parent 6ae5d69 commit 5d208b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/SlowTests/Sharding/PrefixedSharding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ await store.Maintenance.SendAsync(new UpdatePrefixedShardingSettingOperation(new
}));

// move big bucket to the newly added shard
await Sharding.Resharding.MoveShardForId(store, $"users/0${bigBucketId}", toShard: 2);
await Sharding.Resharding.MoveShardForId(store, $"users/0${bigBucketId}", toShard: 2, timeout: 90_000);

// assert stats
using (shard.DocumentsStorage.ContextPool.AllocateOperationContext(out DocumentsOperationContext ctx))
Expand Down
8 changes: 4 additions & 4 deletions test/Tests.Infrastructure/RavenTestBase.ReshardingTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public async Task<int> StartMovingShardForId(IDocumentStore store, string id, in
return bucket;
}

public async Task WaitForMigrationComplete(IDocumentStore store, int bucket)
public async Task WaitForMigrationComplete(IDocumentStore store, int bucket, int timeout = 30_000)
{
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)))
using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeout)))
{
var record = await store.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation(store.Database), cts.Token);
while (record.Sharding.BucketMigrations.ContainsKey(bucket))
Expand All @@ -94,13 +94,13 @@ record = await store.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation
}
}

public async Task MoveShardForId(IDocumentStore store, string id, int? toShard = null, List<RavenServer> servers = null)
public async Task MoveShardForId(IDocumentStore store, string id, int? toShard = null, List<RavenServer> servers = null, int timeout = 30_000)
{
try
{
servers ??= _parent.GetServers();
var bucket = await StartMovingShardForId(store, id, toShard, servers);
await WaitForMigrationComplete(store, bucket);
await WaitForMigrationComplete(store, bucket, timeout);
}
catch (Exception e)
{
Expand Down

0 comments on commit 5d208b6

Please sign in to comment.