Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper, mail # dev - Why does multi-op check operation increment zxid?


+
Thomas Koch 2011-10-20, 12:44
+
Ted Dunning 2011-10-20, 12:52
+
Thomas Koch 2011-10-20, 13:28
+
Benjamin Reed 2011-10-21, 22:32
+
Ted Dunning 2011-10-21, 23:13
+
Benjamin Reed 2011-10-24, 05:31
Copy link to this message
-
Re: Why does multi-op check operation increment zxid?
Thomas Koch 2011-10-24, 17:52
Benjamin Reed:
> i was thinking mostly in terms of the code itself. enums are great for
> structures that aren't serialized, but when you do serialize it, you
> end up having to force specific values into the enum and converting
> back and forth during the serialization and deserialization. i find
> that the enums, in this case, just shift the ugliness around.
>
> i'm also not sure about the performance implication, it should just be
> the cost of autoboxing, but to be honest it's more about the code
> readability to me.
>
> ben
Hi Ben,

I've updated the patch for ZK-1199 (make OpCode an enum). Please see yourself,
whether you consider the resulting code to be uglier or not. Especially in the
following classes I could remove a couple of lines and complexity:

PrepRequestProcessor, CommitProcessor, FollowerRequestProcessor,
ObserverRequestProcessor, ReadOnlyRequestProcessor

If you're concerned about readability, we should trust Joshua Bloch. One of
the advantages pointed out by him is type safety. The Request class has long
zxid, long sessionId, long cxid, and int type. During refactoring I've had a
hard time to not mix positions of the constructor parameters. The IDE can not
help me to distinguish between different number types.

Best regards,

Thomas Koch, http://www.koch.ro
+
Benjamin Reed 2011-10-25, 21:05
+
Marshall McMullen 2011-10-20, 16:07
+
Marshall McMullen 2011-10-20, 22:22