GithubHelp home page GithubHelp logo

alibaba / tfs Goto Github PK

View Code? Open in Web Editor NEW
1.2K 156.0 457.0 1.56 MB

TFS (Taobao File System) is a distributed file system similar to GFS.

Home Page: http://tfs.taobao.org

License: GNU General Public License v2.0

Shell 1.32% C++ 88.69% C 6.83% PHP 0.10% Perl 0.02% Java 3.03%

tfs's Introduction

Welcome to TFS!

TFS is a distributed file system developed by Taobao.com.

Overview

Aiming at a distributed file system with high availability, high performance and low cost, TFS is a linux-based file system which provides high reliability and concurrent access by redundancy, backup and load balance technology. TFS is mainly designed for small files less than 1MB in size. It adopts flat structure instead of the traditional directory structure. TFS will generate a 18 byte length filename after storing data uploaded by users. Users can access their data by the uniqle filename.

Documents

Licence

GNU General Public License v2

Contribution

This project is still in development stage, many bugs are not fixed or found yet. feel free to submit bugs if you find them. If you have any question or feedback, please contact and join us, we appreciate your kindly contribution.

tfs's People

Contributors

tfs-taobao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tfs's Issues

TFS在ubuntu gcc4.8下编译出错

block_collect.cpp:229:17: error: ‘abs’ is not a member of ‘__gnu_cxx’
             if (__gnu_cxx::abs(info_.version_ - info.version_) <= VERSION_AGREED_MASK)//version agreed
                 ^
block_collect.cpp:229:17: note: suggested alternatives:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from block_collect.cpp:16:
/usr/include/stdlib.h:775:12: note:   ‘abs’
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from block_collect.cpp:16:
/usr/include/c++/4.8/cstdlib:179:3: note:   ‘std::abs’
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }

试过如果把'__gnu_cxx' 替换为'std' 还是无法编译通过 ,错误如下

client_request_server.cpp: In member function ‘int tfs::nameserver::ClientRequestServer::batch_open(const VUINT32&, int32_t, int32_t, std::map<unsigned int, tfs::common::BlockInfoSeg>&)’:
client_request_server.cpp:160:56: error: call of overloaded ‘abs(std::map<unsigned int, tfs::common::BlockInfoSeg>::size_type)’ is ambiguous
           stat[1] = std::abs(out.size() - blocks.size());
                                                        ^
client_request_server.cpp:160:56: note: candidates are:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/stdlib.h:775:12: note: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/c++/4.8/cstdlib:166:3: note: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/4.8/cstdlib:174:3: note: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/4.8/cstdlib:179:3: note: __int128 std::abs(__int128)
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
   ^
client_request_server.cpp:167:54: error: call of overloaded ‘abs(std::map<unsigned int, tfs::common::BlockInfoSeg>::size_type)’ is ambiguous
           stat[3] = std::abs(out.size() - block_count);
                                                      ^
client_request_server.cpp:167:54: note: candidates are:
In file included from /usr/include/c++/4.8/cstdlib:72:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:59,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/stdlib.h:775:12: note: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/c++/4.8/backward/hashtable.h:64,
                 from /usr/include/c++/4.8/ext/hash_map:64,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/config.h:20,
                 from /home/hadoop/wrp/TES_test/tb-common-utils/include/tbsys/tbsys.h:110,
                 from client_request_server.cpp:18:
/usr/include/c++/4.8/cstdlib:166:3: note: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/4.8/cstdlib:174:3: note: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/4.8/cstdlib:179:3: note: __int128 std::abs(__int128)
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }

dataserver的副本问题

1、 ds的block的副本存储在什么地方?
2、 “机器数大于副本数”中的机器数是指部署ds的机器数吗?
3、 如果ns和ds的心跳长时间没有,此时ds可能宕机了,那么ns还怎么能够拷贝block呢?ds都已经宕机了
@tfs-taobao

tfs连接mysql数据库时使用了oneproxy中间件时报错

[2016-06-03 14:44:16] ERROR get_return_status (meta_store_manager.cpp:972) [140490842298112] ret is 1 when we ask data from database
[2016-06-03 14:44:16] INFO meta_server_service.cpp:239 execute message failed, error code: 1
[2016-06-03 14:55:03] ERROR connect (mysql_database_helper.cpp:70) [140490831808256] Error: prepared statement not supported in OneProxy (errno: 1149)

NewClient 对象 内存泄漏问题

int DataService::post_message_to_server 在调用 common::post_msg_to_server 失败时,没有释放NewClient 对象 client, 有内存泄漏问题。

int BuildTable::send_msg_to_server(const uint64_t server, const int8_t phase) 在调用 common::post_msg_to_server 失败时,同样没有释放NewClient 对象 client, 存在内存泄漏问题。

--- a/src/dataserver/dataservice.cpp
+++ b/src/dataserver/dataservice.cpp
@@ -752,6 +752,8 @@ namespace tfs
           {
             NewClient* client = NewClientManager::get_instance().create_client();
             iret = TFS_SUCCESS == common::post_msg_to_server(erase_self, client, message, ds_async_callback) ? 1 : -1;
+            if (1 != iret)
+              NewClientManager::get_instance().destroy_client(client);
           }
           else
           {

tfs带offset写入的问题

1, t_pwrite() 带 offset 写入数据,写入OK,t_close() 也正常返回了一个tfs文件名,但后续用tfstool的stat命令查看该文件,结果失败。打印中有 -8025 的错误码,如下
ERROR async_rsp_stat_file (tfs_file.cpp:1542) [140430609741664] stat file fail. blockid: 1450, fileid: 3, ret: -8025, erorr msg: readfileinfo fail, blockid: 1450, fileid: 3, ret: -8025
意思是在index文件中未找到该文件的meta信息 继续用lsf命令查看该block,结果中没有该文件。

2,类似的重新以 T_WRITE 方式打开现有的tfs文件,写入新的数据之后,发现文件原有的数据被截断。似乎内部写入offset值是从0开始的,但手工lseek到文件结尾(T_SEEK_END),也没有效果。——后来看client代码发现该seek方式无效果,只有SET/CUR有用,算是一个坑!

目前是在虚拟机里搭建一个单机环境,使用tfstool工具写入文件没有问题;直接 t_write() 不带offset将一个完整文件的数据写入也没有问题。

使用的版本是 http://code.taobao.org/svn/tfs/branches/dev_for_outer_users/

特殊情况下逻辑块的多个副本分布在相同机柜上

特殊情况下逻辑块的多个副本分布在相同逻辑机柜上, 带来的问题是这种情况发生时小部分数据的可靠性小于预期,

构造场景

  1. rack_1(ds_a, ds_a1), rack_2(ds_b) ns 副本2, 写入一定数据
  2. 停止 ds_a 等待A上的block复制到ds_a1上
  3. 停止A, 修改副本为3, 配置加入rack_3(ds_c)
  4. 获取block的ds server列表,可以发现部分block 有两个副本在ds_a, ds_a1上

tfs 的那个版本最稳定,通用,

能不能来个全一点的文档啊!
你们自己的阿里云上的东西都不更新了,
文档也特别旧
给个说明呗
哪个版本最稳定,通用

追加写入数据之后,关闭tfs文件,dataserver出现CRC校验错误

先以 T_WRITE | T_CREATE 方式打开一个文件,每次 t_lseek() 之后 t_write() 写入数据(t_lseek() 指定的offset是与写入数据的累计尺寸相一致的),t_close() 成功获取到一个tfs文件名。

再以 T_WRITE | T_READ 方式打开刚才的这个 tfs 文件,t_lseek(SET) 方式seek到文件结尾,再 t_write() 追加写入数据,之后 t_close() 失败,返回 -8013。利用 stat 命令查看刚才的文件,第二次的写入数据未被保存。

再看 dataserver.log,根据 filenumber 确定,刚才 t_close() 失败的原因是关闭请求消息中的 CRC 与 dataserver本地的CRC值不一致所致。

该问题在我的环境里必现,使用的版本是 http://code.taobao.org/svn/tfs/branches/dev_for_outer_users/ ,是在虚拟机里搭建的单机环境

@tfs-taobao

What is "flat structure" mean in the introduction part of the project homepage?

It seems that I fail to find any definition of this term in Google.com. I guess it may refer to the meaning that all block files are located in the same directory, is that right?

Queston 2 : Does this phrase "在块设备基础上建立自有的文件系统,减少EXT3等文件系统数据碎片带来的性能损耗" mean that TFS does not use API provided by VFS layer and write data to file /dev/sda1 directly ?

文档拼写错误

安装文档,“编译FAQ”一节,“使用TFS一定需要64bit Liunx?”中,linux 拼写错误。

TFS空间计算容量

我想买5台机器用于TFS,存储30T数据,主要为图片数据,一般在250k左右,3份冗余的话,买多大磁盘比较合适呢

tfstool的put文件没有输出类似T开头的18文字字符串

./bin/tfstool -s 10.232.36.201:8100 -i "put testfile"

将本地testfile存入tfs, -s 指定nameserver的ip:port。 如果成功,会打印 put testfile => T1QEBXXDpXXXXXXXXX success. 类似的消息,其中T开头一串字符是TFS为这个文件生成的文件名,一共18个字符;要想从TFS取出该文件时,需要指定该文件名。

./bin/tfstoo -s 10.232.36.201:8100 -i "get T1QEBXXDpXXXXXXXXX localfile"

从TFS读取T1QEBXXDpXXXXXXXXX,存储到本地localfile中;如果成功,会打印fetch T1QEBXXDpXXXXXXXXX => localfile success

但是我的没有这个T开头的文字输出,怎么办

安装rcserver不成功

make rcserver的时候报错:
mysql_database_helper.cpp:18:19: error: mysql.h: No such file or directory
mysql_database_helper.cpp:19:20: error: errmsg.h: No such file or directory
mysql、mysql-server、mysql-devel全部都安装了,仍然会报错。
看了相关的问答,实验了在./configure的时候加--with-mysql=path,但是configure不识别这个参数。

写操作落在维护块上可能造成文件重名

https://github.com/alibaba/tfs/blob/master/src/nameserver/client_request_server.cpp#L120-121

write 的open 模式,只考虑block_id > 0 的情况, 新插入的写操作block_id ==0 , 但是也需要规避写在正进行维护的逻辑块

          if ((block_id > 0)
              && (!(mode & T_NOLEASE)))

若压测场景中若正在写入的块处于压缩阶段,压缩后的块的索引seq值有一定概率没有更新,(seq 更新到旧的块上,新块的seq已经拷贝完成), 这带来的问题是下一次这个块上的产生的fileid重复,造成文件名重名。

tfs2.2.16 make编译出现问题

我在centos6.5下面编译tfs2.2.16版本的时候,gcc版本是4.1.2,依赖库也都安装了。
make 编译时候出现

blockfile_format.h: In member function 'virtual int
tfs::dataserver::Ext4FileFormater::block_file_format(int, int64_t)':
blockfile_format.h:77: error: 'fallocate' was not declared in this scope

源代码是在blockfile_format.h 77行 fallocate没有定义,请教下是什么原因导致的??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.