duckdb 0.5.2-dev1940.0 → 0.5.2-dev1945.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.5.2-dev1940.0",
5
+ "version": "0.5.2-dev1945.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -81806,10 +81806,10 @@ public:
81806
81806
  if (!current_collection) {
81807
81807
  return;
81808
81808
  }
81809
- if (!written_to_disk || current_collection->GetTotalRows() < LocalStorage::MERGE_THRESHOLD) {
81809
+ if (!written_to_disk && current_collection->GetTotalRows() < LocalStorage::MERGE_THRESHOLD) {
81810
81810
  return;
81811
81811
  }
81812
- writer->FlushToDisk(*current_collection);
81812
+ writer->FlushToDisk(*current_collection, true);
81813
81813
  }
81814
81814
 
81815
81815
  void CreateNewCollection(TableCatalogEntry *table, const vector<LogicalType> &insert_types) {
@@ -81858,7 +81858,6 @@ SinkResultType PhysicalBatchInsert::Sink(ExecutionContext &context, GlobalSinkSt
81858
81858
  TransactionData tdata(0, 0);
81859
81859
  lstate.current_collection->FinalizeAppend(tdata, lstate.current_append_state);
81860
81860
  lstate.FlushToDisk();
81861
-
81862
81861
  gstate.AddCollection(context.client, lstate.current_index, move(lstate.current_collection), lstate.writer,
81863
81862
  &lstate.written_to_disk);
81864
81863
  lstate.CreateNewCollection(table, insert_types);
@@ -212337,11 +212336,10 @@ OptimisticDataWriter::OptimisticDataWriter(DataTable *table, OptimisticDataWrite
212337
212336
  OptimisticDataWriter::~OptimisticDataWriter() {
212338
212337
  }
212339
212338
 
212340
- void OptimisticDataWriter::CheckFlushToDisk(RowGroupCollection &row_groups) {
212341
- // we finished writing a complete row group
212342
- // check if we should pre-emptively write it to disk
212339
+ bool OptimisticDataWriter::PrepareWrite() {
212340
+ // check if we should pre-emptively write the table to disk
212343
212341
  if (table->info->IsTemporary() || StorageManager::GetStorageManager(table->db).InMemory()) {
212344
- return;
212342
+ return false;
212345
212343
  }
212346
212344
  // we should! write the second-to-last row group to disk
212347
212345
  // allocate the partial block-manager if none is allocated yet
@@ -212349,6 +212347,14 @@ void OptimisticDataWriter::CheckFlushToDisk(RowGroupCollection &row_groups) {
212349
212347
  auto &block_manager = table->info->table_io_manager->GetBlockManagerForRowData();
212350
212348
  partial_manager = make_unique<PartialBlockManager>(block_manager);
212351
212349
  }
212350
+ return true;
212351
+ }
212352
+
212353
+ void OptimisticDataWriter::CheckFlushToDisk(RowGroupCollection &row_groups) {
212354
+ // we finished writing a complete row group
212355
+ if (!PrepareWrite()) {
212356
+ return;
212357
+ }
212352
212358
  // flush second-to-last row group
212353
212359
  auto row_group = row_groups.GetRowGroup(-2);
212354
212360
  FlushToDisk(row_group);
@@ -212371,10 +212377,15 @@ void OptimisticDataWriter::FlushToDisk(RowGroup *row_group) {
212371
212377
  }
212372
212378
  }
212373
212379
 
212374
- void OptimisticDataWriter::FlushToDisk(RowGroupCollection &row_groups) {
212380
+ void OptimisticDataWriter::FlushToDisk(RowGroupCollection &row_groups, bool force) {
212375
212381
  if (!partial_manager) {
212376
- // no partial manager - nothing to flush
212377
- return;
212382
+ if (!force) {
212383
+ // no partial manager - nothing to flush
212384
+ return;
212385
+ }
212386
+ if (!PrepareWrite()) {
212387
+ return;
212388
+ }
212378
212389
  }
212379
212390
  // flush the last row group
212380
212391
  FlushToDisk(row_groups.GetRowGroup(-1));
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "321b5fb2a1"
15
- #define DUCKDB_VERSION "v0.5.2-dev1940"
14
+ #define DUCKDB_SOURCE_ID "be1bd1704f"
15
+ #define DUCKDB_VERSION "v0.5.2-dev1945"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -26539,12 +26539,16 @@ public:
26539
26539
  //! Flushes a specific row group to disk
26540
26540
  void FlushToDisk(RowGroup *row_group);
26541
26541
  //! Flushes the final row group to disk (if any)
26542
- void FlushToDisk(RowGroupCollection &row_groups);
26542
+ void FlushToDisk(RowGroupCollection &row_groups, bool force = false);
26543
26543
  //! Final flush: flush the partial block manager to disk
26544
26544
  void FinalFlush();
26545
26545
 
26546
26546
  void Rollback();
26547
26547
 
26548
+ private:
26549
+ //! Prepare a write to disk
26550
+ bool PrepareWrite();
26551
+
26548
26552
  private:
26549
26553
  //! The table
26550
26554
  DataTable *table;