Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
49cff2c
#109 add windows runner to matrix
arcade-player Oct 7, 2021
8630c4e
#109 add windows runner to matrix: fix
arcade-player Oct 7, 2021
f27b6a6
#109 add windows runner to matrix: fix
arcade-player Oct 7, 2021
72edc8b
#109 add -Dsurefire.useFile=false
arcade-player Oct 7, 2021
7054551
#109 add quotes for windows
arcade-player Oct 7, 2021
7fe52bb
Made the close/kill database exception proof to unlock the file once …
lvca Oct 7, 2021
3d78f95
Merge branch 'frature/109_add_windows_to_workflows' into windows-issues
lvca Oct 7, 2021
f2c44ff
Fixed closing of database
lvca Oct 7, 2021
04076f3
Another fix on database
lvca Oct 7, 2021
fe2f3c9
Restored close database
lvca Oct 7, 2021
54ca2b4
#109 publish reports only for ubuntu running
arcade-player Oct 7, 2021
2803d5e
#109 replace double quotes with single quotes
arcade-player Oct 7, 2021
4b782c7
#109 add new test reporer
arcade-player Oct 7, 2021
433bf2b
Restored db.kill()
lvca Oct 7, 2021
a905c67
#109 removed token
arcade-player Oct 7, 2021
e860185
Checking why is failing on windows
lvca Oct 7, 2021
625b463
Avoid locking under windows
lvca Oct 7, 2021
a26f67f
Closed correctly files after channels
lvca Oct 7, 2021
9e370c5
Properly delete the lock file
lvca Oct 7, 2021
9eced2a
Added logs to figure out what's going on on Windows
lvca Oct 7, 2021
50364cf
Changed delete of lock file
lvca Oct 7, 2021
36b887c
Added more logs
lvca Oct 8, 2021
824e5fc
Restored lock database
lvca Oct 8, 2021
a0365d3
Skip locking of files under Windows
lvca Oct 8, 2021
f3435e1
Removed unused logs and added warning in case some files are not prop…
lvca Oct 8, 2021
49d1064
Removed debug output
lvca Oct 8, 2021
417f055
Added call to GC in case the file can't be deleted
lvca Oct 8, 2021
74a52b6
Using Files.delete() to delete files in order to get the detailed exc…
lvca Oct 8, 2021
efcdd87
Using Files.delete in multiple points
lvca Oct 8, 2021
591cb6c
Fixed test cases on Windows that use kill to simulate a hard shutdown
lvca Oct 8, 2021
9151490
Avoid to remove WAL file on kill() (test only)
lvca Oct 8, 2021
f61636f
Added more logs to discover the issue under windows
lvca Oct 8, 2021
cee5d4d
WAL delete now uses the retry+gc under windows
lvca Oct 8, 2021
a1e939d
Logs
lvca Oct 8, 2021
2c05090
Changed log level
lvca Oct 8, 2021
ffad5b9
Fixed ACID test case under windows
lvca Oct 8, 2021
8f750cd
Fixed kill
lvca Oct 8, 2021
4d085c3
Fixed txManager.kill() to release active WAL files
lvca Oct 8, 2021
50ae96f
Fixed issue with kill()
lvca Oct 8, 2021
7c6014e
Removed logs
lvca Oct 8, 2021
7c44efb
Added some logs
lvca Oct 8, 2021
b5373a0
Debug windows
lvca Oct 8, 2021
364bb11
Debug on windows
lvca Oct 8, 2021
227177a
Fixed (maybe) issue with Windows paths
lvca Oct 8, 2021
d469a77
Debug windows wal issue
lvca Oct 8, 2021
67ec4ab
Managed rename exception in indexes for windows issue
lvca Oct 8, 2021
1d013e6
Added more logs
lvca Oct 8, 2021
9bf9afb
Fixed rename under windows + temp disabled acid test
lvca Oct 8, 2021
f7d1e60
Debug logs
lvca Oct 8, 2021
2d140a1
Modified rename of temp file index
lvca Oct 9, 2021
a0e7bec
Update PaginatedFile.java
lvca Oct 9, 2021
508993a
Update PaginatedFile.java
lvca Oct 9, 2021
1dfa70d
Update LSMTreeIndexAbstract.java
lvca Oct 9, 2021
a7f7da6
Fixed rename of index files
lvca Oct 9, 2021
72e9cb6
Last change to fix issues under windows
lvca Oct 9, 2021
16ea803
Merge branch 'frature/109_add_windows_to_workflows' into windows-issues
lvca Oct 10, 2021
572f146
Minor fixes for tests
lvca Oct 10, 2021
93094c2
Added logs
lvca Oct 10, 2021
ce6dcfd
Merge branch 'main' into windows-issues
lvca Oct 10, 2021
abedd47
Improved logs
lvca Oct 10, 2021
0a8b10f
Merge branch 'main' into windows-issues
lvca Oct 10, 2021
7b8204e
Fixed not closed WAL file problem
lvca Oct 10, 2021
e814fc7
Removed logs on wal file
lvca Oct 10, 2021
2fb68ac
Disabled Gremlin tests on windows because of a bug in gremlin tests
lvca Oct 10, 2021
d7d4444
Update mvn-test.yml
lvca Oct 10, 2021
ea000ef
Disabled gremlin tests on windows
lvca Oct 10, 2021
2e71a7f
add profile to maven for windows to exclude gremlin tests
arcade-player Oct 10, 2021
c644382
back to surefire reporter
arcade-player Oct 10, 2021
e34a790
enable new reporter
arcade-player Oct 10, 2021
adfa9fc
add continue-on-error
arcade-player Oct 10, 2021
1ad0f6f
add fali-fast false to avoid stop the ubuntu build
arcade-player Oct 10, 2021
039c678
comment continue-on-error
arcade-player Oct 10, 2021
6ec241b
test report os too big, limit report to failed tests
arcade-player Oct 10, 2021
b1507c3
test another reporter
arcade-player Oct 10, 2021
53aebc9
fox check name position
arcade-player Oct 10, 2021
5bd5b73
fox check name position
arcade-player Oct 10, 2021
534154e
Merge branch 'main' into windows-issues
lvca Oct 10, 2021
24ada3a
Added logs for database lock
lvca Oct 10, 2021
d07a62d
Fixed database drop with test files
lvca Oct 10, 2021
a15468f
Forced closing on kill() test method
lvca Oct 10, 2021
2c4a6d7
Fixed closing of file security .jsonl
lvca Oct 10, 2021
c5a49d5
Fixed reading of security files: files could be left open
lvca Oct 10, 2021
0e77e30
Drop databases after the test
lvca Oct 11, 2021
763c5e8
Fixed more tests
lvca Oct 11, 2021
9e45c3f
Fixed drop databases at the end of the test
lvca Oct 11, 2021
9c4cce3
Update BaseGraphServerTest.java
lvca Oct 11, 2021
cae6f98
Removed all automatic parallel settings in tests (`Runtime.getRuntime…
lvca Oct 11, 2021
43965bd
Properly dropped database from a series of tests
lvca Oct 11, 2021
62f0501
Forced deletion of all WAL file at closing if no errors are found
lvca Oct 11, 2021
bf13f97
Fixed delete of database after test
lvca Oct 11, 2021
7a66daf
Created database factory static instances for tracking open databases…
lvca Oct 11, 2021
3b5a5e0
Merge branch 'main' into windows-issues
lvca Oct 11, 2021
8b3479b
Fixed tests
lvca Oct 11, 2021
3f73ad9
Update LSMTreeFullTextIndexTest.java
lvca Oct 11, 2021
1a6bd88
Fixed test
lvca Oct 11, 2021
34ccd30
Prevent closing/dropping of database instances taken from the server
lvca Oct 11, 2021
c3e6323
Merge branch 'main' into windows-issues
lvca Oct 11, 2021
b3b0ba5
Using wrapped database for drop
lvca Oct 11, 2021
8876ca2
Merge branch 'main' into windows-issues
lvca Oct 11, 2021
5102fe3
Merge branch 'main' into windows-issues
lvca Oct 11, 2021
95fa941
Deleted imported databases after test
lvca Oct 11, 2021
3f5a758
Fixed MongoDB tests
lvca Oct 11, 2021
e40ddc1
Fixed backup/restore path
lvca Oct 11, 2021
0559976
Merge branch 'main' into windows-issues
lvca Oct 12, 2021
c5eb501
Removed default databases after test
lvca Oct 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,19 @@ protected int[] getServerToCheck() {
}

protected void deleteDatabaseFolders() {
if (databases != null)
for (int i = 0; i < databases.length; ++i) {
if (databases[i] != null)
databases[i].drop();
}

if (servers != null)
for (int i = 0; i < getServerCount(); ++i)
if (getServer(i).existsDatabase(getDatabaseName()))
getServer(i).getDatabase(getDatabaseName()).drop();

Assertions.assertTrue(DatabaseFactory.getActiveDatabaseInstances().isEmpty(), "Found active databases: " + DatabaseFactory.getActiveDatabaseInstances());

for (int i = 0; i < getServerCount(); ++i)
FileUtils.deleteRecursively(new File(getDatabasePath(i)));
FileUtils.deleteRecursively(new File(GlobalConfiguration.SERVER_ROOT_PATH.getValueAsString() + "/replication"));
Expand Down
2 changes: 2 additions & 0 deletions console/src/test/java/com/arcadedb/console/ConsoleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.arcadedb.console;

import com.arcadedb.database.DatabaseFactory;
import com.arcadedb.utility.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
Expand All @@ -36,6 +37,7 @@ public void populate() throws IOException {
@AfterEach
public void drop() {
console.close();
Assertions.assertTrue(DatabaseFactory.getActiveDatabaseInstances().isEmpty(), "Found active databases: " + DatabaseFactory.getActiveDatabaseInstances());
FileUtils.deleteRecursively(new File(DB_PATH));
}

Expand Down
48 changes: 44 additions & 4 deletions engine/src/main/java/com/arcadedb/database/DatabaseFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.arcadedb.ContextConfiguration;
import com.arcadedb.engine.PaginatedFile;
import com.arcadedb.exception.DatabaseOperationException;
import com.arcadedb.schema.EmbeddedSchema;
import com.arcadedb.security.SecurityManager;

Expand All @@ -26,18 +27,19 @@
import java.util.concurrent.*;

public class DatabaseFactory implements AutoCloseable {
private SecurityManager security;
private boolean autoTransaction = false;
private final static Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
private static final Map<String, Database> ACTIVE_INSTANCES = new ConcurrentHashMap<>();
private final ContextConfiguration contextConfiguration = new ContextConfiguration();
private final String databasePath;
private final Map<DatabaseInternal.CALLBACK_EVENT, List<Callable<Void>>> callbacks = new HashMap<>();
private final static Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
private SecurityManager security;
private boolean autoTransaction = false;

public DatabaseFactory(final String path) {
if (path == null || path.isEmpty())
throw new IllegalArgumentException("Missing path");

if (path.endsWith("/"))
if (path.endsWith("/") || path.endsWith("\\"))
databasePath = path.substring(0, path.length() - 1);
else
databasePath = path;
Expand All @@ -55,21 +57,35 @@ public boolean exists() {
return exists;
}

public String getDatabasePath() {
return databasePath;
}

public Database open() {
return open(PaginatedFile.MODE.READ_WRITE);
}

public synchronized Database open(final PaginatedFile.MODE mode) {
checkForActiveInstance(databasePath);

final EmbeddedDatabase database = new EmbeddedDatabase(databasePath, mode, contextConfiguration, security, callbacks);
database.setAutoTransaction(autoTransaction);
database.open();

registerActiveInstance(database);

return database;
}

public synchronized Database create() {
checkForActiveInstance(databasePath);

final EmbeddedDatabase database = new EmbeddedDatabase(databasePath, PaginatedFile.MODE.READ_WRITE, contextConfiguration, security, callbacks);
database.setAutoTransaction(autoTransaction);
database.create();

registerActiveInstance(database);

return database;
}

Expand Down Expand Up @@ -106,4 +122,28 @@ public void registerCallback(final DatabaseInternal.CALLBACK_EVENT event, Callab
}
callbacks.add(callback);
}

public static Database getActiveDatabaseInstance(final String databasePath) {
return ACTIVE_INSTANCES.get(databasePath);
}

protected static void removeActiveDatabaseInstance(final String databasePath) {
ACTIVE_INSTANCES.remove(databasePath);
}

public static Collection<Database> getActiveDatabaseInstances() {
return Collections.unmodifiableCollection(ACTIVE_INSTANCES.values());
}

private static void checkForActiveInstance(final String databasePath) {
if (ACTIVE_INSTANCES.get(databasePath) != null)
throw new DatabaseOperationException("Found active instance of database '" + databasePath + "' already in use");
}

private static void registerActiveInstance(final EmbeddedDatabase database) {
if (ACTIVE_INSTANCES.putIfAbsent(database.databasePath, database) != null) {
database.close();
throw new DatabaseOperationException("Found active instance of database '" + database.databasePath + "' already in use");
}
}
}
Loading