diff --git a/CHANGELOG b/CHANGELOG index f83650bafe..25da7354cb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ v2.2.0 (XXXX-XX-XX) ------------------- +* fixed datafile debugger + * fixed check-version for empty directory * moved try/catch block to the top of routing chain diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 49bae9d4a7..b83ef81d4d 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -6016,6 +6016,7 @@ static v8::Handle JS_DatafileScanVocbaseCol (v8::Arguments const& arg o->Set(v8::String::New("position"), v8::Number::New(entry->_position)); o->Set(v8::String::New("size"), v8::Number::New(entry->_size)); + o->Set(v8::String::New("realSize"), v8::Number::New(entry->_realSize)); o->Set(v8::String::New("tick"), V8TickId(entry->_tick)); o->Set(v8::String::New("type"), v8::Number::New((int) entry->_type)); o->Set(v8::String::New("status"), v8::Number::New((int) entry->_status)); diff --git a/arangod/VocBase/datafile.cpp b/arangod/VocBase/datafile.cpp index 7732240db1..abb80855f0 100644 --- a/arangod/VocBase/datafile.cpp +++ b/arangod/VocBase/datafile.cpp @@ -443,6 +443,7 @@ static TRI_df_scan_t ScanDatafile (TRI_datafile_t const* datafile) { entry._position = (TRI_voc_size_t) (ptr - datafile->_data); entry._size = marker->_size; + entry._realSize = TRI_DF_ALIGN_BLOCK(marker->_size); entry._tick = marker->_tick; entry._type = marker->_type; entry._status = 1; diff --git a/arangod/VocBase/datafile.h b/arangod/VocBase/datafile.h index 53fc59f984..9f355e1937 100644 --- a/arangod/VocBase/datafile.h +++ b/arangod/VocBase/datafile.h @@ -220,11 +220,19 @@ TRI_df_scan_t; //////////////////////////////////////////////////////////////////////////////// /// @brief scan result entry +/// +/// status: +/// 1 - entry ok +/// 2 - empty entry +/// 3 - empty size +/// 4 - size too small +/// 5 - CRC failed //////////////////////////////////////////////////////////////////////////////// typedef struct TRI_df_scan_entry_s { TRI_voc_size_t _position; TRI_voc_size_t _size; + TRI_voc_size_t _realSize; TRI_voc_tick_t _tick; TRI_df_marker_type_t _type; diff --git a/js/server/arango-dfdb.js b/js/server/arango-dfdb.js index 99713d8280..f8fa8887ee 100644 --- a/js/server/arango-dfdb.js +++ b/js/server/arango-dfdb.js @@ -138,7 +138,7 @@ function QueryWipeDatafile (collection, type, datafile, scan, lastGoodPos) { var entry = entries[lastGoodPos]; - WipeDatafile(collection, type, datafile, entry.position + entry.size); + WipeDatafile(collection, type, datafile, entry.position + entry.realSize); } //////////////////////////////////////////////////////////////////////////////// @@ -180,7 +180,7 @@ function PrintEntries (entries, amount) { case 5: s = "FAILED (crc mismatch)"; break; } - printf(" %d: status %s type %d size %d, tick %s\n", i, s, entry.type, entry.size, entry.tick); + printf(" %d: status %s type %d size %d, tick %s\n", i, s, entry.type, entry.realSize, entry.tick); } } @@ -210,7 +210,7 @@ function DeepCheckDatafile (collection, type, datafile, scan) { } if (! stillGood) { - printf(" Last good position: %d\n", lastGood.position + lastGood.size); + printf(" Last good position: %d\n", lastGood.position + lastGood.realSize); printf("\n"); QueryWipeDatafile(collection, type, datafile, scan, lastGoodPos); @@ -256,7 +256,7 @@ function CheckDatafile (collection, type, datafile, issues, details) { break; case 3: - statusMessage = "FATAL (reached corrupt marker)"; + statusMessage = "FATAL (reached corrupted marker)"; color = internal.COLORS.COLOR_RED; break; @@ -537,8 +537,10 @@ function main (argv) { printf("Prints details (Y/N)? "); var details = false; + while (true) { line = console.getline(); + if (line === "") { printf("Exiting. Please wait.\n"); return; @@ -547,6 +549,7 @@ function main (argv) { if (line === "yes" || line === "YES" || line === "y" || line === "Y") { details = true; } + break; }