(path string, pageId uint64)
| 123 | } |
| 124 | |
| 125 | func clearFreelistInMetaPage(path string, pageId uint64) error { |
| 126 | _, buf, err := guts_cli.ReadPage(path, pageId) |
| 127 | if err != nil { |
| 128 | return fmt.Errorf("ReadPage %d failed: %w", pageId, err) |
| 129 | } |
| 130 | |
| 131 | meta := common.LoadPageMeta(buf) |
| 132 | meta.SetFreelist(common.PgidNoFreelist) |
| 133 | meta.SetChecksum(meta.Sum64()) |
| 134 | |
| 135 | if err := guts_cli.WritePage(path, buf); err != nil { |
| 136 | return fmt.Errorf("WritePage %d failed: %w", pageId, err) |
| 137 | } |
| 138 | |
| 139 | return nil |
| 140 | } |
| 141 | |
| 142 | // RevertMetaPage replaces the newer metadata page with the older. |
| 143 | // It usually means that one transaction is being lost. But frequently |
no test coverage detected