diff --git a/go/libraries/doltcore/doltdb/commit_hooks.go b/go/libraries/doltcore/doltdb/commit_hooks.go index 26ec1be4263..ae2de48326c 100644 --- a/go/libraries/doltcore/doltdb/commit_hooks.go +++ b/go/libraries/doltcore/doltdb/commit_hooks.go @@ -60,7 +60,6 @@ func pushDataset(ctx context.Context, destDB, srcDB datas.Database, ds datas.Dat return err } - // NM4 tmp to compile. err := pullHash(ctx, destDB, srcDB, []hash.Hash{addr}, tmpDir, nil, nil) if err != nil { return err diff --git a/go/libraries/doltcore/doltdb/commit_itr.go b/go/libraries/doltcore/doltdb/commit_itr.go index cdf3ee62588..4f5498b8e06 100644 --- a/go/libraries/doltcore/doltdb/commit_itr.go +++ b/go/libraries/doltcore/doltdb/commit_itr.go @@ -136,10 +136,12 @@ func (cmItr *commitItr) Next(ctx context.Context) (hash.Hash, *OptionalCommit, e next := cmItr.unprocessed[numUnprocessed-1] cmItr.unprocessed = cmItr.unprocessed[:numUnprocessed-1] cmItr.curr, err = HashToCommit(ctx, cmItr.ddb.ValueReadWriter(), cmItr.ddb.ns, next) - - if err != nil { + if err != nil && err != ErrGhostCommitEncountered { return hash.Hash{}, nil, err } + if err == ErrGhostCommitEncountered { + cmItr.curr = nil + } return next, &OptionalCommit{cmItr.curr, next}, nil } diff --git a/go/libraries/doltcore/sqle/dtables/commits_table.go b/go/libraries/doltcore/sqle/dtables/commits_table.go index 21b2662228d..d0009298625 100644 --- a/go/libraries/doltcore/sqle/dtables/commits_table.go +++ b/go/libraries/doltcore/sqle/dtables/commits_table.go @@ -153,15 +153,11 @@ func NewCommitsRowItr(ctx *sql.Context, ddb *doltdb.DoltDB) (CommitsRowItr, erro func (itr CommitsRowItr) Next(ctx *sql.Context) (sql.Row, error) { h, optCmt, err := itr.itr.Next(ctx) if err != nil { - if err == doltdb.ErrGhostCommitEncountered { - return nil, io.EOF - } - return nil, err } cm, ok := optCmt.ToCommit() if !ok { - return nil, doltdb.ErrGhostCommitRuntimeFailure + return nil, io.EOF } meta, err := cm.GetCommitMeta(ctx) diff --git a/go/libraries/doltcore/sqle/history_table.go b/go/libraries/doltcore/sqle/history_table.go index cc5b0ae03aa..c91722d4b5d 100644 --- a/go/libraries/doltcore/sqle/history_table.go +++ b/go/libraries/doltcore/sqle/history_table.go @@ -458,7 +458,7 @@ func (cp commitPartitioner) Next(ctx *sql.Context) (sql.Partition, error) { } cm, ok := optCmt.ToCommit() if !ok { - return nil, doltdb.ErrGhostCommitEncountered // NM4 TEST. + return nil, io.EOF } return &commitPartition{h, cm}, nil diff --git a/go/store/chunks/chunk.go b/go/store/chunks/chunk.go index 885527d77c8..1d68e3e1009 100644 --- a/go/store/chunks/chunk.go +++ b/go/store/chunks/chunk.go @@ -58,7 +58,7 @@ func (c Chunk) IsEmpty() bool { return len(c.data) == 0 } -// IsGhost returns true if the chunk is a ghost chunk. Ghost chunks have not data, so if IsGhost() returns true, Data() will be an empty slice. +// IsGhost returns true if the chunk is a ghost chunk. Ghost chunks have no data, so if IsGhost() returns true, Data() will be an empty slice. func (c Chunk) IsGhost() bool { return c.ghost } diff --git a/integration-tests/bats/shallow-clone.bats b/integration-tests/bats/shallow-clone.bats index 7838869ab57..5108347d194 100644 --- a/integration-tests/bats/shallow-clone.bats +++ b/integration-tests/bats/shallow-clone.bats @@ -145,10 +145,8 @@ seed_and_start_serial_remote() { # dolt_diff table will show two rows, because each row is a delta. run dolt sql -q "select * from dolt_diff" [ "$status" -eq 0 ] - [[ "$output" =~ "Added Val: 5 " ]] || false [[ "$output" =~ "Added Val: 4 " ]] || false ! [[ "$output" =~ "Added Val: 3 " ]] || false - ! [[ "$output" =~ "Added Val: 2 " ]] || false run dolt sql -q "select * from dolt_commits" [ "$status" -eq 0 ] @@ -157,13 +155,19 @@ seed_and_start_serial_remote() { [[ "$output" =~ "Added Val: 3 " ]] || false ! [[ "$output" =~ "Added Val: 2 " ]] || false + # A full clone would have 5 commits with i=1, so if we have 3, we are looking good. + run dolt sql -q "select count(*) = 3 from dolt_history_vals where i = 1" + [ "$status" -eq 0 ] + [[ "$output" =~ "true" ]] || false - # NM4 - not sure what dolt_history_{table} should do. Currently errors out every time. -# run dolt sql -q "select * from dolt_history_vals" -# [ "$status" -eq 0 ] -# [[ "$output" =~ "yo mama" ]] || false -# [[ "$output" =~ "4 " ]] || false -# [[ "$output" =~ "3 " ]] || false + # A full clone would have 2 commits with i=4, and our shallow clone has all the commits for that row. + run dolt sql -q "select count(*) = 2 from dolt_history_vals where i = 4" + [ "$status" -eq 0 ] + [[ "$output" =~ "true" ]] || false + + run dolt sql -q "select count(distinct commit_hash) = 3 from dolt_history_vals" + [ "$status" -eq 0 ] + [[ "$output" =~ "true" ]] || false # Verify that the table is complete. run dolt sql -q "select sum(i) from vals"