Skip to content

Commit 7a9b5f4

Browse files
authored
Merge pull request #203 from jovi-Li/main
读取归档数据bug修复:从快照恢复的时候,如果刚好有一个开始版本是归档数据的场景,会漏掉这个历史版本,造成恢复错误
2 parents 7d45c64 + e352e87 commit 7a9b5f4

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Storage/Vertex.Storage.Linq2db/Storage/EventArchive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public async Task<List<EventDocument<TPrimaryKey>>> GetList(TPrimaryKey actorId,
9696
using var db = this.dbFactory.GetEventDb(this.optionName);
9797
var tables = (await db.GetTables()).Where(this.tableFilter).ToList();
9898
tables.Reverse();
99-
var capacity = (int)(endVersion - startVersion);
99+
var capacity = (int)(endVersion - startVersion) + 1;
100100
var result = new List<EventDocument<TPrimaryKey>>(capacity);
101101
switch (actorId)
102102
{

src/Vertex.Runtime/Actor/VertexActor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public async Task<IList<EventDocumentDto>> GetEventDocuments(long startVersion,
454454
endVersion = results.Min(o => o.Version) - 1;
455455
}
456456

457-
if (endVersion > startVersion)
457+
if (endVersion >= startVersion)
458458
{
459459
var archiveEvents = await this.EventArchive.GetList(this.ActorId, startVersion, endVersion);
460460
if (archiveEvents.Count > 0)

0 commit comments

Comments
 (0)