Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Seal the CriticalHandle derived classes and add WasReleasedOk method for accurate backup handle count tracking. Report resource counts for the backup, threading, and stress tests. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b4cd72edae62972c2d7b3533294fd911 |
User & Date: | mistachkin 2012-10-27 17:43:24.991 |
Context
2012-11-05
| ||
08:50 | Update Eagle in externals to the beta 26 release. check-in: 0ca5fae021 user: mistachkin tags: trunk | |
2012-10-27
| ||
17:43 | Seal the CriticalHandle derived classes and add WasReleasedOk method for accurate backup handle count tracking. Report resource counts for the backup, threading, and stress tests. check-in: b4cd72edae user: mistachkin tags: trunk | |
04:12 | Revise logging integration between the interop assembly and the managed assembly; by default, the native logging callback is now used only when running on the .NET Compact Framework. check-in: f1261d71fd user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLite3.cs.
︙ | ︙ | |||
1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | if (handlePtr == IntPtr.Zero) throw new InvalidOperationException( "Backup object has an invalid handle pointer."); SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(handlePtr); handle.SetHandleAsInvalid(); if ((n != SQLiteErrorCode.Ok) && (n != backup._stepResult)) throw new SQLiteException(n, GetLastError()); } /////////////////////////////////////////////////////////////////////////////////////////////// | > > > > | 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | if (handlePtr == IntPtr.Zero) throw new InvalidOperationException( "Backup object has an invalid handle pointer."); SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(handlePtr); handle.SetHandleAsInvalid(); #if COUNT_HANDLE if (n == SQLiteErrorCode.Ok) handle.WasReleasedOk(); #endif if ((n != SQLiteErrorCode.Ok) && (n != backup._stepResult)) throw new SQLiteException(n, GetLastError()); } /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
1491 1492 1493 1494 1495 1496 1497 | #endif /////////////////////////////////////////////////////////////////////////// #region SQLiteConnectionHandle Class // Handles the unmanaged database pointer, and provides finalization // support for it. | | | 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | #endif /////////////////////////////////////////////////////////////////////////// #region SQLiteConnectionHandle Class // Handles the unmanaged database pointer, and provides finalization // support for it. internal sealed class SQLiteConnectionHandle : CriticalHandle { #if SQLITE_STANDARD && !PLATFORM_COMPACTFRAMEWORK internal delegate void CloseConnectionCallback( SQLiteConnectionHandle hdl, IntPtr db); internal static CloseConnectionCallback closeConnection = SQLiteBase.CloseConnection; |
︙ | ︙ | |||
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | #else return true; #endif } /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { #if PLATFORM_COMPACTFRAMEWORK lock (syncRoot) #endif | > > > > > > > > > > | 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | #else return true; #endif } /////////////////////////////////////////////////////////////////////// #if COUNT_HANDLE public int WasReleasedOk() { return Interlocked.Decrement( ref UnsafeNativeMethods.connectionCount); } #endif /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { #if PLATFORM_COMPACTFRAMEWORK lock (syncRoot) #endif |
︙ | ︙ | |||
1662 1663 1664 1665 1666 1667 1668 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteStatementHandle Class // Provides finalization support for unmanaged SQLite statements. | | | 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteStatementHandle Class // Provides finalization support for unmanaged SQLite statements. internal sealed class SQLiteStatementHandle : CriticalHandle { #if PLATFORM_COMPACTFRAMEWORK internal readonly object syncRoot = new object(); #endif /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 | #else return true; #endif } /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { #if PLATFORM_COMPACTFRAMEWORK lock (syncRoot) #endif | > > > > > > > > > > | 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | #else return true; #endif } /////////////////////////////////////////////////////////////////////// #if COUNT_HANDLE public int WasReleasedOk() { return Interlocked.Decrement( ref UnsafeNativeMethods.statementCount); } #endif /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { #if PLATFORM_COMPACTFRAMEWORK lock (syncRoot) #endif |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteBackupHandle Class // Provides finalization support for unmanaged SQLite backup objects. | | | 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteBackupHandle Class // Provides finalization support for unmanaged SQLite backup objects. internal sealed class SQLiteBackupHandle : CriticalHandle { #if PLATFORM_COMPACTFRAMEWORK internal readonly object syncRoot = new object(); #endif /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 | } #if DEBUG return false; #else return true; #endif } /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { | > > > > > > > > > > | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 | } #if DEBUG return false; #else return true; #endif } /////////////////////////////////////////////////////////////////////// #if COUNT_HANDLE public int WasReleasedOk() { return Interlocked.Decrement( ref UnsafeNativeMethods.backupCount); } #endif /////////////////////////////////////////////////////////////////////// public override bool IsInvalid { get { |
︙ | ︙ |
Changes to Tests/backup.eagle.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000] set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)"] | > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### getSQLiteHandleCounts $test_channel reportSQLiteResources $test_channel ############################################################################### set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000] set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)" \ null "new SQLiteBackupCallback(BackupCallback)"] |
︙ | ︙ | |||
223 224 225 226 227 228 229 230 231 232 233 234 | "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \ [lindex $params(results) $i]]} } ############################################################################### unset -nocomplain i params pages callback ############################################################################### runSQLiteTestEpilogue runTestEpilogue | > > > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \ [lindex $params(results) $i]]} } ############################################################################### unset -nocomplain i params pages callback ############################################################################### getSQLiteHandleCounts $test_channel reportSQLiteResources $test_channel ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/stress.eagle.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### # # NOTE: Make sure that SQLite core library is completely shutdown prior to # starting any of the tests in this file. # shutdownSQLite $test_channel ############################################################################### runTest {test stress-1.1 {multithreaded stress testing} -setup { unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener connection indicators iterations exitOnFail coTaskMem \ | > > > > > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### # # NOTE: Report before test, before shutdown. # getSQLiteHandleCounts $test_channel reportSQLiteResources $test_channel ############################################################################### # # NOTE: Make sure that SQLite core library is completely shutdown prior to # starting any of the tests in this file. # shutdownSQLite $test_channel ############################################################################### # # NOTE: Report before test, after shutdown. # getSQLiteHandleCounts $test_channel reportSQLiteResources $test_channel ############################################################################### runTest {test stress-1.1 {multithreaded stress testing} -setup { unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener connection indicators iterations exitOnFail coTaskMem \ |
︙ | ︙ | |||
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener connection indicators iterations exitOnFail coTaskMem \ noTrace failures status } -time true -constraints {eagle monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -result {0}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue | > > > > > > > > | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener connection indicators iterations exitOnFail coTaskMem \ noTrace failures status } -time true -constraints {eagle monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -result {0}} ############################################################################### # # NOTE: Report after test. # getSQLiteHandleCounts $test_channel reportSQLiteResources $test_channel ############################################################################### runSQLiteTestEpilogue runTestEpilogue |