[Groonga-commit] pgroonga/pgroonga at 2f42a73 [master] Fix too large page special size

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Oct 29 00:47:25 JST 2016


Kouhei Sutou	2016-10-29 00:47:25 +0900 (Sat, 29 Oct 2016)

  New Revision: 2f42a736d12693764efd6fb35eee2d423206cd07
  https://github.com/pgroonga/pgroonga/commit/2f42a736d12693764efd6fb35eee2d423206cd07

  Message:
    Fix too large page special size

  Modified files:
    src/pgrn_wal.c

  Modified: src/pgrn_wal.c (+3 -4)
===================================================================
--- src/pgrn_wal.c    2016-10-29 00:07:55 +0900 (2f88567)
+++ src/pgrn_wal.c    2016-10-29 00:47:25 +0900 (9257d9b)
@@ -55,7 +55,8 @@ typedef struct {
 	BlockNumber end;
 } PGrnMetaPageSpecial;
 
-#define PGRN_PAGE_DATA_SIZE BLCKSZ - SizeOfPageHeaderData - sizeof(OffsetNumber)
+#define PGRN_PAGE_DATA_SIZE										\
+	(BLCKSZ - SizeOfPageHeaderData - sizeof(OffsetNumber) - 1)
 typedef struct {
 	OffsetNumber current;
 	uint8_t data[PGRN_PAGE_DATA_SIZE];
@@ -287,7 +288,6 @@ PGrnWALPageWriter(void *userData,
 		if (data->current.pageSpecial->current + length <= PGRN_PAGE_DATA_SIZE)
 		{
 			memcpy(data->current.pageSpecial->data +
-				   SizeOfPageHeaderData +
 				   data->current.pageSpecial->current,
 				   buffer,
 				   length);
@@ -304,7 +304,6 @@ PGrnWALPageWriter(void *userData,
 			writableSize =
 				PGRN_PAGE_DATA_SIZE - data->current.pageSpecial->current;
 			memcpy(data->current.pageSpecial->data +
-				   SizeOfPageHeaderData +
 				   data->current.pageSpecial->current,
 				   buffer,
 				   writableSize);
@@ -1228,7 +1227,7 @@ PGrnWALApplyConsume(PGrnWALApplyData *data)
 		dataSize = pageSpecial->current - data->current.offset;
 		msgpack_unpacker_reserve_buffer(&unpacker, dataSize);
 		memcpy(msgpack_unpacker_buffer(&unpacker),
-			   pageSpecial->data + SizeOfPageHeaderData + data->current.offset,
+			   pageSpecial->data + data->current.offset,
 			   dataSize);
 		UnlockReleaseBuffer(buffer);
 		data->current.offset = 0;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index