modified ndb backup/restore to be byte order independant

- the replica info was not stored in byte order indepentent format
- backup/restore still compatible 5.0->5.1
- but patch makes previous 5.1 versions completely incompatible
parent b51074f2
......@@ -484,53 +484,38 @@ TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_
0 2 20000 0 0 0 0 1
0 3 20000 0 0 0 0 1
0 4 20000 0 0 0 0 1
1 0 10000000 0 0 0 0 1
1 1 30000 0 0 0 0 1
1 2 20000 0 0 0 0 1
1 3 20000 0 0 0 0 1
1 4 20000 0 0 0 0 1
2 0 9857062 54 225197 76 368135 1
2 1 60601 174 822920 181 792319 1
2 2 68832 117 531214 98 482382 1
2 3 83550 106 521953 104 458403 1
2 4 19955 118 532084 110 532129 1
3 0 9732896 62 289563 88 413729 1
3 1 51056 202 895888 193 905433 0
3 2 67183 122 596787 127 598436 1
3 3 97669 159 761743 141 747624 1
3 4 141196 140 727808 136 606567 1
4 0 9616621 138 603930 142 720205 0
4 1 178927 348 1741521 344 1613650 0
4 2 52141 236 1169929 232 1184971 0
4 3 48938 228 1147957 244 1196688 0
4 4 193373 246 1257982 234 1205805 0
5 0 9515281 156 726253 166 827593 0
5 1 253798 597 2840640 545 2765769 0
5 2 102776 362 1821680 364 1771045 0
5 3 87349 359 1778652 375 1740241 0
5 4 130796 351 1727448 375 1790025 0
1 0 10000000 0 0 0 0 0
1 1 30000 0 0 0 0 0
1 2 20000 0 0 0 0 0
1 3 20000 0 0 0 0 0
1 4 20000 0 0 0 0 0
2 0 9981761 17 80457 19 98696 0
2 1 17823 55 203688 46 215865 0
2 2 47056 33 159275 33 132219 0
2 3 15719 26 126833 29 131114 0
2 4 27641 32 133459 36 125818 0
SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
ACCOUNT_ID OWNER BALANCE ACCOUNT_TYPE
0 0 9531306 0
1 3001 123844 1
2 3002 30800 2
3 3003 3133 3
4 3004 6524 4
5 3005 80152 1
6 3006 107390 1
7 3007 69448 2
8 3008 663 3
9 3009 136740 4
0 0 9863546 0
1 3001 12885 1
2 3002 11012 2
3 3003 32789 3
4 3004 10992 4
5 3005 2247 1
6 3006 3170 1
7 3007 60321 2
8 3008 30508 3
9 3009 62530 4
SELECT COUNT(*) FROM TRANSACTION;
COUNT(*)
6649
3444
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SYSTEM_VALUES_ID VALUE
0 4767
1 6
0 2039
1 3
SELECT * FROM cluster.apply_status WHERE server_id=0;
server_id epoch
0 314
0 151
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
......
......@@ -472,6 +472,8 @@ Dbdict::packTableIntoPages(SimpleProperties::Writer & w,
Uint16 *data = (Uint16*)&signal->theData[25];
Uint32 count = 2 + data[0] * data[1];
w.add(DictTabInfo::ReplicaDataLen, 2*count);
for (Uint32 i = 0; i < count; i++)
data[i] = htons(data[i]);
w.add(DictTabInfo::ReplicaData, data, 2*count);
}
else
......
......@@ -2112,15 +2112,15 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
if(tableDesc->ReplicaDataLen > 0)
{
Uint16 replicaCount = tableDesc->ReplicaData[0];
Uint16 fragCount = tableDesc->ReplicaData[1];
Uint16 replicaCount = ntohs(tableDesc->ReplicaData[0]);
Uint16 fragCount = ntohs(tableDesc->ReplicaData[1]);
impl->m_replicaCount = replicaCount;
impl->m_fragmentCount = fragCount;
DBUG_PRINT("info", ("replicaCount=%x , fragCount=%x",replicaCount,fragCount));
for(i = 0; i < (Uint32) (fragCount*replicaCount); i++)
{
impl->m_fragments.push_back(tableDesc->ReplicaData[i+2]);
impl->m_fragments.push_back(ntohs(tableDesc->ReplicaData[i+2]));
}
Uint32 topBit = (1 << 31);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment