AdaptiveIndexDefrag - bug with ForceRescan Option - lines 1732 - 1750
I was having an issue implementing the adaptive index defrag. I'd set forcerescan to 0, but it would restart the scan every time.
After investigation, i found that the force rescan looks for compression_type to not be NULL, if its NULL then it restarts the entire scan throwing the "missing column information" error (Lines 1063-1068)
on lines 1732 - 1750 there's a statement saying if the scan mode is set to Limited, then do these steps. this is the only section that actually populates the compression_type field.
2 problems i see: There is a random "END" in the updateSQL string on line 1745, this does not complile.
after line 1750 there should be a line for: EXECUTE sp_executesql @updateSQL , but there isn't. so that code above it never runs, and the compression_type field is always NULL, so forceRescan to 0 always resets to 1.
If the 2 problems i listed above are fixed, there will still be the issue of if someone chooses a scan mode other than LIMITED, they will always have to restart the index defrag process, because the compression_type field will never be populated.
HI, Apologies for taking this long to take a look. About the compression_type, I see the problems. Actually removed the upgrade condition - if anyone is upgrading from such an old version that doesn't have this anymore, a full schema recreation is best anyway. On the actual population of the column in ids, also removed the condition there - although I can't locate the extra END condition - I couldn't repro the no compile though. It compiled as-is before, and now again. I'm checking in v1.6.6.6, please verify. Thank you