19 #include <ndb_global.h>
20 #include "Properties.hpp"
26 writeToFile(
const Properties & p,
const char * fname,
bool uu =
true){
27 Uint32 sz = p.getPackedSize();
28 char * buffer = (
char*)malloc(sz);
30 FILE * f = fopen(fname,
"wb");
31 bool res = p.pack((Uint32*)buffer);
33 ndbout <<
"Error packing" << endl;
34 ndbout <<
"p.getPropertiesErrno() = " << p.getPropertiesErrno() << endl;
35 ndbout <<
"p.getOSErrno() = " << p.getOSErrno() << endl;
38 uuencode(buffer, sz, f);
40 fwrite(buffer, 1, sz, f);
49 readFromFile(
Properties & p,
const char *fname,
bool uu =
true){
51 char * buffer = (
char*)malloc(sz);
52 FILE * f = fopen(fname,
"rb");
54 uudecode(f, buffer, sz);
56 fread(buffer, 1, sz, f);
58 bool res = p.unpack((Uint32*)buffer, sz);
60 ndbout <<
"Error unpacking" << endl;
61 ndbout <<
"p.getPropertiesErrno() = " << p.getPropertiesErrno() << endl;
62 ndbout <<
"p.getOSErrno() = " << p.getOSErrno() << endl;
70 tmp.
put(
"LockPagesInMainMemory", i++);
71 tmp.
put(
"SleepWhenIdle", i++);
72 tmp.
put(
"NoOfSignalsToExecuteBetweenCommunicationInterfacePoll", i++);
73 tmp.
put(
"TimeBetweenWatchDogCheck", i++);
74 tmp.
put(
"StopOnError", i++);
76 tmp.
put(
"MaxNoOfConcurrentOperations", i++);
77 tmp.
put(
"MaxNoOfConcurrentTransactions", i++);
78 tmp.
put(
"MemorySpaceIndexes", i++);
79 tmp.
put(
"MemorySpaceTuples", i++);
80 tmp.
put(
"MemoryDiskPages", i++);
81 tmp.
put(
"NoOfFreeDiskClusters", i++);
82 tmp.
put(
"NoOfDiskClusters", i++);
84 tmp.
put(
"TimeToWaitAlive", i++);
85 tmp.
put(
"HeartbeatIntervalDbDb", i++);
86 tmp.
put(
"HeartbeatIntervalDbApi", i++);
87 tmp.
put(
"TimeBetweenInactiveTransactionAbortCheck", i++);
89 tmp.
put(
"TimeBetweenLocalCheckpoints", i++);
90 tmp.
put(
"TimeBetweenGlobalCheckpoints", i++);
91 tmp.
put(
"NoOfFragmentLogFiles", i++);
92 tmp.
put(
"NoOfConcurrentCheckpointsDuringRestart", i++);
93 tmp.
put(
"TransactionInactiveTimeBeforeAbort", i++);
94 tmp.
put(
"NoOfConcurrentProcessesHandleTakeover", i++);
96 tmp.
put(
"NoOfConcurrentCheckpointsAfterRestart", i++);
98 tmp.
put(
"NoOfDiskPagesToDiskDuringRestartTUP", i++);
99 tmp.
put(
"NoOfDiskPagesToDiskAfterRestartTUP", i++);
100 tmp.
put(
"NoOfDiskPagesToDiskDuringRestartACC", i++);
101 tmp.
put(
"NoOfDiskPagesToDiskAfterRestartACC", i++);
103 tmp.
put(
"NoOfDiskClustersPerDiskFile", i++);
104 tmp.
put(
"NoOfDiskFiles", i++);
107 tmp.
put(
"NoOfReplicas", 33);
108 tmp.
put(
"MaxNoOfAttributes", 34);
109 tmp.
put(
"MaxNoOfTables", 35);
117 p.
put(
"Ank1",
"anka");
118 p.
put(
"Ank2",
"anka");
119 p.
put(
"Ank3",
"anka");
120 p.
put(
"Ank4",
"anka");
124 tmp.
put(
"Type",
"TCP");
125 tmp.
put(
"OwnNodeId", 1);
126 tmp.
put(
"RemoteNodeId", 2);
127 tmp.
put(
"OwnHostName",
"local");
128 tmp.
put(
"RemoteHostName",
"remote");
130 tmp.
put(
"SendSignalId", 1);
131 tmp.
put(
"Compression", (Uint32)
false);
132 tmp.
put(
"Checksum", 1);
134 tmp.put64(
"SendBufferSize", 2000);
135 tmp.put64(
"MaxReceiveSize", 1000);
137 tmp.
put(
"PortNumber", 1233);
140 p.
put(
"Connection", 1, &tmp);
142 p.
put(
"NoOfConnections", 2);
143 p.
put(
"NoOfConnection2", 2);
146 p.
put(
"anka",
"kalle");
149 p2.
put(
"kalle",
"anka");
153 p.
put(
"Connection", 2, &tmp);
155 p.
put(
"Connection", 3, &tmp);
157 p.
put(
"Connection", 4, &tmp);
166 bool bb = p.get(
"kalle", &a);
167 bool cc = p.get(
"anka", &b);
168 bool dd = p.get(
"prop", &p3);
169 if(p.getCopy(
"prop", &p4))
177 p.print(stdout,
"testing 1: ");
179 writeToFile(p,
"A_1");
180 writeToFile(p,
"B_1",
false);
183 readFromFile(r1,
"A_1");
184 writeToFile(r1,
"A_3");
188 readFromFile(r2,
"A_1");
189 writeToFile(r2,
"A_4");
192 readFromFile(r3,
"B_1",
false);
193 writeToFile(r3,
"A_5");
194 r3.print(stdout,
"testing 3: ");