22
33import java .sql .SQLException ;
44import java .util .concurrent .locks .ReentrantLock ;
5+ import java .util .logging .Level ;
6+ import java .util .logging .Logger ;
57
68import com .google .common .cache .Cache ;
79import com .google .common .hash .Hashing ;
3133 * @author mzinal
3234 */
3335public class TableTxExecutor extends QueryServiceExecutor {
36+ private static final Logger LOGGER = Logger .getLogger (TableTxExecutor .class .getName ());
3437 private static final ReentrantLock VALIDATE_LOCK = new ReentrantLock ();
3538
3639 private static final String CREATE_SQL = ""
@@ -147,6 +150,7 @@ public static void validate(YdbContext ctx, String tablePath, Cache<String, Tabl
147150
148151 VALIDATE_LOCK .lock ();
149152 try {
153+ LOGGER .log (Level .INFO , "Validate TxTableExecutor {0}" , tablePath );
150154 if (cache .getIfPresent (tablePath ) != null ) {
151155 return ;
152156 }
@@ -158,6 +162,7 @@ public static void validate(YdbContext ctx, String tablePath, Cache<String, Tabl
158162
159163 // validate table name
160164 Result <TableDescription > res = retryCtx .supplyResult (s -> s .describeTable (tablePath )).join ();
165+ LOGGER .log (Level .INFO , "Describe TxTableExecutor {0} -> {1}" , new Object [] {tablePath , res .getStatus ()});
161166 if (res .isSuccess ()) {
162167 cache .put (tablePath , res .getValue ());
163168 return ;
@@ -171,12 +176,14 @@ public static void validate(YdbContext ctx, String tablePath, Cache<String, Tabl
171176 // Try to create a table
172177 String query = String .format (CREATE_SQL , tablePath );
173178 Status status = retryCtx .supplyStatus (session -> session .executeSchemeQuery (query )).join ();
179+ LOGGER .log (Level .INFO , "Create TxTableExecutor {0} -> {1}" , new Object [] {tablePath , status });
174180 if (!status .isSuccess ()) {
175181 throw ExceptionFactory .createException ("Cannot initialize TableTxExecutor with tx table " + tablePath ,
176182 new UnexpectedResultException ("Cannot create table" , status ));
177183 }
178184
179185 Result <TableDescription > res2 = retryCtx .supplyResult (s -> s .describeTable (tablePath )).join ();
186+ LOGGER .log (Level .INFO , "Validate TxTableExecutor {0} -> {1}" , new Object [] {tablePath , res2 .getStatus ()});
180187 if (!res2 .isSuccess ()) {
181188 throw ExceptionFactory .createException ("Cannot initialize TableTxExecutor with tx table " + tablePath ,
182189 new UnexpectedResultException ("Cannot describe after creating" , res2 .getStatus ()));
0 commit comments