1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchlib/docstore/logdatastore.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/nosyncproxy.h>
#include <vespa/fastos/app.h>
#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
using namespace search;
class VerifyLogDataStoreApp : public FastOS_Application
{
void usage();
int verify(const vespalib::string & directory);
int Main() override;
};
void
VerifyLogDataStoreApp::usage()
{
printf("Usage: %s <direcory>\n", _argv[0]);
fflush(stdout);
}
int
VerifyLogDataStoreApp::Main()
{
if (_argc >= 2) {
vespalib::string directory(_argv[1]);
return verify(directory);
} else {
fprintf(stderr, "Too few arguments\n");
usage();
return 1;
}
return 0;
}
int
VerifyLogDataStoreApp::verify(const vespalib::string & dir)
{
int retval(0);
LogDataStore::Config config;
GrowStrategy growStrategy;
TuneFileSummary tuning;
search::index::DummyFileHeaderContext fileHeaderContext;
vespalib::ThreadStackExecutor executor(config.getNumThreads(), 128*1024);
transactionlog::NoSyncProxy noTlSyncer;
try {
LogDataStore store(executor, dir, config, growStrategy, tuning,
fileHeaderContext,
noTlSyncer, NULL, true);
store.verify(false);
} catch (const vespalib::Exception & e) {
fprintf(stderr, "Got exception: %s", e.what());
retval = 1;
}
return retval;
}
FASTOS_MAIN(VerifyLogDataStoreApp);
|