Petr Onderka has uploaded a new change for review.
https://gerrit.wikimedia.org/r/85879
Change subject: Fixed bugs that manifested for diff current dumps
......................................................................
Fixed bugs that manifested for diff current dumps
Change-Id: Id4b020505d73e63c7f65f8c278b492b13551428b
---
M Diff/Changes/DeleteRevisionChange.h
M DumpObjects/TextGroup.cpp
M DumpObjects/TextGroup.h
M TextGroupsManager.cpp
4 files changed, 14 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/dumps/incremental
refs/changes/79/85879/1
diff --git a/Diff/Changes/DeleteRevisionChange.h
b/Diff/Changes/DeleteRevisionChange.h
index 9f0c157..0ff300b 100644
--- a/Diff/Changes/DeleteRevisionChange.h
+++ b/Diff/Changes/DeleteRevisionChange.h
@@ -5,7 +5,7 @@
/**
* A change that represents deleting a revision.
*
- * In the (probably impossible) case when a revision is deleted but its page
isn't,
+ * In the case when a revision is deleted but its page isn't,
* this change has to follow the corresponding page change.
*/
class DeleteRevisionChange : public Change
diff --git a/DumpObjects/TextGroup.cpp b/DumpObjects/TextGroup.cpp
index bf7372f..8c09d73 100644
--- a/DumpObjects/TextGroup.cpp
+++ b/DumpObjects/TextGroup.cpp
@@ -34,15 +34,13 @@
}
else
{
- texts = Read(revisionOffset);
-
+ texts = Read(revisionOffset, savedLength);
savedOffset = revisionOffset.value;
- savedLength = NewLength();
isEditable = false;
}
}
-std::vector<std::string> TextGroup::Read(Offset offset)
+std::vector<std::string> TextGroup::Read(Offset offset, std::uint32_t& length)
{
auto &stream = *(dump.lock()->stream);
stream.seekp(offset.value);
@@ -57,6 +55,9 @@
auto compressed = DumpTraits<std::string>::ReadLong(stream);
auto textsString = SevenZip::Decompress(compressed);
+
+ length = (std::uint64_t)stream.tellp() - offset.value;
+
return split(textsString, '\0');
}
diff --git a/DumpObjects/TextGroup.h b/DumpObjects/TextGroup.h
index 41bd1e4..66ea643 100644
--- a/DumpObjects/TextGroup.h
+++ b/DumpObjects/TextGroup.h
@@ -25,7 +25,7 @@
void EnsureCompressed();
void Load();
- std::vector<std::string> Read(Offset offset);
+ std::vector<std::string> Read(Offset offset, std::uint32_t& length);
bool IsEmpty() const;
diff --git a/TextGroupsManager.cpp b/TextGroupsManager.cpp
index 02ace26..e1b9229 100644
--- a/TextGroupsManager.cpp
+++ b/TextGroupsManager.cpp
@@ -37,11 +37,16 @@
void TextGroupsManager::EndGroup(DiffWriter* diffWriter)
{
+ if (currentGroup == nullptr)
+ return;
+
if (textGroupModified)
+ {
currentGroup->Write();
- if (diffWriter != nullptr)
- diffWriter->SetTextGroup(currentGroup->GetCompressedTexts());
+ if (diffWriter != nullptr)
+ diffWriter->SetTextGroup(currentGroup->GetCompressedTexts());
+ }
currentGroup = nullptr;
textGroupModified = false;
--
To view, visit https://gerrit.wikimedia.org/r/85879
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4b020505d73e63c7f65f8c278b492b13551428b
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps/incremental
Gerrit-Branch: gsoc
Gerrit-Owner: Petr Onderka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits