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

RangeHandle does not properly group repair updates #44

Open
stephentu opened this issue Nov 24, 2010 · 0 comments
Open

RangeHandle does not properly group repair updates #44

stephentu opened this issue Nov 24, 2010 · 0 comments

Comments

@stephentu
Copy link
Member

RangeHandle uses a

var loosers = new HashMap[Array[Byte], (Array[Byte], List[RemoteActorProxy])]

to attempt to group loser keys. however, there are several issues with this

(1) Array[Byte]'s hashcode is identity based:
scala> val h = new collection.mutable.HashMap[Array[Byte], Int]
h: scala.collection.mutable.HashMap[Array[Byte],Int] = Map()

scala> h += ((Array(0,1,2), 1))
res0: h.type = Map(([B@1224b90,1))

scala> h contains Array(0, 1, 2)
res1: Boolean = false

  1. we're not even taking advantage of this, since we don't have a bulk put request, but we process puts sequentially (albeit asynchronously)
    for ((key, (data, servers)) <- handler.loosers) {
    for (server <- servers) {
    server !! PutRequest(key, Some(data))
    }
    }

so i propose either we
(1) considering the HashMaps into an ArrayBuffer for efficiency

(2) use a wrapper class around Array[Byte] which properly computes the hash code. then we can take advantage of this grouping by introducing a bulk put request

the current solution is sub-optimal compared to (1) or (2) b/c a) we don't group keys properly, b) even if we did we don't exploit the grouping

thoughts?

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

No branches or pull requests

1 participant