Skip to content

Commit cbb7f3d

Browse files
committed
Fixed transaction error for grouping expressions over $page_list collection
1 parent a821001 commit cbb7f3d

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

LiteDB/Engine/SystemCollections/SysPageList.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,13 @@ public override IEnumerable<BsonDocument> Input(BsonValue options)
3030

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

33-
try
34-
{
35-
var result = pageID != null ?
36-
this.GetList((uint)pageID.AsInt32, null, transaction, snapshot) :
37-
this.GetAllList(transaction, snapshot);
38-
39-
foreach(var page in result)
40-
{
41-
yield return page;
42-
}
33+
var result = pageID != null ?
34+
this.GetList((uint)pageID.AsInt32, null, transaction, snapshot) :
35+
this.GetAllList(transaction, snapshot);
4336

44-
}
45-
finally
37+
foreach (var page in result)
4638
{
47-
transaction.Commit();
39+
yield return page;
4840
}
4941
}
5042

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

5951
// get lists from data pages/index list
60-
foreach(var collection in _collections)
52+
foreach (var collection in _collections)
6153
{
6254
var snap = transaction.CreateSnapshot(LockMode.Read, collection.Value, false);
6355

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

68-
foreach(var page in result)
60+
foreach (var page in result)
6961
{
7062
yield return page;
7163
}
7264
}
7365

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

76-
foreach(var index in indexes)
68+
foreach (var index in indexes)
7769
{
7870
var result = this.GetList(index.FreeIndexPageList, index.Name, transaction, snap);
7971

0 commit comments

Comments
 (0)