SELECT statement

The VxFS placement policy rule SELECT statement designates the collection of files to which a rule applies.

The following XML snippet illustrates the general form of the SELECT statement:

 <SELECT>
   <DIRECTORY Flags="directory_flag_value"> value
   </DIRECTORY>
   <PATTERN Flags="pattern_flag_value"> value </PATTERN>
   <USER> value </USER>
   <GROUP> value </GROUP>
 </SELECT>

A SELECT statement may designate files by using the following selection criteria:

<DIRECTORY>

A full path name relative to the file system mount point. The Flags="directory_flag_value" XML attribute must have a value of nonrecursive, denoting that only files in the specified directory are designated, or a value of recursive, denoting that files in all subdirectories of the specified directory are designated. The Flags attribute is mandatory.

The <DIRECTORY> criterion is optional, and may be specified more than once.

<PATTERN>

Either an exact file name or a pattern using a single wildcard character (*). For example, the pattern "abc*" denotes all files whose names begin with "abc". The pattern "abc.*" denotes all files whose names are exactly "abc" followed by a period and any extension. The pattern "*abc" denotes all files whose names end in "abc", even if the name is all or part of an extension. The pattern "*.abc" denotes files of any name whose name extension (following the period) is "abc". The pattern "ab*c" denotes all files whose names start with "ab" and end with "c". The first "*" character is treated as a wildcard, while any subsequent "*" characters are treated as literal text. The pattern cannot contain "/".

The wildcard character matches any character, including ".", "?", and "[", unlike using the wildcard in a shell.

The Flags="pattern_flag_value" XML attribute is optional, and if specified can only have a value of recursive. Specify Flags="recursive" only if the pattern is a directory. If Flags is not specified, the default attribute value is nonrecursive. If Flags="recursive" is specified, the enclosing selection criteria selects all files in any component directory that is anywhere below the directory specified by <DIRECTORY> if the component directory matches the pattern and either of the following is true:

  • <DIRECTORY> is specified and has the recursive flag.

  • <DIRECTORY> is not specified and the directory is anywhere in the file system.

If the pattern contains the wildcard character (*), wildcard character matching is performed.

The <PATTERN> criterion is optional, and may be specified more than once. Only one value can be specified per <PATTERN> element.

<USER>

User name of the file's owner. The user number cannot be specified in place of the name.

The <USER> criterion is optional, and may be specified more than once.

<GROUP>

Group name of the file's owner. The group number cannot be specified in place of the group name.

The <GROUP> criterion is optional, and may be specified more than once.

One or more instances of any or all of the file selection criteria may be specified within a single SELECT statement. If two or more selection criteria of different types are specified in a single statement, a file must satisfy one criterion of each type to be selected.

In the following example, only files that reside in either the ora/db or the crash/dump directory, and whose owner is either user1 or user2 are selected for possible action:

 <SELECT>
   <DIRECTORY Flags="nonrecursive">ora/db</DIRECTORY>
   <DIRECTORY Flags="nonrecursive">crash/dump</DIRECTORY>
   <USER>user1</USER>
   <USER>user2</USER>
 </SELECT>

A rule may include multiple SELECT statements. If a file satisfies the selection criteria of one of the SELECT statements, it is eligible for action.

In the following example, any files owned by either user1 or user2, no matter in which directories they reside, as well as all files in the ora/db or crash/dump directories, no matter which users own them, are eligible for action:

 <SELECT>
   <DIRECTORY Flags="nonrecursive">ora/db</DIRECTORY>
   <DIRECTORY Flags="nonrecursive">crash/dump</DIRECTORY>
 </SELECT>
 <SELECT>
   <USER>user1</USER>
   <USER>user2</USER>
 </SELECT>

When VxFS creates new files, VxFS applies active placement policy rules in the order of appearance in the active placement policy's XML source file. The first rule in which a SELECT statement designates the file to be created determines the file's placement; no later rules apply. Similarly, VxFS scans the active policy rules on behalf of each file when relocating files, stopping the rules scan when it reaches the first rule containing a SELECT statement that designates the file. This behavior holds true even if the applicable rule results in no action. Take for example a policy rule that indicates that .dat files inactive for 30 days should be relocated, and a later rule indicates that .dat files larger than 10 megabytes should be relocated. A 20 megabyte .dat file that has been inactive for 10 days will not be relocated because the earlier rule applied. The later rule is never scanned.

A placement policy rule's action statements apply to all files designated by any of the rule's SELECT statements. If an existing file is not designated by a SELECT statement in any rule of a file system's active placement policy, then SmartTier does not relocate or delete the file. If an application creates a file that is not designated by a SELECT statement in a rule of the file system's active policy, then VxFS places the file according to its own internal algorithms. If this behavior is inappropriate, the last rule in the policy document on which the file system's active placement policy is based should specify <PATTERN>*</PATTERN> as the only selection criterion in its SELECT statement, and a CREATE statement naming the desired placement class for files not selected by other rules.