This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch hsqldb2
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit f13b5d186ea5a49d1706a08183825f9c4aae1207
Author: Jim Jagielski <[email protected]>
AuthorDate: Mon Oct 26 07:45:03 2026 -0400

    hsqldb: keep the data file handle valid across a backup, drop the .tmp dir
    
    The storage bridge keeps one handle per file, so archiving the open data
    file invalidated the cache's handle. Stored databases also no longer get
    a <doc>.tmp directory next to the document.
---
 main/hsqldb/patches/storage_access.patch | 60 +++++++++++++++++++++++++++-----
 1 file changed, 51 insertions(+), 9 deletions(-)

diff --git a/main/hsqldb/patches/storage_access.patch 
b/main/hsqldb/patches/storage_access.patch
index ac5c97a29f..cbd2d43bc4 100644
--- a/main/hsqldb/patches/storage_access.patch
+++ b/main/hsqldb/patches/storage_access.patch
@@ -30,20 +30,31 @@
          propIsFileDatabase          = database.getType().isFileBased();
          database.databaseProperties = new HsqlDatabaseProperties(database);
          propTextAllowFullPath = database.databaseProperties.isPropertyTrue(
-@@ -285,6 +292,12 @@
+@@ -283,6 +290,12 @@
+                 database.databaseProperties.setProperty(
+                     HsqlDatabaseProperties.hsqldb_lock_file, false);
              }
-         }
- 
++        }
++
 +        // the shadow file used for incremental backup is not reachable 
through FileAccess
 +        if (isStoredFileAccess) {
 +            database.databaseProperties.setProperty(
 +                HsqlDatabaseProperties.hsqldb_inc_backup, false);
-+        }
-+
-         setVariables();
+         }
  
-         String appLogPath = null;
-@@ -1102,7 +1115,7 @@
+         setVariables();
+@@ -391,6 +404,10 @@
+             if (database.getType() == DatabaseType.DB_MEM) {
+                 tempDirectoryPath = 
database.getProperties().getStringProperty(
+                     HsqlDatabaseProperties.hsqldb_temp_directory);
++            } else if (isStoredFileAccess) {
++
++                // no temporary directory next to the document
++                tempDirectoryPath = null;
+             } else {
+                 tempDirectoryPath = database.getPath() + ".tmp";
+             }
+@@ -1102,7 +1119,7 @@
  
      public synchronized void setIncrementBackup(boolean val) {
  
@@ -52,7 +63,7 @@
              return;
          }
  
-@@ -1313,8 +1326,67 @@
+@@ -1313,8 +1330,67 @@
  
      public FileAccess getFileAccess() {
          return fileAccess;
@@ -233,6 +244,37 @@
      }
  
      boolean setDataSpaceManager() {
+@@ -1368,7 +1382,29 @@
+      * @throws  HsqlException
+      */
+     void backupDataFile(boolean newFile) {
+-        backupFile(database, dataFileName, backupFileName, newFile);
++
++        if (!database.logger.isStoredFileAccess() || dataFile == null) {
++            backupFile(database, dataFileName, backupFileName, newFile);
++
++            return;
++        }
++
++        // the storage keeps one handle per file: reading the data file for
++        // the archive would close the handle held by this cache
++        try {
++            dataFile.close();
++            backupFile(database, dataFileName, backupFileName, newFile);
++        } catch (IOException e) {
++            throw Error.error(ErrorCode.DATA_FILE_ERROR, e);
++        } finally {
++            try {
++                dataFile = RAFile.newScaledRAFile(database, dataFileName,
++                                                  false,
++                                                  RAFile.DATA_FILE_STORED);
++            } catch (IOException e) {
++                throw Error.error(ErrorCode.DATA_FILE_ERROR, e);
++            }
++        }
+     }
+ 
+     void backupNewDataFile(boolean newFile) {
 --- misc/hsqldb/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/LobStoreRAFile.java
 +++ misc/build/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/LobStoreRAFile.java
 @@ -70,8 +70,14 @@

Reply via email to