Skip to content

Commit ad9e8b1

Browse files
author
Christopher Tate
committed
Disable db_sample logging
db_sample logging is thrashing the event log hard, and is currently neither maintained nor heeded by anybody on the current release. It can be re-enabled simply by throwing the appropriate static boolean to 'true', but for now this should greatly improve the utility of our event logs. (We were seeing a rollover period of 20 minutes or less; ideally we want to see the event log run at least half a day before rolling.) Bug 5419627 Bug 5104300 Change-Id: I2125544130aae142974102dbad3b557e49fcd494
1 parent 63d8b0c commit ad9e8b1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

core/java/android/database/sqlite/SQLiteDatabase.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
*/
6767
public class SQLiteDatabase extends SQLiteClosable {
6868
private static final String TAG = "SQLiteDatabase";
69+
private static final boolean ENABLE_DB_SAMPLE = false; // true to enable stats in event log
6970
private static final int EVENT_DB_OPERATION = 52000;
7071
private static final int EVENT_DB_CORRUPT = 75004;
7172

@@ -440,7 +441,9 @@ private void lock(String sql, boolean forced) {
440441
}
441442
}
442443
if (sql != null) {
443-
logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
444+
if (ENABLE_DB_SAMPLE) {
445+
logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
446+
}
444447
}
445448
}
446449
private static class DatabaseReentrantLock extends ReentrantLock {
@@ -726,7 +729,9 @@ public void endTransaction() {
726729
}
727730
}
728731
// log the transaction time to the Eventlog.
729-
logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
732+
if (ENABLE_DB_SAMPLE) {
733+
logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
734+
}
730735
} else {
731736
try {
732737
execSQL("ROLLBACK;");
@@ -2036,7 +2041,9 @@ public final String getPath() {
20362041
}
20372042

20382043
/* package */ void logTimeStat(String sql, long beginMillis) {
2039-
logTimeStat(sql, beginMillis, null);
2044+
if (ENABLE_DB_SAMPLE) {
2045+
logTimeStat(sql, beginMillis, null);
2046+
}
20402047
}
20412048

20422049
private void logTimeStat(String sql, long beginMillis, String prefix) {

0 commit comments

Comments
 (0)