Skip to content

Commit 93d08b2

Browse files
committed
Correctly return number of proceed segments in cfs_gc_relation
1 parent b485470 commit 93d08b2

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/backend/storage/file/cfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ static bool cfs_gc_file(char* map_path, bool background)
928928
if (res != BLCKSZ)
929929
{
930930
pg_atomic_fetch_sub_u32(&map->lock, CFS_GC_LOCK); /* release lock */
931-
elog(ERROR, "Verification failed for block %d position %d size %d of relation %s: error code %d",
931+
pg_atomic_fetch_sub_u32(&cfs_state->n_active_gc, 1);
932+
elog(ERROR, "CFS: verification failed for block %d position %d size %d of relation %s: error code %d",
932933
i, (int)CFS_INODE_OFFS(inode), size, file_bck_path, (int)res);
933934
}
934935
}
@@ -1429,11 +1430,11 @@ Datum cfs_gc_relation(PG_FUNCTION_ARGS)
14291430
pfree(map_path);
14301431
relation_close(rel, AccessShareLock);
14311432

1432-
processed_segments -= cfs_gc_processed_segments;
1433+
processed_segments = cfs_gc_processed_segments - processed_segments;
14331434

14341435
LWLockRelease(CfsGcLock);
14351436
}
1436-
PG_RETURN_INT32(cfs_gc_processed_segments);
1437+
PG_RETURN_INT32(processed_segments);
14371438
}
14381439

14391440

src/backend/storage/file/fd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ FileRead(File file, char *buffer, int amount)
17701770
INIT_TRADITIONAL_CRC32(crc);
17711771
COMP_TRADITIONAL_CRC32(crc, compressedBuffer, amount);
17721772
FIN_TRADITIONAL_CRC32(crc);
1773-
elog(LOG, "Decompress error: %d for file %s block %u position %u compressed size %u crc %x",
1773+
elog(LOG, "CFS: decompress error: %d for file %s block %u position %u compressed size %u crc %x",
17741774
returnCode, VfdCache[file].fileName, (uint32)(VfdCache[file].seekPos / BLCKSZ), (uint32)seekPos, amount, crc);
17751775
VfdCache[file].seekPos = FileUnknownPos;
17761776
returnCode = -1;
@@ -2015,6 +2015,8 @@ FileWrite(File file, char *buffer, int amount)
20152015
*/
20162016
if ((int32)pos >= 0 && (int32)(pos + amount) < 0)
20172017
{
2018+
elog(LOG, "CFS: backend %d forced to performe GC on file %s block %u because it's size exceed %u bytes",
2019+
MyProcPid, VfdCache[file].fileName, (uint32)(VfdCache[file].seekPos / BLCKSZ), pos);
20182020
cfs_gc_segment(VfdCache[file].fileName);
20192021
}
20202022
}

src/include/storage/cfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "port/atomics.h"
77
#include "storage/rijndael.h"
88

9-
#define CFS_VERSION "0.25"
9+
#define CFS_VERSION "0.29"
1010

1111
#define CFS_GC_LOCK 0x10000000
1212

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy