The invention discloses a method and a
system for realizing compatible file
hard link and S3 shallow copy based on a distributed key-value pair, a file
metadata key-value pair is used as a
metadata storage main body of a file or a
directory, a key consists of a
file system ID (Identity), a parent
directory ID and a file or
directory name, and a value contains
metadata information; a
reverse index file
handle key value pair is introduced to serve as a unique invariant identifier, a key is composed of a
file system ID, an initial parent directory ID, an initial file or first N characters of a directory name and a file ID, and a value contains a current file metadata key and a reference count. When files or directories are created and deleted, the files or the directories are located at the same one-key value pair node in a large probability, and one-stage submission is supported to improve performance; hard linking and S3 shallow
copying are achieved at the same time, independent file metadata key-value pairs and
reverse index file
handle key-value pairs are created for the hard linking and the S3 shallow
copying,
reverse index file
handle keys of the target file are recorded by file metadata values of the file metadata key-value pairs, reference counts of the reverse index file handle values of the target file are updated, and performance and compatibility are both considered.