Bug #45390
Updated by Kefu Chai almost 4 years ago
The problems occurs both in Octopus and Master. This is the simple version of a part of test_compression.cc: <pre><code class="cpp"> #include <errno.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include "gtest/gtest.h" #include "common/ceph_context.h" #include "common/config.h" #include "osd/OSDMap.h" TEST(OSDMAP, Dencode) { #include "osdmaps/osdmap.2982809.h" bufferlist orig; orig.append((char*)osdmap_a, sizeof(osdmap_a)); cout << "orig length " << orig.length() << std::endl; orig.hexdump(cout); cout << std::endl; uint32_t size = 128*1024; OSDMap *o = new OSDMap; o->decode(orig); bufferlist fbl; o->encode(fbl, o->get_encoding_features() | CEPH_FEATURE_RESERVED); cout << "Result: " << ((fbl.contents_equal(orig))?"True":"False") << std::endl; fbl.hexdump(cout); cout << std::endl; ASSERT_TRUE(fbl.contents_equal(orig)); } </code></pre> This fails in the assert test... already in the third byte This is the original read osdmap: 0x8,0x7,0xdf,0x56,0x9,0x0,0x7,0x1,0x91,0x47,0x5,0x0,0xb4,0xf4,0x63,0xa0, 0xc6,0x71,0x43,0xa8,0xbd,0x36,0xe4,0xa,0xb8,0xd2,0x33,0xd2,0x99,0x83,0x2d,0x0, 0x6d,0x34,0x16,0x52,0xe8,0x59,0x97,0x1c,0xa,0x4d,0x4e,0x5e,0x13,0x5c,0x3b,0x35, 0x4,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1b,0x5,0x20,0xe, 0x0,0x0,0x1,0x3,0x0,0x2,0x0,0x20,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x83,0x2d,0x0,0x76,0x4a,0x1,0x0,0x0,0x0, First hexdump top: 00000000 08 07 df 56 09 00 07 01 91 47 05 00 b4 f4 63 a0 |...V.....G....c.| 00000010 c6 71 43 a8 bd 36 e4 0a b8 d2 33 d2 99 83 2d 00 |.qC..6....3...-.| 00000020 6d 34 16 52 e8 59 97 1c 0a 4d 4e 5e 13 5c 3b 35 |m4.R.Y...MN^.\;5| 00000030 04 00 00 00 04 00 00 00 00 00 00 00 1b 05 20 0e |.............. .| 00000040 00 00 01 03 00 02 00 20 00 00 00 20 00 00 00 00 |....... ... ....| 00000050 00 00 00 00 00 00 40 83 2d 00 76 4a 01 00 00 00 |......@.-.vJ....| 00000060 00 00 40 83 2d 00 00 00 00 00 d0 00 00 00 01 00 |..@.-...........| Second hexdump top: 00000000 08 07 9f 6b 0a 00 07 01 c1 8c 05 00 b4 f4 63 a0 |...k..........c.| 00000010 c6 71 43 a8 bd 36 e4 0a b8 d2 33 d2 99 83 2d 00 |.qC..6....3...-.| 00000020 6d 34 16 52 e8 59 97 1c 0a 4d 4e 5e 13 5c 3b 35 |m4.R.Y...MN^.\;5| 00000030 04 00 00 00 04 00 00 00 00 00 00 00 1b 05 20 0e |.............. .| 00000040 00 00 01 03 00 02 00 20 00 00 00 20 00 00 00 00 |....... ... ....| 00000050 00 00 00 00 00 00 40 83 2d 00 76 4a 01 00 00 00 |......@.-.vJ....| 00000060 00 00 40 83 2d 00 00 00 00 00 d0 00 00 00 01 00 |..@.-...........| So the