@@ -636,7 +636,7 @@ Result DumpFeature::runDump(httpclient::SimpleHttpClient& client,
636
636
if (!collections.isArray ()) {
637
637
return ::ErrorMalformedJsonResponse;
638
638
}
639
-
639
+
640
640
// get the view list
641
641
VPackSlice views = body.get (" views" );
642
642
if (!views.isArray ()) {
@@ -648,7 +648,7 @@ Result DumpFeature::runDump(httpclient::SimpleHttpClient& client,
648
648
if (res.fail ()) {
649
649
return res;
650
650
}
651
-
651
+
652
652
// Step 2. Store view definition files
653
653
res = storeViews (views);
654
654
if (res.fail ()) {
@@ -712,7 +712,7 @@ Result DumpFeature::runDump(httpclient::SimpleHttpClient& client,
712
712
std::to_string (cid), name, collectionType);
713
713
_clientTaskQueue.queueJob (std::move (jobData));
714
714
}
715
-
715
+
716
716
// wait for all jobs to finish, then check for errors
717
717
_clientTaskQueue.waitForIdle ();
718
718
{
@@ -756,19 +756,19 @@ Result DumpFeature::runClusterDump(httpclient::SimpleHttpClient& client,
756
756
if (!collections.isArray ()) {
757
757
return ::ErrorMalformedJsonResponse;
758
758
}
759
-
759
+
760
760
// get the view list
761
761
VPackSlice views = body.get (" views" );
762
762
if (!views.isArray ()) {
763
763
views = VPackSlice::emptyArraySlice ();
764
764
}
765
-
765
+
766
766
// Step 1. Store view definition files
767
767
Result res = storeDumpJson (body, dbname);
768
768
if (res.fail ()) {
769
769
return res;
770
770
}
771
-
771
+
772
772
// Step 2. Store view definition files
773
773
res = storeViews (views);
774
774
if (res.fail ()) {
@@ -863,10 +863,10 @@ Result DumpFeature::runClusterDump(httpclient::SimpleHttpClient& client,
863
863
864
864
return {TRI_ERROR_NO_ERROR};
865
865
}
866
-
866
+
867
867
Result DumpFeature::storeDumpJson (VPackSlice const & body,
868
868
std::string const & dbName) const {
869
-
869
+
870
870
// read the server's max tick value
871
871
std::string const tickString =
872
872
basics::VelocyPackHelper::getStringValue (body, " tick" , " " );
@@ -875,27 +875,20 @@ Result DumpFeature::storeDumpJson(VPackSlice const& body,
875
875
}
876
876
LOG_TOPIC (INFO, Logger::DUMP)
877
877
<< " Last tick provided by server is: " << tickString;
878
-
879
- // set the local max tick value
880
- uint64_t maxTick = basics::StringUtils::uint64 (tickString);
881
- // check if the user specified a max tick value
882
- if (_options.tickEnd > 0 && maxTick > _options.tickEnd ) {
883
- maxTick = _options.tickEnd ;
884
- }
885
-
878
+
886
879
try {
887
880
VPackBuilder meta;
888
881
meta.openObject ();
889
882
meta.add (" database" , VPackValue (dbName));
890
883
meta.add (" lastTickAtDumpStart" , VPackValue (tickString));
891
884
meta.close ();
892
-
885
+
893
886
// save last tick in file
894
887
auto file = _directory->writableFile (" dump.json" , true );
895
888
if (!::fileOk (file.get ())) {
896
889
return ::fileError (file.get (), true );
897
890
}
898
-
891
+
899
892
std::string const metaString = meta.slice ().toJson ();
900
893
file->write (metaString.c_str (), metaString.size ());
901
894
if (file->status ().fail ()) {
@@ -910,14 +903,14 @@ Result DumpFeature::storeDumpJson(VPackSlice const& body,
910
903
}
911
904
return {};
912
905
}
913
-
906
+
914
907
Result DumpFeature::storeViews (VPackSlice const & views) const {
915
908
for (VPackSlice view : VPackArrayIterator (views)) {
916
909
auto nameSlice = view.get (StaticStrings::DataSourceName);
917
910
if (!nameSlice.isString () || nameSlice.getStringLength () == 0 ) {
918
911
continue ; // ignore
919
912
}
920
-
913
+
921
914
try {
922
915
std::string fname = nameSlice.copyString ();
923
916
fname.append (" .view.json" );
@@ -926,7 +919,7 @@ Result DumpFeature::storeViews(VPackSlice const& views) const {
926
919
if (!::fileOk (file.get ())) {
927
920
return ::fileError (file.get (), true );
928
921
}
929
-
922
+
930
923
std::string const viewString = view.toJson ();
931
924
file->write (viewString.c_str (), viewString.size ());
932
925
if (file->status ().fail ()) {
0 commit comments