Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

store remoteAvailableShards to file #1663

Merged
merged 2 commits into from
Sep 25, 2018

Conversation

travisturner
Copy link
Member

Overview

This PR replaces the previous attempt (#1659) at making remoteAvailableShards immediately available after startup.

Pull request checklist

Code review checklist

This is the checklist that the reviewer will follow while reviewing your pull request. You do not need to do anything with this checklist, but be aware of what the reviewer will be looking for.

  • Ensure that any changes to external docs have been included in this pull request.
  • If the changes require that minor/major versions need to be updated, tag the PR appropriately.
  • Ensure the new code is properly commented and follows Idiomatic Go.
  • Check that tests have been written and that they cover the new functionality.
  • Run tests and ensure they pass.
  • Build and run the code, performing any applicable integration testing.

jaffee
jaffee previously approved these changes Sep 24, 2018
Copy link
Member

@jaffee jaffee left a comment

Choose a reason for hiding this comment

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

looks great, one comment, but not a blocker

field.go Outdated

// Write available shards to buffer.
var buf bytes.Buffer
if n, err := f.remoteAvailableShards.WriteTo(&buf); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

why write to a buffer rather than directly to the file?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch. i removed it in ee503b6

// saveAvailableShards writes remoteAvailableShards data for the field.
func (f *Field) saveAvailableShards() error {
// Open or create file.
file, err := os.OpenFile(filepath.Join(f.path, ".available.shards"), os.O_WRONLY|os.O_CREATE, 0666)
Copy link
Member

Choose a reason for hiding this comment

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

does this truncate by default or should we pass that flag explicitly

Copy link
Member Author

Choose a reason for hiding this comment

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

it truncates by default. you have to include os.O_APPEND to append.

@travisturner travisturner merged commit 82cadf9 into FeatureBaseDB:master Sep 25, 2018
@travisturner travisturner deleted the save-available-shards branch September 25, 2018 14:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants