Establishing a CLFS Log Policy
A CLFS log policy is a collection of settings that determine the characteristics and automatic behavior of your log. The LogPolicy class encapsulates three categories of policy settings: automatic growth, extent management, and tail pinning. You manage automatic growth via log policy properties (see Table 1).
Table 1: The table shows the log policy properties that affect automatic log growth or shrinkage.
||Set this property to true to allow CLFS to automatically increase the size of your log when needed. The default value is false.
||When the amount of unused log store space is greater than the percentage specified in this property, CLFS will remove extents to save disk space. The default value is zero.
||This property determines how much additional space CLFS allocates when your log store is full and needs to grow. You can specify the growth rate in extent units or percentage units. The default value is one extent.
You manage the extents via log policy settings as well (see Table 2).
Table 2: The table shows the extent management properties.
||Use this property to cap the size of your log, taking the size of your extents and the available disk space on the target machine into account. Set this property to zero to allow for unlimited extents. The default value is zero.
||Use this property to set the lower bound for the size of your log. CLFS logs require at least two extents. The default value is two.
||Set this property to the full path and file name prefix for automatically created extents. The default value is "Container."
||When CLFS creates new extents, it creates a file name by concatenating LogPolicy.NewExtentPrefix and LogPolicy.NextExtentSuffix. The default value is zero.
I'll cover an additional property, the LogPolicy.TailPinnedThreshold
and the LogPolicy.TailPinned
event later in this article.
|Author's Note: You have to set the log policy every time you create a LogRecordSequence. CLFS doesn't save the policy settings because they apply to a particular stream's LogRecordSequence rather than the log.
sequence.LogStore.Policy.AutoGrow = true;
sequence.LogStore.Policy.AutoShrinkPercentage = 25;
sequence.LogStore.Policy.GrowthRate = new PolicyUnit(
sequence.LogStore.Policy.MaximumExtentCount = 50;
sequence.LogStore.Policy.MinimumExtentCount = 2;
sequence.LogStore.Policy.NewExtentPrefix = EXTENT_NAME;
sequence.LogStore.Policy.NextExtentSuffix = sequence.LogStore.Extents.Count;
Note the last line in the preceding code. The policy settings don't take effect until you call the LogPolicy
Now you're ready to start writing to the log.