Skip to content

Commit

Permalink
Fixed transaction error for grouping expressions over $page_list coll…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
lbnascimento committed Aug 6, 2020
1 parent a821001 commit cbb7f3d
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions LiteDB/Engine/SystemCollections/SysPageList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,13 @@ public override IEnumerable<BsonDocument> Input(BsonValue options)

_collections = _header.GetCollections().ToDictionary(x => x.Value, x => x.Key);

try
{
var result = pageID != null ?
this.GetList((uint)pageID.AsInt32, null, transaction, snapshot) :
this.GetAllList(transaction, snapshot);

foreach(var page in result)
{
yield return page;
}
var result = pageID != null ?
this.GetList((uint)pageID.AsInt32, null, transaction, snapshot) :
this.GetAllList(transaction, snapshot);

}
finally
foreach (var page in result)
{
transaction.Commit();
yield return page;
}
}

Expand All @@ -57,23 +49,23 @@ private IEnumerable<BsonDocument> GetAllList(TransactionService transaction, Sna
}

// get lists from data pages/index list
foreach(var collection in _collections)
foreach (var collection in _collections)
{
var snap = transaction.CreateSnapshot(LockMode.Read, collection.Value, false);

for (var slot = 0; slot < PAGE_FREE_LIST_SLOTS; slot++)
{
var result = this.GetList(snap.CollectionPage.FreeDataPageList[slot], null, transaction, snap);

foreach(var page in result)
foreach (var page in result)
{
yield return page;
}
}

var indexes = snap.CollectionPage.GetCollectionIndexes().ToArray();

foreach(var index in indexes)
foreach (var index in indexes)
{
var result = this.GetList(index.FreeIndexPageList, index.Name, transaction, snap);

Expand Down

0 comments on commit cbb7f3d

Please sign in to comment.