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

Spread recalculate caches to all nodes. Fixes #1069 #1109

Merged
merged 1 commit into from
Feb 12, 2018

Conversation

yuce
Copy link
Contributor

@yuce yuce commented Feb 12, 2018

Overview

Adds a RecalculateCaches gossip message type. The node which receives /recalculate-caches HTTP request sends RecalculateCaches message to other nodes.

In order to test, deactivate sending RecalculateCaches message by comment out line 2154-2159 of handler.go so it looks like this:

func (h *Handler) handleRecalculateCaches(w http.ResponseWriter, r *http.Request) {
	// err := h.Broadcaster.SendSync(&internal.RecalculateCaches{})
	// if err != nil {
	//	w.WriteHeader(http.StatusInternalServerError)
	//	h.writeQueryResponse(w, r, &QueryResponse{Err: err})
	//	return
	//}
	h.Holder.RecalculateCaches()
	w.WriteHeader(http.StatusNoContent)
}

Run go test -run TestMain_RecalculateHashes github.com/pilosa/pilosa/server. This should fail.

Then, remove those comments and run the test again. This time it should pass.

Fixes #1069

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.

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.

This looks right to me

@yuce
Copy link
Contributor Author

yuce commented Feb 12, 2018

Great!

@yuce yuce merged commit 8db3a9b into FeatureBaseDB:cluster-resize Feb 12, 2018
@yuce yuce deleted the 1069-all-recalculate-caches branch February 12, 2018 19:00
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.

3 participants