summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-30 22:33:02 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-30 22:40:20 +0100
commit16d003d939feaed90b3533d0b974f02b9c706233 (patch)
treec25595158b6c9484359597b54ef237ef7a41b368
parentca71cc7875c300a9c519380b128dd812b86df25e (diff)
downloadsink-16d003d939feaed90b3533d0b974f02b9c706233.tar.gz
sink-16d003d939feaed90b3533d0b974f02b9c706233.zip
Optional printing of transaction span
-rw-r--r--common/storage.h2
-rw-r--r--common/storage_lmdb.cpp20
2 files changed, 12 insertions, 10 deletions
diff --git a/common/storage.h b/common/storage.h
index f5f1879..5a4fb45 100644
--- a/common/storage.h
+++ b/common/storage.h
@@ -167,7 +167,7 @@ public:
167 NamedDatabase::Stat mainDbStat; 167 NamedDatabase::Stat mainDbStat;
168 NamedDatabase::Stat freeDbStat; 168 NamedDatabase::Stat freeDbStat;
169 }; 169 };
170 Stat stat(); 170 Stat stat(bool printDetails = true);
171 171
172 private: 172 private:
173 Transaction(Transaction &other); 173 Transaction(Transaction &other);
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index 514a4ea..4e7f322 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -732,7 +732,7 @@ QList<QByteArray> DataStore::Transaction::getDatabaseNames() const
732} 732}
733 733
734 734
735DataStore::Transaction::Stat DataStore::Transaction::stat() 735DataStore::Transaction::Stat DataStore::Transaction::stat(bool printDetails)
736{ 736{
737 const int freeDbi = 0; 737 const int freeDbi = 0;
738 const int mainDbi = 1; 738 const int mainDbi = 1;
@@ -779,14 +779,16 @@ DataStore::Transaction::Stat DataStore::Transaction::stat()
779 pg += span; 779 pg += span;
780 for (; i >= span && iptr[i-span] == pg; span++, pg++) ; 780 for (; i >= span && iptr[i-span] == pg; span++, pg++) ;
781 } 781 }
782 std::cout << " Transaction " << *(size_t *)key.mv_data << ", "<< j << " pages, maxspan " << span << (bad ? " [bad sequence]" : "") << std::endl; 782 if (printDetails) {
783 for (--j; j >= 0; ) { 783 std::cout << " Transaction " << *(size_t *)key.mv_data << ", "<< j << " pages, maxspan " << span << (bad ? " [bad sequence]" : "") << std::endl;
784 pg = iptr[j]; 784 for (--j; j >= 0; ) {
785 for (span=1; --j >= 0 && iptr[j] == pg+span; span++); 785 pg = iptr[j];
786 if (span > 1) { 786 for (span=1; --j >= 0 && iptr[j] == pg+span; span++);
787 std::cout << " " << pg << "[" << span << "]\n"; 787 if (span > 1) {
788 } else { 788 std::cout << " " << pg << "[" << span << "]\n";
789 std::cout << " " << pg << std::endl; 789 } else {
790 std::cout << " " << pg << std::endl;
791 }
790 } 792 }
791 } 793 }
792 } 794 }