'tchmgr inform' should warn about too large tch file if the LARGE option is not set
A frequent problem with .tch files is that the .tch file was created without the LARGE option and the database silently grows across the 2 GB limit. This is a simple patch so that at least 'tchmgr inform' shows a warning:
--- tchmgr.c.orig 2009-07-20 23:05:56.000000000 +0200
+++ tchmgr.c 2009-08-11 21:47:07.000000000 +0200
@@ -538,6 +538,7 @@ static int procinform(const char *path,
return 1;
}
bool err = false;
+ bool large = false;
const char *npath = tchdbpath(hdb);
if(!npath) npath = "(unknown)";
printf("path: %s\n", npath);
@@ -565,14 +566,19 @@ static int procinform(const char *path,
printf("modified time: %s\n", date);
uint8_t opts = tchdbopts(hdb);
printf(
- if(opts & HDBTLARGE) printf(" large");
+ if(opts & HDBTLARGE) {
+ printf(" large");
+ large = true;}
if(opts & HDBTDEFLATE) printf(" deflate");
if(opts & HDBTBZIP) printf(" bzip");
if(opts & HDBTTCBS) printf(" tcbs");
if(opts & HDBTEXCODEC) printf(" excodec");
printf("\n");
printf("record number: %llu\n", (unsigned long long)tchdbrnum(
- printf("file size: %llu\n", (unsigned long long)tchdbfsiz(
+ unsigned long long size = (unsigned long long) tchdbfsiz(hdb);
+ printf("file size: %llu\n", size);
+ if (!large && (size >= 2147483648))
+ printf("WARNING: file size too large for a database without LARGE option\n");
if(!
if(!err) printerr(hdb);
err = true;
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: