Mercurial > hg > Database > Alice
diff src/main/java/alice/datasegment/Command.java @ 530:4aeebea0c9b5 dispose
can't unzip
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 03 May 2015 10:04:28 +0900 |
parents | cb7c31848d16 |
children | b6049fb123d8 |
line wrap: on
line diff
--- a/src/main/java/alice/datasegment/Command.java Fri May 01 18:19:16 2015 +0900 +++ b/src/main/java/alice/datasegment/Command.java Sun May 03 10:04:28 2015 +0900 @@ -94,31 +94,30 @@ case UPDATE: case PUT: case REPLY: - if (rData.compressed()) { - // have already converted - data = (byte[]) rData.getObj(); - compressed = rData.compressed(); // true - serialized = rData.serialized(); + System.out.println("Command reply compressFlag:" + compressFlag); + if(compressFlag){ + System.out.println("Command get zMP:" + rData.getZMessagePack()); + data = packer.write(rData.getZMessagePack()); + compressed = true; } else { - if (!rData.serialized() && !rData.isByteArray()) { - data = packer.write(rData.getObj()); - serialized = true; - } else { // rData is RAW ByteArray or already serialized - data = (byte[]) rData.getObj(); - serialized = rData.serialized(); - } - if (compressFlag) { - rData.zip(); - compressed = true; - } + data = rData.getMessagePack(); + serialized = true; } - CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, serialized, compressed); + + System.out.println("Before DataSize:" + rData.getDataSize()); + CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, serialized, compressed, rData.getDataSize()); if (rData.setTime) { cm.setTime = true; cm.time = rData.time; cm.depth = rData.depth + 1; } + System.out.print("Command packer: "); + for (int i = 0; i < data.length; i++) { + System.out.print(Integer.toHexString(data[i] & 0xff)); + } + System.out.print("\n"); + header = packer.write(cm); dataSize = packer.write(data.length); buf = ByteBuffer.allocate(header.length+dataSize.length+data.length); @@ -127,7 +126,8 @@ buf.put(data); break; default: - header = packer.write(new CommandMessage(type.id, index, seq, key, quickFlag, false, compressFlag)); + System.out.println("default compressFlag:" + compressFlag); + header = packer.write(new CommandMessage(type.id, index, seq, key, quickFlag, false, compressFlag, 0)); buf = ByteBuffer.allocate(header.length); buf.put(header); break;