2017-03-29 Fred Gleason <fredg@paravelsystems.com>

* Modified rddbcheck(8) so as to process a --rehash command after
	the inexpensive checks.
This commit is contained in:
Fred Gleason
2017-03-29 14:30:08 -04:00
parent aeccd2600e
commit 4342ccd01e
3 changed files with 26 additions and 15 deletions

View File

@@ -15675,3 +15675,6 @@
* Added an 'RDRehash' class in 'lib/rdrehash.cpp' and 'lib/rdrehash.h'. * Added an 'RDRehash' class in 'lib/rdrehash.cpp' and 'lib/rdrehash.h'.
2017-03-29 Fred Gleason <fredg@paravelsystems.com> 2017-03-29 Fred Gleason <fredg@paravelsystems.com>
* Added a man page for rddbcheck(8). * Added a man page for rddbcheck(8).
2017-03-29 Fred Gleason <fredg@paravelsystems.com>
* Modified rddbcheck(8) so as to process a --rehash command after
the inexpensive checks.

View File

@@ -40,9 +40,10 @@
<command>rddbcheck</command><manvolnum>8</manvolnum> is a command-line <command>rddbcheck</command><manvolnum>8</manvolnum> is a command-line
tool for checking the consistency of a Rivendell database and (perhaps) tool for checking the consistency of a Rivendell database and (perhaps)
repairing any inconsistencies found. When invoked without any options, repairing any inconsistencies found. When invoked without any options,
<command>rddbcheck</command><manvolnum>8</manvolnum> will run all of the <command>rddbcheck</command><manvolnum>8</manvolnum> will run a set of
&quot;inexpensive&quot; consistency checks, report any problems found consistency checks (with the exception of the check of the SHA-1 hashes),
and offer to repair the problem. report any problems found and offer to repair the problem. To force a
SHA-1 hash check as well, see the <option>--rehash</option> option below.
</para> </para>
</refsect1> </refsect1>
@@ -90,8 +91,15 @@
</term> </term>
<listitem> <listitem>
<para> <para>
Run the <command>REHASH</command> check. The Generate SHA-1 hashes from the specified files in the audio store
<replaceable>target</replaceable> value can be one of the following: and validate them against the values stored in the database. This
is an inherently expensive operation that may require a
significant amount of time to complete as each audio
file to be checked must be opened and read in its entirety.
</para>
<para>
The <replaceable>target</replaceable> value can be one of the
following:
</para> </para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>

View File

@@ -174,14 +174,6 @@ MainObject::MainObject(QObject *parent)
delete q; delete q;
} }
//
// Rehash
//
if(!rehash.isEmpty()) {
Rehash(rehash);
exit(0);
}
// //
// Check for Orphaned Voice Tracks // Check for Orphaned Voice Tracks
// //
@@ -248,6 +240,15 @@ MainObject::MainObject(QObject *parent)
ValidateAudioLengths(); ValidateAudioLengths();
printf("done.\n\n"); printf("done.\n\n");
//
// Rehash
//
if(!rehash.isEmpty()) {
printf("Checking hashes...\n");
Rehash(rehash);
printf("done.\n\n");
}
exit(0); exit(0);
} }
@@ -505,7 +506,6 @@ void MainObject::CheckPendingCarts()
"(PENDING_STATION is not null)&&"+ "(PENDING_STATION is not null)&&"+
"(PENDING_DATETIME<\""+now.addDays(-1). "(PENDING_DATETIME<\""+now.addDays(-1).
toString("yyyy-MM-dd hh:mm:ss")+"\")"; toString("yyyy-MM-dd hh:mm:ss")+"\")";
printf("SQL: %s\n",(const char *)sql);
q=new QSqlQuery(sql); q=new QSqlQuery(sql);
while(q->next()) { while(q->next()) {
printf(" Cart %06u has stale reservation, delete cart(y/N)?", printf(" Cart %06u has stale reservation, delete cart(y/N)?",
@@ -764,7 +764,7 @@ void MainObject::RehashCut(const QString &cutnum)
else { else {
if(cut->sha1Hash()!=hash) { if(cut->sha1Hash()!=hash) {
RDCart *cart=new RDCart(RDCut::cartNumber(cutnum)); RDCart *cart=new RDCart(RDCut::cartNumber(cutnum));
printf(" Cut %d [%s] in cart %06u [%s] has inconsistent SHA1 hash. Correct? (y/N) ", printf(" Cut %d [%s] in cart %06u [%s] has inconsistent SHA1 hash. Fix? (y/N) ",
cut->cutNumber(), cut->cutNumber(),
(const char *)cut->description(), (const char *)cut->description(),
cart->number(), cart->number(),