From 450b64dc372acac583a213945eb166463c23a1af Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Mon, 27 Jan 2025 13:16:00 +0530 Subject: [PATCH 1/4] temp --- posting/list.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/posting/list.go b/posting/list.go index 1952c83f4ce..d61b6f20966 100644 --- a/posting/list.go +++ b/posting/list.go @@ -382,6 +382,10 @@ func (mm *MutableLayer) print() string { mm.deleteAllMarker) } +func (l *List) print() string { + return fmt.Sprintf("minTs: %d, plist: %+v, mutationMap: %s", l.minTs, l.plist, l.mutationMap.print()) +} + // Return if piterator needs to be searched or not after mutable map and the posting if found. func (mm *MutableLayer) findPosting(readTs, uid uint64) (bool, *pb.Posting) { if mm == nil { @@ -1119,7 +1123,7 @@ func (l *List) iterate(readTs uint64, afterUid uint64, f func(obj *pb.Posting) e // pitr iterates through immutable postings err = pitr.seek(l, afterUid, deleteBelowTs) if err != nil { - return errors.Wrapf(err, "cannot initialize iterator when calling List.iterate") + return errors.Wrapf(err, "cannot initialize iterator when calling List.iterate "+l.print()) } loop: From c03b37d90e7d210ea0c721042bff740668af639f Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Mon, 27 Jan 2025 22:53:34 +0530 Subject: [PATCH 2/4] added fix for deletebelowts issue --- systest/mutations-and-queries/mutations_test.go | 6 +++++- systest/mutations-and-queries/upgrade_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/systest/mutations-and-queries/mutations_test.go b/systest/mutations-and-queries/mutations_test.go index ce3ce6094f8..c9a40e748d2 100644 --- a/systest/mutations-and-queries/mutations_test.go +++ b/systest/mutations-and-queries/mutations_test.go @@ -2935,7 +2935,11 @@ func (ssuite *SystestTestSuite) DeleteAndQuerySameTxn() { q := `{ me(func: has(name)) { name } }` resp, err := txn2.Query(ctx, q) - require.NoError(t, err) + if !ssuite.CheckAllowedErrorPreUpgrade(err) { + require.NoError(t, err) + } else { + t.Skip() + } dgraphapi.CompareJSON(`{"me":[{"name":"Alice"}]}`, string(resp.GetJson())) require.NoError(t, txn2.Commit(ctx)) diff --git a/systest/mutations-and-queries/upgrade_test.go b/systest/mutations-and-queries/upgrade_test.go index 4d809924515..d6254cca3e3 100644 --- a/systest/mutations-and-queries/upgrade_test.go +++ b/systest/mutations-and-queries/upgrade_test.go @@ -21,6 +21,7 @@ package main import ( "errors" "log" + "strings" "testing" "time" @@ -57,6 +58,18 @@ func (ssuite *SystestTestSuite) TearDownSubTest() { ssuite.lc.Cleanup(ssuite.T().Failed()) } +func (ssuite *SystestTestSuite) CheckAllowedErrorPreUpgrade(err error) bool { + if err == nil { + return true + } + if val, checkErr := dgraphtest.IsHigherVersion( + ssuite.dc.GetVersion(), + "315747a19e9d5c5b98055c8b943a6e6462153bb3"); checkErr == nil && val || checkErr != nil { + return false + } + return strings.Contains(err.Error(), "cannot initialize iterator when calling List.iterate: deleteBelowTs") +} + func (ssuite *SystestTestSuite) Upgrade() { require.NoError(ssuite.T(), ssuite.lc.Upgrade(ssuite.uc.After, ssuite.uc.Strategy)) } From 28e51e59163f30fcda3bfe20bb776a0c3ccbfbdf Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Mon, 27 Jan 2025 23:31:09 +0530 Subject: [PATCH 3/4] added function --- systest/mutations-and-queries/integration_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/systest/mutations-and-queries/integration_test.go b/systest/mutations-and-queries/integration_test.go index 91b5f126d9e..fc608043a9a 100644 --- a/systest/mutations-and-queries/integration_test.go +++ b/systest/mutations-and-queries/integration_test.go @@ -45,6 +45,10 @@ func (ssuite *SystestTestSuite) SetupSubTest() { require.NoError(t, gcli.DropAll()) } +func (ssuite *SystestTestSuite) CheckAllowedErrorPreUpgrade(err error) bool { + return false +} + func (ssuite *SystestTestSuite) Upgrade() { // Not implemented for integration tests } From 49f3e8c1ee62e06c6a32c3602e8a57aed6203edd Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Tue, 28 Jan 2025 00:26:47 +0530 Subject: [PATCH 4/4] fixed bug --- systest/mutations-and-queries/mutations_test.go | 10 ++++++---- systest/mutations-and-queries/upgrade_test.go | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/systest/mutations-and-queries/mutations_test.go b/systest/mutations-and-queries/mutations_test.go index c9a40e748d2..087bd1aa0d7 100644 --- a/systest/mutations-and-queries/mutations_test.go +++ b/systest/mutations-and-queries/mutations_test.go @@ -2935,10 +2935,12 @@ func (ssuite *SystestTestSuite) DeleteAndQuerySameTxn() { q := `{ me(func: has(name)) { name } }` resp, err := txn2.Query(ctx, q) - if !ssuite.CheckAllowedErrorPreUpgrade(err) { - require.NoError(t, err) - } else { - t.Skip() + if err != nil { + if !ssuite.CheckAllowedErrorPreUpgrade(err) { + require.NoError(t, err) + } else { + t.Skip() + } } dgraphapi.CompareJSON(`{"me":[{"name":"Alice"}]}`, string(resp.GetJson())) diff --git a/systest/mutations-and-queries/upgrade_test.go b/systest/mutations-and-queries/upgrade_test.go index d6254cca3e3..f67668135fb 100644 --- a/systest/mutations-and-queries/upgrade_test.go +++ b/systest/mutations-and-queries/upgrade_test.go @@ -59,9 +59,6 @@ func (ssuite *SystestTestSuite) TearDownSubTest() { } func (ssuite *SystestTestSuite) CheckAllowedErrorPreUpgrade(err error) bool { - if err == nil { - return true - } if val, checkErr := dgraphtest.IsHigherVersion( ssuite.dc.GetVersion(), "315747a19e9d5c5b98055c8b943a6e6462153bb3"); checkErr == nil && val || checkErr != nil {