summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/tier.h
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-10-14 00:00:41 +0530
committerDan Lambright <dlambrig@redhat.com>2015-11-06 10:30:45 -0800
commit1d0402b25aa24e2076fb79cbeb4ba3ed3a9f3ede (patch)
treed40956ee33092f5be50cbd108cf9a31440aad64b /xlators/cluster/dht/src/tier.h
parentd51a33bae02245f8538c62b564f3fef49820790e (diff)
tier/libgfdb: Replacing ASCII query file with binary
Earlier, when the database was queried we used to save all the queried records in an ASCII format in the query file. This caused issues like filename having ASCII delimiter and used to take a lot of space. The tier.c file also had a lot of parsing code. Here we changed the format of the query file to binary. All the logic of serialization and formating of query record is done by libgfdb. Libgfdb provides API, gfdb_write_query_record() and gfdb_read_query_record(), which the user i.e tier migrator and CTR xlator can use to write to and read from query file. With this binary format we save on disk space i.e reduce to 50% atleast as we are saving GFID's in binary format 16 bytes and not the string format which takes 36 bytes + We are not saving path of the file + we are also saving on ASCII delimiters. The on disk format of query record is as follows, +---------------------------------------------------------------------------+ | Length of serialized query record | Serialized Query Record | +---------------------------------------------------------------------------+ 4 bytes Length of serialized query record | | -------------------------------------------------| | | V Serialized Query Record Format: +---------------------------------------------------------------------------+ | GFID | Link count | <LINK INFO> |..... | FOOTER | +---------------------------------------------------------------------------+ 16 B 4 B Link Length 4 B | | | | -----------------------------| | | | | | V | Each <Link Info> will be serialized as | +-----------------------------------------------+ | | PGID | BASE_NAME_LENGTH | BASE_NAME | | +-----------------------------------------------+ | 16 B 4 B BASE_NAME_LENGTH | | | ------------------------------------------------------------------------| | | V FOOTER is a magic number 0xBAADF00D indicating the end of the record. This also serves as a serialized schema validator. Change-Id: I9db7416fd421e118dd44eafab8b535caafe50d5a BUG: 1272207 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/12354 Reviewed-by: N Balachandran <nbalacha@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/tier.h')
-rw-r--r--xlators/cluster/dht/src/tier.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/tier.h b/xlators/cluster/dht/src/tier.h
index 18ca3269f8b..0f8107924ea 100644
--- a/xlators/cluster/dht/src/tier.h
+++ b/xlators/cluster/dht/src/tier.h
@@ -39,18 +39,18 @@
typedef struct _query_cbk_args {
xlator_t *this;
gf_defrag_info_t *defrag;
- FILE *queryFILE;
+ int query_fd;
int is_promotion;
} query_cbk_args_t;
int
gf_run_tier(xlator_t *this, gf_defrag_info_t *defrag);
-typedef struct _gfdb_brick_dict_info {
+typedef struct gfdb_brick_info {
gfdb_time_t *time_stamp;
gf_boolean_t _gfdb_promote;
query_cbk_args_t *_query_cbk_args;
-} _gfdb_brick_dict_info_t;
+} gfdb_brick_info_t;
typedef struct brick_list {
xlator_t *xlator;