Commit 0ef85808 authored by unknown's avatar unknown

fixed small bug in ndb redolog printer

+ added option to dumpe rest of page after exnd of data


ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp:
  fixed small bug in ndb redolog printer
ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp:
  fixed small bug in ndb redolog printer
parent fd3164e3
...@@ -134,7 +134,9 @@ bool PrepareOperationRecord::check() { ...@@ -134,7 +134,9 @@ bool PrepareOperationRecord::check() {
return true; return true;
} }
Uint32 PrepareOperationRecord::getLogRecordSize() { Uint32 PrepareOperationRecord::getLogRecordSize(Uint32 wordsRead) {
if (wordsRead < 2)
return 2; // make sure we read more
return m_logRecordSize; return m_logRecordSize;
} }
......
...@@ -83,7 +83,7 @@ class PrepareOperationRecord { ...@@ -83,7 +83,7 @@ class PrepareOperationRecord {
friend NdbOut& operator<<(NdbOut&, const PrepareOperationRecord&); friend NdbOut& operator<<(NdbOut&, const PrepareOperationRecord&);
public: public:
bool check(); bool check();
Uint32 getLogRecordSize(); Uint32 getLogRecordSize(Uint32 wordsRead);
protected: protected:
Uint32 m_recordType; Uint32 m_recordType;
......
...@@ -41,6 +41,7 @@ void doExit(); ...@@ -41,6 +41,7 @@ void doExit();
FILE * f= 0; FILE * f= 0;
char fileName[256]; char fileName[256];
bool theDumpFlag = false;
bool thePrintFlag = true; bool thePrintFlag = true;
bool theCheckFlag = true; bool theCheckFlag = true;
bool onlyPageHeaders = false; bool onlyPageHeaders = false;
...@@ -208,7 +209,7 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read ...@@ -208,7 +209,7 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read
case ZPREP_OP_TYPE: case ZPREP_OP_TYPE:
poRecord = (PrepareOperationRecord *) redoLogPagePos; poRecord = (PrepareOperationRecord *) redoLogPagePos;
wordIndex += poRecord->getLogRecordSize(); wordIndex += poRecord->getLogRecordSize(PAGESIZE-wordIndex);
if (wordIndex <= PAGESIZE) { if (wordIndex <= PAGESIZE) {
if (thePrintFlag) ndbout << (*poRecord); if (thePrintFlag) ndbout << (*poRecord);
if (theCheckFlag) { if (theCheckFlag) {
...@@ -277,10 +278,9 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read ...@@ -277,10 +278,9 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read
ndbout << " ------ERROR: UNKNOWN RECORD TYPE------" << endl; ndbout << " ------ERROR: UNKNOWN RECORD TYPE------" << endl;
// Print out remaining data in this page // Print out remaining data in this page
for (int j = wordIndex; j < PAGESIZE; j++){ for (int k = wordIndex; k < PAGESIZE; k++){
Uint32 unknown = redoLogPage[i*PAGESIZE + j]; Uint32 unknown = redoLogPage[i*PAGESIZE + k];
ndbout_c("%-30d%-12u%-12x", k, unknown, unknown);
ndbout_c("%-30d%-12u%-12x", j, unknown, unknown);
} }
doExit(); doExit();
...@@ -289,8 +289,19 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read ...@@ -289,8 +289,19 @@ NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read
if (lastPage) if (lastPage)
{
if (theDumpFlag)
{
ndbout << " ------PAGE END: DUMPING REST OF PAGE------" << endl;
for (int k = wordIndex > PAGESIZE ? oldWordIndex : wordIndex;
k < PAGESIZE; k++)
{
Uint32 word = redoLogPage[i*PAGESIZE + k];
ndbout_c("%-30d%-12u%-12x", k, word, word);
}
}
break; break;
}
if (wordIndex > PAGESIZE) { if (wordIndex > PAGESIZE) {
words_from_previous_page = PAGESIZE - oldWordIndex; words_from_previous_page = PAGESIZE - oldWordIndex;
ndbout << " ----------- Record continues on next page -----------" << endl; ndbout << " ----------- Record continues on next page -----------" << endl;
...@@ -353,6 +364,8 @@ void readArguments(int argc, const char** argv) ...@@ -353,6 +364,8 @@ void readArguments(int argc, const char** argv)
{ {
if (strcmp(argv[i], "-noprint") == 0) { if (strcmp(argv[i], "-noprint") == 0) {
thePrintFlag = false; thePrintFlag = false;
} else if (strcmp(argv[i], "-dump") == 0) {
theDumpFlag = true;
} else if (strcmp(argv[i], "-nocheck") == 0) { } else if (strcmp(argv[i], "-nocheck") == 0) {
theCheckFlag = false; theCheckFlag = false;
} else if (strcmp(argv[i], "-mbyteheaders") == 0) { } else if (strcmp(argv[i], "-mbyteheaders") == 0) {
......
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