Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push and Pull v2 #89

Merged
merged 8 commits into from
Sep 27, 2019
Merged

Push and Pull v2 #89

merged 8 commits into from
Sep 27, 2019

Conversation

bheni
Copy link
Contributor

@bheni bheni commented Sep 24, 2019

No description provided.

@bheni bheni changed the title mostly working Push and Pull v2 Sep 26, 2019
@bheni bheni requested review from reltuk and zachmu and removed request for reltuk September 26, 2019 16:58
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate you

rf, err := types.NewRef(cm.commitSt, ddb.db.Format())

if err != nil {
return err
}

return datas.Pull(ctx, srcDB.db, ddb.db, rf, progChan)
if datas.CanUsePuller(srcDB.db) && datas.CanUsePuller(ddb.db) {
puller, err := datas.NewPuller(ctx, tempDir, 256*1024, srcDB.db, ddb.db, rf.TargetHash())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const for this magic number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

return err
}

if puller == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strange interface. Can't the Pull method respond to a nil pointer and return nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the interface. Using a new ErrDBUpToDate returned by NewPuller

@@ -150,9 +152,51 @@ func (dcs *DoltChunkStore) Get(ctx context.Context, h hash.Hash) (chunks.Chunk,
}
}

func (dcs *DoltChunkStore) GetMany(ctx context.Context, hashes hash.HashSet, foundChunks chan *chunks.Chunk) error {
ae := atomicerr.New()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this doesn't really need to be an atomic error, since there is only one writer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the error is modified in a go routine and then checked on the main thread.

ch, err := chable.ToChunk()

if err != nil {
return map[hash.Hash]int{}, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't maps ref types? If so this should be nil, err

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

// NewSink still needs to be implemented in order to write to a DoltChunkStore using the TableFileStore interface
func (dcs *DoltChunkStore) NewSink(ctx context.Context, fileId string, numChunks int) (nbs.WriteCloserWithContext, error) {
panic("Not implemented")
// WriteTableFile returns a writer for a new table file. When the writer is closed the table file is persisted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is not accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return iohelp.WriteAll(wr, sink.buff[:sink.pos])
}

// FlushToFile writes all teh data that was written to the file to a file at the provided location.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teh typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return iohelp.WriteAll(wr, sink.blocks...)
}

// FlushToFile writes all teh data that was written to the file to a file at the provided location.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teh typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

sink.ae.SetIfError(err)
}

err = sink.wr.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stomps any previously set error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine. It's just updating the ae which won't change if it's already set.

return err
}

// FlushToFile writes all teh data that was written to the file to a file at the provided location.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

repeated ChunkTableInfo chunk_table_info = 3;
}

message AddTableFilesResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's more customary to return Empty or throw an exception, rather than make a client check a success flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. will fix this and commit at a later time.

@bheni bheni merged commit ee1ec46 into master Sep 27, 2019
@bheni bheni deleted the bh/push-pull-2 branch September 27, 2019 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants