Thread: Microvacuum for gist. Question about GISTPageOpaqueData flag
Hi,
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples */
I'm working on microvacuum for gist access method.
Briefly microvacuum includes two steps:
1. When search tells us that the tuple is invisible to all transactions it is marked LP_DEAD and page is marked as "has dead tuples",
2. Then, when insert touches full page which has dead tuples it calls microvacuum instead of splitting page.
You can find a kind of review here [1].
While writing patch, I found strange GISTPageOpaqueData flag - F_TUPLES_DELETED.
Its description looks like it is the same for BTP_HAS_GARBAGE
#define F_TUPLES_DELETED (1 << 2) /* some tuples on the page are dead */
But it's definitely not the same things. I found only two mentions of this flag.
Function GistMarkTuplesDeleted sets the flag after dead tuples deletion.
Do anyone need it at all? I found no place where this flag is checked.
Is it correct using of the flag?
I need an advice, what would be better:
- to add new flag like F_HAS_GARBAGE,
- or to delete all mentions of F_TUPLES_DELETED and use it in gist microvacuum.
[1] http://www.google-melange.com/gsoc/proposal/public/google/gsoc2015/ivanitskiy_ilya/5629499534213120
--
Best regards,
Lubennikova Anastasia
> I need an advice, what would be better: > - to add new flag like F_HAS_GARBAGE, > - or to delete all mentions of F_TUPLES_DELETED and use it in gist microvacuum. According to commit message: commit 2effb72e682a7dbdc9a8a60a80c22ec1fa9d8079 Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Date: Fri Nov 7 15:03:46 2014 +0200 .. The code that generated a record to clear the F_TUPLES_DELETED flag hasn't existed since we got rid of old-styleVACUUM FULL. I kept the code that sets the flag, although it's not used for anything anymore, because it might still be interesting information for debugging purposes that some tuples have been deleted from a page. .. If Heikki doesn't change his opinion then introduce new flag. Although I don't think that we need to keep F_TUPLES_DELETED. Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/
On 07/27/2015 06:46 PM, Teodor Sigaev wrote: >> I need an advice, what would be better: >> - to add new flag like F_HAS_GARBAGE, >> - or to delete all mentions of F_TUPLES_DELETED and use it in gist microvacuum. > > According to commit message: > commit 2effb72e682a7dbdc9a8a60a80c22ec1fa9d8079 > Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> > Date: Fri Nov 7 15:03:46 2014 +0200 > .. > The code that generated a record to clear the F_TUPLES_DELETED flag hasn't > existed since we got rid of old-style VACUUM FULL. I kept the code that sets > the flag, although it's not used for anything anymore, because it might > still be interesting information for debugging purposes that some tuples > have been deleted from a page. > .. > > If Heikki doesn't change his opinion then introduce new flag. Although I don't > think that we need to keep F_TUPLES_DELETED. It's certainly not needed for anything at the moment, although conceivably we might reintroduce code that needs it in the future. There are plenty of flag bits available, so let's use a new flag. If there was a shortage, I wouldn't blink reusing F_TUPLES_DELETED. - Heikki
2015-07-27 20:05 GMT+04:00 Heikki Linnakangas <hlinnaka@iki.fi>:
On 07/27/2015 06:46 PM, Teodor Sigaev wrote:I need an advice, what would be better:
- to add new flag like F_HAS_GARBAGE,
- or to delete all mentions of F_TUPLES_DELETED and use it in gist microvacuum.
According to commit message:
commit 2effb72e682a7dbdc9a8a60a80c22ec1fa9d8079
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri Nov 7 15:03:46 2014 +0200
..
The code that generated a record to clear the F_TUPLES_DELETED flag hasn't
existed since we got rid of old-style VACUUM FULL. I kept the code that sets
the flag, although it's not used for anything anymore, because it might
still be interesting information for debugging purposes that some tuples
have been deleted from a page.
..
If Heikki doesn't change his opinion then introduce new flag. Although I don't
think that we need to keep F_TUPLES_DELETED.
It's certainly not needed for anything at the moment, although conceivably we might reintroduce code that needs it in the future. There are plenty of flag bits available, so let's use a new flag. If there was a shortage, I wouldn't blink reusing F_TUPLES_DELETED.
- Heikki
Thanks for the quick reply
Best regards,
Lubennikova Anastasia