Thread: int64 timestamp patch for contrib/pg_controldata
This small patch makes the pg_controldata display the enableIntTimes field of ControlFileData. ? int64-timestamp.patch ? make-install.out ? make.out ? pg_controldata Index: pg_controldata.c =================================================================== RCS file: /projects/cvsroot/pgsql/contrib/pg_controldata/pg_controldata.c,v retrieving revision 1.5 diff -u -3 -p -r1.5 pg_controldata.c --- pg_controldata.c 2001/10/25 05:49:19 1.5 +++ pg_controldata.c 2002/06/22 07:49:30 @@ -108,6 +108,7 @@ main(int argc, char *argv[]) "Time of latest checkpoint: %s\n" "Database block size: %u\n" "Blocks per segment of large relation: %u\n" + "Internal time format: %s\n" "LC_COLLATE: %s\n" "LC_CTYPE: %s\n", @@ -131,6 +132,7 @@ main(int argc, char *argv[]) ckpttime_str, ControlFile.blcksz, ControlFile.relseg_size, + ControlFile.enableIntTimes = TRUE ? "64 bits integer" : "8 bytes double", ControlFile.lc_collate, ControlFile.lc_ctype);
Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. --------------------------------------------------------------------------- sugita@sra.co.jp wrote: > This small patch makes the pg_controldata display the enableIntTimes field of > ControlFileData. > > ? int64-timestamp.patch > ? make-install.out > ? make.out > ? pg_controldata > Index: pg_controldata.c > =================================================================== > RCS file: /projects/cvsroot/pgsql/contrib/pg_controldata/pg_controldata.c,v > retrieving revision 1.5 > diff -u -3 -p -r1.5 pg_controldata.c > --- pg_controldata.c 2001/10/25 05:49:19 1.5 > +++ pg_controldata.c 2002/06/22 07:49:30 > @@ -108,6 +108,7 @@ main(int argc, char *argv[]) > "Time of latest checkpoint: %s\n" > "Database block size: %u\n" > "Blocks per segment of large relation: %u\n" > + "Internal time format: %s\n" > "LC_COLLATE: %s\n" > "LC_CTYPE: %s\n", > > @@ -131,6 +132,7 @@ main(int argc, char *argv[]) > ckpttime_str, > ControlFile.blcksz, > ControlFile.relseg_size, > + ControlFile.enableIntTimes = TRUE ? "64 bits integer" : "8 bytes double", > ControlFile.lc_collate, > ControlFile.lc_ctype); > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce, please do not apply this. I already have fixed up the program. Here is the cvs log entry: revision 1.6 date: 2002/07/05 15:31:16; author: thomas; state: Exp; lines: +10 -1 Add a few new lines to display recently added fields in the ControlFile structure. Now includes the following new fields: integer/float date/time storage maximum length of names (+1; they must also include a null termination) maximum number of function arguments maximum length of locale name Thanks Kenji for the patch though. Would you have a chance to look at the CVS version and see if it works the way you want? - Thomas
Thomas Lockhart <lockhart@fourpalms.org> writes: > Bruce, please do not apply this. I already have fixed up the program. I had a note that pg_resetxlog needs to be fixed as well; have you looked at that? regards, tom lane
> I had a note that pg_resetxlog needs to be fixed as well; have you > looked at that? Hmm. I was playing with it recently and did not notice a problem (but maybe didn't play long enough to see one if it existed). Why would the program need to be changed? Doesn't it use a common definition of the control file structure to do its thing? Does it read in the old one and modify it in place (which would mean new fields would be transparent) or does it pick up each field individually?? - Thomas
From: Thomas Lockhart <lockhart@fourpalms.org> Date: Tue, 30 Jul 2002 23:45:49 -0700 ;;; revision 1.6 ;;; date: 2002/07/05 15:31:16; author: thomas; state: Exp; lines: +10 -1 ;;; Add a few new lines to display recently added fields in the ControlFile ;;; structure. ;;; Now includes the following new fields: ;;; integer/float date/time storage ;;; maximum length of names (+1; they must also include a null termination) ;;; maximum number of function arguments ;;; maximum length of locale name ;;; ;;; Thanks Kenji for the patch though. Would you have a chance to look at ;;; the CVS version and see if it works the way you want? Yes, it does. I looked it just now. Kenji Sugita
> I had a note that pg_resetxlog needs to be fixed as well; have you > looked at that? Shouldn't pg_resetxlog and pg_controldata be brought into the main tree? They are admin utilities which seem to be done in a style which would fit in. Or is there another strategy for providing these capabilities coming Real Soon which would make these obsolete? It does look like pg_resetxlog needs to be fixed up, but only if controldata is lost as well as the WAL files. How dicy is it to guess at a proper controldata file? Seems that the locale settings etc are not reliably guessable from just the environment (no, there is no analogy with the other current Hot Topic ;) - Thomas
Thomas Lockhart <lockhart@fourpalms.org> writes: > Shouldn't pg_resetxlog and pg_controldata be brought into the main tree? Perhaps. At the time they were written they were just quick hacks for debugging, but we've seen them needed often enough that maybe they need to be promoted. > It does look like pg_resetxlog needs to be fixed up, but only if > controldata is lost as well as the WAL files. How dicy is it to guess at > a proper controldata file? Seems that the locale settings etc are not > reliably guessable from just the environment I think the right thing is to guess from resetxlog's own locale environment. Properly documented, that at least provides a way to recover --- if the admin screws up, well, not much we can do. The timestamp type can be guessed from whatever pg_config data is compiled into pg_resetxlog. regards, tom lane
> Perhaps. At the time they were written they were just quick hacks for > debugging, but we've seen them needed often enough that maybe they need > to be promoted. Yes. Bruce, do you want to do the honors? Should we consider renaming them at the time of the move? (probably not, but it is the right time to ask) > I think the right thing is to guess from resetxlog's own locale > environment. Properly documented, that at least provides a way to > recover --- if the admin screws up, well, not much we can do. > The timestamp type can be guessed from whatever pg_config data is > compiled into pg_resetxlog. Right. The locale guessing already happens as you suggest. - Thomas
This has already been applied by Thomas Lockhart. --------------------------------------------------------------------------- sugita@sra.co.jp wrote: > This small patch makes the pg_controldata display the enableIntTimes field of > ControlFileData. > > ? int64-timestamp.patch > ? make-install.out > ? make.out > ? pg_controldata > Index: pg_controldata.c > =================================================================== > RCS file: /projects/cvsroot/pgsql/contrib/pg_controldata/pg_controldata.c,v > retrieving revision 1.5 > diff -u -3 -p -r1.5 pg_controldata.c > --- pg_controldata.c 2001/10/25 05:49:19 1.5 > +++ pg_controldata.c 2002/06/22 07:49:30 > @@ -108,6 +108,7 @@ main(int argc, char *argv[]) > "Time of latest checkpoint: %s\n" > "Database block size: %u\n" > "Blocks per segment of large relation: %u\n" > + "Internal time format: %s\n" > "LC_COLLATE: %s\n" > "LC_CTYPE: %s\n", > > @@ -131,6 +132,7 @@ main(int argc, char *argv[]) > ckpttime_str, > ControlFile.blcksz, > ControlFile.relseg_size, > + ControlFile.enableIntTimes = TRUE ? "64 bits integer" : "8 bytes double", > ControlFile.lc_collate, > ControlFile.lc_ctype); > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Thomas Lockhart wrote: > > Perhaps. At the time they were written they were just quick hacks for > > debugging, but we've seen them needed often enough that maybe they need > > to be promoted. > > Yes. Bruce, do you want to do the honors? Should we consider renaming > them at the time of the move? (probably not, but it is the right time to > ask) I thought they were in /contrib because we didn't want them by default in the admin's path. They have to go looking for them to use them. Is that still a valid concern? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
... > I thought they were in /contrib because we didn't want them by default > in the admin's path. They have to go looking for them to use them. Is > that still a valid concern? May be a valid concern, but not the right solution. If we are that worried about misuse, then we should have them print a banner and prompt for confirmation. And have them accept a "-q" to just shut up and do it. - Thomas
Thomas Lockhart wrote: > ... > > I thought they were in /contrib because we didn't want them by default > > in the admin's path. They have to go looking for them to use them. Is > > that still a valid concern? > > May be a valid concern, but not the right solution. > > If we are that worried about misuse, then we should have them print a > banner and prompt for confirmation. And have them accept a "-q" to just > shut up and do it. OK, if you want it for 7.3, we need the flag added, and a manual page written about it. Should I add it to open items? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
... > OK, if you want it for 7.3, we need the flag added, and a manual page > written about it. Should I add it to open items? It might be faster for you to just do the changes ;) - Thomas
OK, I will put it on my list. --------------------------------------------------------------------------- Thomas Lockhart wrote: > ... > > OK, if you want it for 7.3, we need the flag added, and a manual page > > written about it. Should I add it to open items? > > It might be faster for you to just do the changes ;) > > - Thomas > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026