Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
211ed366
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
211ed366
编写于
11月 17, 1999
作者:
J
Jan Wieck
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some minor corrections to the LZ compression. In fact I wanted to
HAVE the required OID's first. Jan
上级
79c3b71c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
13 deletion
+49
-13
src/backend/utils/adt/lztext.c
src/backend/utils/adt/lztext.c
+15
-10
src/backend/utils/adt/pg_lzcompress.c
src/backend/utils/adt/pg_lzcompress.c
+5
-1
src/include/utils/pg_lzcompress.h
src/include/utils/pg_lzcompress.h
+29
-2
未找到文件。
src/backend/utils/adt/lztext.c
浏览文件 @
211ed366
/* ----------
* lztext.c -
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/lztext.c,v 1.
1 1999/11/17 21:21:50
wieck Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/lztext.c,v 1.
2 1999/11/17 22:18:45
wieck Exp $
*
* Text type with internal LZ compressed representation. Uses the
* standard PostgreSQL compression method.
*
* This code requires that the LZ compressor found in pg_lzcompress
* codes a usable VARSIZE word at the beginning of the output buffer.
* ----------
*/
...
...
@@ -42,7 +45,7 @@ lztextin(char *str)
return
NULL
;
/* ----------
* Determine input size and
eventually tuple
size
* Determine input size and
maximum output Datum
size
* ----------
*/
rawsize
=
strlen
(
str
);
...
...
@@ -56,8 +59,9 @@ lztextin(char *str)
pglz_compress
(
str
,
rawsize
,
tmp
,
NULL
);
/* ----------
* If we miss less than x% bytes at the end of the temp value,
* so be it. Therefore we save a memcpy().
* If we miss less than 25% bytes at the end of the temp value,
* so be it. Therefore we save a palloc()/memcpy()/pfree()
* sequence.
* ----------
*/
if
(
tmp_size
-
tmp
->
varsize
<
256
||
...
...
@@ -141,7 +145,7 @@ lztextlen(lztext *lz)
* without multibyte support, it's the remembered rawsize
* ----------
*/
return
lz
->
rawsize
;
return
PGLZ_RAW_SIZE
(
lz
)
;
}
...
...
@@ -166,7 +170,7 @@ lztextoctetlen(lztext *lz)
* Return the varsize minus the VARSIZE field itself.
* ----------
*/
return
lz
->
varsize
-
sizeof
(
int32
)
;
return
VARSIZE
(
lz
)
-
VARHDRSZ
;
}
...
...
@@ -208,8 +212,9 @@ text_lztext(text *txt)
pglz_compress
(
str
,
rawsize
,
tmp
,
NULL
);
/* ----------
* If we miss less than x% bytes at the end of the temp value,
* so be it. Therefore we save a memcpy().
* If we miss less than 25% bytes at the end of the temp value,
* so be it. Therefore we save a palloc()/memcpy()/pfree()
* sequence.
* ----------
*/
if
(
tmp_size
-
tmp
->
varsize
<
256
||
...
...
@@ -250,15 +255,15 @@ lztext_text(lztext *lz)
* Allocate and initialize the text result
* ----------
*/
result
=
(
text
*
)
palloc
(
lz
->
rawsize
+
VARHDRSZ
+
1
);
result
=
(
text
*
)
palloc
(
PGLZ_RAW_SIZE
(
lz
)
+
VARHDRSZ
+
1
);
VARSIZE
(
result
)
=
lz
->
rawsize
+
VARHDRSZ
;
/* ----------
* Decompress directly into the text data area.
* ----------
*/
pglz_decompress
(
lz
,
VARDATA
(
result
));
VARDATA
(
result
)[
lz
->
rawsize
]
=
0
;
pglz_decompress
(
lz
,
VARDATA
(
result
));
return
result
;
}
...
...
src/backend/utils/adt/pg_lzcompress.c
浏览文件 @
211ed366
/* ----------
* pg_lzcompress.c -
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.
1 1999/11/17 21:21:50
wieck Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.
2 1999/11/17 22:18:45
wieck Exp $
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
...
...
@@ -385,6 +385,8 @@ pglz_find_match (PGLZ_HistEntry **hstart, char *input, char *end,
/* ----------
* pglz_compress -
*
* Compresses source into dest using strategy.
* ----------
*/
int
...
...
@@ -580,6 +582,8 @@ pglz_compress (char *source, int slen, PGLZ_Header *dest, PGLZ_Strategy *strateg
/* ----------
* pglz_decompress -
*
* Decompresses source into dest.
* ----------
*/
int
...
...
src/include/utils/pg_lzcompress.h
浏览文件 @
211ed366
/* ----------
* pg_lzcompress.h -
*
* $Header: /cvsroot/pgsql/src/include/utils/pg_lzcompress.h,v 1.
1 1999/11/17 21:21:51
wieck Exp $
* $Header: /cvsroot/pgsql/src/include/utils/pg_lzcompress.h,v 1.
2 1999/11/17 22:18:46
wieck Exp $
*
* Definitions for the builtin LZ compressor
* ----------
...
...
@@ -37,9 +37,36 @@ typedef struct PGLZ_Header {
*/
#define PGLZ_MAX_OUTPUT(_dlen) ((_dlen) + (((_dlen) | 0x07) >> 3) \
+ sizeof(PGLZ_Header))
/* ----------
* PGLZ_RAW_SIZE -
*
* Macro to determine the uncompressed data size contained
* in the entry.
* ----------
*/
#define PGLZ_RAW_SIZE(_lzdata) (_lzdata->rawsize)
/* ----------
* PGLZ_IS_COMPRESSED -
*
* Macro to determine if the data itself is stored as raw
* uncompressed data.
* ----------
*/
#define PGLZ_IS_COMPRESSED(_lzdata) (_lzdata->varsize != \
_lzdata->rawsize + sizeof(PGLZ_Header))
_lzdata->rawsize + \
sizeof(PGLZ_Header))
/* ----------
* PGLZ_RAW_DATA -
*
* Macro to get access to the plain compressed or uncompressed
* data. Useful if PGLZ_IS_COMPRESSED returns false.
* ----------
*/
#define PGLZ_RAW_DATA(_lzdata) (((char *)(_lzdata)) + \
sizeof(PGLZ_Header))
/* ----------
* PGLZ_Strategy -
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录