https://codereview.appspot.com/331310043/diff/1/src/java/org/apache/cassandra/locator/OmnipotentSnitch.java File src/java/org/apache/cassandra/locator/OmnipotentSnitch.java (right): https://codereview.appspot.com/331310043/diff/1/src/java/org/apache/cassandra/locator/OmnipotentSnitch.java#newcode194 src/java/org/apache/cassandra/locator/OmnipotentSnitch.java:194: addresses.add(0, address); can we use list.set ? https://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html#set%28int,%20E%29?
6 years, 4 months ago
(2017-11-12 16:23:56 UTC)
#2
Okey. Seems like you have to get the index of address, and then replace. Ugly ...
6 years, 4 months ago
(2017-11-12 18:32:02 UTC)
#5
Okey. Seems like you have to get the index of address, and then replace.
Ugly enough, don't know the time required for all these though.
On 12 Nov 2017 19:12, "Benjámin Seregi" <seregibenjamin@gmail.com> wrote:
> Well, I need to keep the original order for the rest of the list. How do
> you want to use set? By simply doing addresses.add(0, address) will
> double the element address in the list which is not good.
>
> Best regards,
> Benjamin
>
> On 12 November 2017 at 19:06, Benjámin Seregi <seregibenjamin@gmail.com>
> wrote:
>
>> Oh, nice. I didn't see that function.
>>
>> On 12 November 2017 at 17:23, <01tonythomas@gmail.com> wrote:
>>
>>>
>>> https://codereview.appspot.com/331310043/diff/1/src/java/org
>>> /apache/cassandra/locator/OmnipotentSnitch.java
>>> File src/java/org/apache/cassandra/locator/OmnipotentSnitch.java
>>> (right):
>>>
>>> https://codereview.appspot.com/331310043/diff/1/src/java/org
>>> /apache/cassandra/locator/OmnipotentSnitch.java#newcode194
>>> src/java/org/apache/cassandra/locator/OmnipotentSnitch.java:194:
>>> addresses.add(0, address);
>>> can we use list.set ?
>>> https://docs.oracle.com/javase/6/docs/api/java/util/ArrayLis
>>> t.html#set%28int,%20E%29?
>>>
>>> https://codereview.appspot.com/331310043/
>>>
>>
>>
>
I don't know the underlying list data structure but if it is a doubly linked ...
6 years, 4 months ago
(2017-11-12 18:35:42 UTC)
#6
I don't know the underlying list data structure but if it is a doubly
linked list then remove, add should be very fast. Don't worry this won't be
a performance bottleneck.
On 12 November 2017 at 19:32, Tony Thomas <01tonythomas@gmail.com> wrote:
> Okey. Seems like you have to get the index of address, and then replace.
> Ugly enough, don't know the time required for all these though.
>
> On 12 Nov 2017 19:12, "Benjámin Seregi" <seregibenjamin@gmail.com> wrote:
>
>> Well, I need to keep the original order for the rest of the list. How do
>> you want to use set? By simply doing addresses.add(0, address) will
>> double the element address in the list which is not good.
>>
>> Best regards,
>> Benjamin
>>
>> On 12 November 2017 at 19:06, Benjámin Seregi <seregibenjamin@gmail.com>
>> wrote:
>>
>>> Oh, nice. I didn't see that function.
>>>
>>> On 12 November 2017 at 17:23, <01tonythomas@gmail.com> wrote:
>>>
>>>>
>>>> https://codereview.appspot.com/331310043/diff/1/src/java/org
>>>> /apache/cassandra/locator/OmnipotentSnitch.java
>>>> File src/java/org/apache/cassandra/locator/OmnipotentSnitch.java
>>>> (right):
>>>>
>>>> https://codereview.appspot.com/331310043/diff/1/src/java/org
>>>> /apache/cassandra/locator/OmnipotentSnitch.java#newcode194
>>>> src/java/org/apache/cassandra/locator/OmnipotentSnitch.java:194:
>>>> addresses.add(0, address);
>>>> can we use list.set ?
>>>> https://docs.oracle.com/javase/6/docs/api/java/util/ArrayLis
>>>> t.html#set%28int,%20E%29?
>>>>
>>>> https://codereview.appspot.com/331310043/
>>>>
>>>
>>>
>>
Issue 331310043: OmnipotentSnitch: make us the first replica.
(Closed)
Created 6 years, 4 months ago by seregibenjamin
Modified 6 years, 4 months ago
Reviewers: tonythomas
Base URL:
Comments: 1