Comprimir una KB GeneXus.
Guscarr proponía utilizar la tarea CheckKnowledgeBase, para desfragmentar los índices y corregir errores internos de la KB.
UPDATE: Guscarr me hace notar que hay documentación sobre la opcion CompressData en el siguiente SAC.
Viendo la dll de la tarea msbuild, encontré una opción para comprimir la KB en la tarea OpenKnowledgeBase, que no está documentada y creo que puede ser útil para KB que tengan varios años de funcionamiento.
NOTA: El OpenKnowledgeBase tiene otra opcion EventSuspend que tampoco esta documentada y no se bien para que sirva. Si logro descubrirlo, actualizo este post.
Para lograrlo hice un archivo "CheckKnowledgeBase.msbuild" cuyo contenido es:
<Project DefaultTargets="UpdateFromServerAndBuildAll" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(GXDir)\Genexus.Tasks.targets" />
<Target Name="OpenKnowledgeBase">
<OpenKnowledgeBase Directory="$(KBDir)" CompressData="True" EventsSuspended="True" />
</Target>
<Target Name="CheckKnowledgeBase" DependsOnTargets="OpenKnowledgeBase">
<CheckKnowledgeBase Fix="true" />
</Target>
</Project>
hice un archivo de comandos "CompressKB.CMD" que tiene
Los valores marcados con amarillo, hay que cambiarlos para que tengan los correspodientes a sus instalaciones
@echo off
echo ------------------------------------------
echo --- %~n0%~x0 ----------
echo --- Parameters ----------------
set dirFramework="C:\Windows\Microsoft.NET\Framework\v3.5"
set GXDir="C:\Program Files (x86)\Artech\GeneXus\GeneXusXEv2U6"
echo --- Ask KB Directory ----------------
set /p KBDir=Enter Knowledge Base Directory :
echo --- Check/Compress KB ----------------
call %dirFramework%\MSBuild /nologo CheckKnowledgeBase.msbuild /p:KBDir=%KBDir%;GXDir=%GxDir% /t:CheckKnowledgeBase
echo --- End ----------------
echo ------------------------------------------
pause
Al ejecutarlo, los pasos que hará seran:
- Abrir la KB
- Comprimir sus datos
- Si hay indices fragmentados, defragmentarlos
- Corregir errores internos de la KB
La salida sera similar a esta:
------------------------------------------
--- CompressKB.cmd ----------
--- Parameters ----------------
--- Ask KB Directory ----------------
Enter Knowledge Base Directory : C:\Models\Ev2\KBUnificada
--- Check/Compress KB ----------------
Build started 2015-03-14 23:04:26.
Project "C:\Models\Tools\location\CheckKnowledgeBase.msbuild" on node 0 (CheckK
nowledgeBase target(s)).
========== Open Knowledge Base Task started ==========
Compressing Knowledge Base Data (this may take several minutes!)...
success.
> Open Knowledge Base Task Success
========== Open Knowledge Base Task finished ==========
CheckKnowledgeBase:
========== Check Knowledge Base started ==========
C:\Models\Tools\location\CheckKnowledgeBase.msbuild : warning : "Fix" parameter
specified. Running checks and fixing issues.
Step 1: Check KnowledgeBase's database integrity
Index 'PK__ATTRIBUT__365FF6B17F3DEA93' in table 'ATTRIBUTE' is slightly fragm
ented. Reorganizing this index may improve fragmentation.
Index 'ATT_SUBTYPE' in table 'ATTRIBUTE' is highly fragmented and should be r
ebuilt. Rebuilding this index may take some time but reduces fragmentation an
d improves index performance.
Index 'PK__CK__E706FD3D5408F3B7' in table 'CK' is highly fragmented and shoul
d be rebuilt. Rebuilding this index may take some time but reduces fragmentat
ion and improves index performance.
Index 'PK__CK_ATRI__FC12A9AA816CD0FC' in table 'CK_ATRI' is highly fragmented
and should be rebuilt. Rebuilding this index may take some time but reduces
fragmentation and improves index performance.
Index 'CKA_ATTRI' in table 'CK_ATRI' is highly fragmented and should be rebui
lt. Rebuilding this index may take some time but reduces fragmentation and im
proves index performance.
......
Composition versioning fixed.
Step 1 finished. 00:00:03.0693747 elapsed.
28 issue(s) found, 28 fixed.
Step 2: Check Entity Version Composition
Step 2 finished. 00:00:00.2336572 elapsed.
0 issue(s) found, 0 fixed.
Step 3: Check Entity Redundant Information
Step 3 finished. 00:00:00.6322822 elapsed.
0 issue(s) found, 0 fixed.
Step 4: Check Subtype Inheritance
Step 4 finished. 00:00:01.9499611 elapsed.
0 issue(s) found, 0 fixed.
Step 5: Check ModelEntityProperty Redundant Information
Checking properties redundancies issues in version KBUnificada
Fixing properties redundancies in all objects in version KBUnificada
Step 5 finished. 00:00:54.9963817 elapsed.
0 issue(s) found, 0 fixed.
Step 6: Check LastObjectId and LastVersionId enumerators
Step 6 finished. 00:00:00.1020560 elapsed.
0 issue(s) found, 0 fixed.
> CheckKnowledgeBase Success
========== CheckKnowledgeBase finished ==========
Done Building Project "C:\Models\Tools\location\CheckKnowledgeBase.msbuild" (Ch
eckKnowledgeBase target(s)).
Build succeeded.
"C:\Models\Tools\location\CheckKnowledgeBase.msbuild" (CheckKnowledgeBase targe
t) (1) ->
(CheckKnowledgeBase target) ->
C:\Models\Tools\location\CheckKnowledgeBase.msbuild : warning : "Fix" paramet
er specified. Running checks and fixing issues.
1 Warning(s)
0 Error(s)
Time Elapsed 00:01:45.66
--- End ----------------
------------------------------------------
Press any key to continue . . .
Luego de ejecutarla la KB estará en mejor estado para hacer los build all en menos tiempo y posiblemente con menos problemas.
UPDATE: Guscarr me hace notar que hay documentación sobre la opcion CompressData en el siguiente SAC.
Comentarios
Publicar un comentario
1) Lee el post
2) Poné tu opinión sobre el mismo.
Todos los comentarios serán leidos y la mayoría son publicados.